From 252cea169185f5a57acb6913f622950bb27458f8 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sun, 11 Jun 2023 23:21:38 +0200 Subject: Drop support for vim, cleanup nvim config --- vim/gvimrc | 234 ------------------------------------------------------------- 1 file changed, 234 deletions(-) delete mode 100644 vim/gvimrc (limited to 'vim/gvimrc') diff --git a/vim/gvimrc b/vim/gvimrc deleted file mode 100644 index af0fe2c..0000000 --- a/vim/gvimrc +++ /dev/null @@ -1,234 +0,0 @@ -if has("gui_macvim") - " Fullscreen takes up entire screen - set fuoptions=maxhorz,maxvert - - " Command-T for CommandT - macmenu &File.New\ Tab key= - map :CommandT - imap :CommandT - - " Command-Return for fullscreen - macmenu Window.Toggle\ Full\ Screen\ Mode key= - - " Command-Shift-F for Ack - map :Ack - - " Command-e for ConqueTerm - map :call StartTerm() - - " Command-/ to toggle comments - map NERDCommenterToggle - imap NERDCommenterTogglei - - - " Command-][ to increase/decrease indentation - vmap >gv - vmap 0gt - imap 0gt - map 1gt - imap 1gt - map 2gt - imap 2gt - map 3gt - imap 3gt - map 4gt - imap 4gt - map 5gt - imap 5gt - map 6gt - imap 6gt - map 7gt - imap 7gt - map 8gt - imap 8gt - map 9gt - imap 9gt - - " Command-Option-ArrowKey to switch viewports - map k - imap k - map j - imap j - map l - imap l - map h - imap h - - " Adjust viewports to the same size - map = = - imap = = -endif - -" Don't beep -set visualbell - -" Start without the toolbar -set guioptions-=T - -" Default gui color scheme -color ir_black - -" ConqueTerm wrapper -function StartTerm() - execute 'ConqueTerm ' . $SHELL . ' --login' - setlocal listchars=tab:\ \ -endfunction - -" Project Tree -if exists("loaded_nerd_tree") - autocmd VimEnter * call s:CdIfDirectory(expand("")) - autocmd FocusGained * call s:UpdateNERDTree() - autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft() -endif - -" Close all open buffers on entering a window if the only -" buffer that's left is the NERDTree buffer -function s:CloseIfOnlyNerdTreeLeft() - if exists("t:NERDTreeBufName") - if bufwinnr(t:NERDTreeBufName) != -1 - if winnr("$") == 1 - q - endif - endif - endif -endfunction - -" If the parameter is a directory, cd into it -function s:CdIfDirectory(directory) - let explicitDirectory = isdirectory(a:directory) - let directory = explicitDirectory || empty(a:directory) - - if explicitDirectory - exe "cd " . fnameescape(a:directory) - endif - - " Allows reading from stdin - " ex: git diff | mvim -R - - if strlen(a:directory) == 0 - return - endif - - if directory - NERDTree - wincmd p - bd - endif - - if explicitDirectory - wincmd p - endif -endfunction - -" NERDTree utility function -function s:UpdateNERDTree(...) - let stay = 0 - - if(exists("a:1")) - let stay = a:1 - end - - if exists("t:NERDTreeBufName") - let nr = bufwinnr(t:NERDTreeBufName) - if nr != -1 - exe nr . "wincmd w" - exe substitute(mapcheck("R"), "", "", "") - if !stay - wincmd p - end - endif - endif - - if exists(":CommandTFlush") == 2 - CommandTFlush - endif -endfunction - -" Utility functions to create file commands -function s:CommandCabbr(abbreviation, expansion) - execute 'cabbrev ' . a:abbreviation . ' =getcmdpos() == 1 && getcmdtype() == ":" ? "' . a:expansion . '" : "' . a:abbreviation . '"' -endfunction - -function s:FileCommand(name, ...) - if exists("a:1") - let funcname = a:1 - else - let funcname = a:name - endif - - execute 'command -nargs=1 -complete=file ' . a:name . ' :call ' . funcname . '()' -endfunction - -function s:DefineCommand(name, destination) - call s:FileCommand(a:destination) - call s:CommandCabbr(a:name, a:destination) -endfunction - -" Public NERDTree-aware versions of builtin functions -function ChangeDirectory(dir, ...) - execute "cd " . fnameescape(a:dir) - let stay = exists("a:1") ? a:1 : 1 - - NERDTree - - if !stay - wincmd p - endif -endfunction - -function Touch(file) - execute "!touch " . shellescape(a:file, 1) - call s:UpdateNERDTree() -endfunction - -function Remove(file) - let current_path = expand("%") - let removed_path = fnamemodify(a:file, ":p") - - if (current_path == removed_path) && (getbufvar("%", "&modified")) - echo "You are trying to remove the file you are editing. Please close the buffer first." - else - execute "!rm " . shellescape(a:file, 1) - endif - - call s:UpdateNERDTree() -endfunction - -function Mkdir(file) - execute "!mkdir " . shellescape(a:file, 1) - call s:UpdateNERDTree() -endfunction - -function Edit(file) - if exists("b:NERDTreeRoot") - wincmd p - endif - - execute "e " . fnameescape(a:file) - -ruby << RUBY - destination = File.expand_path(VIM.evaluate(%{system("dirname " . shellescape(a:file, 1))})) - pwd = File.expand_path(Dir.pwd) - home = pwd == File.expand_path("~") - - if home || Regexp.new("^" + Regexp.escape(pwd)) !~ destination - VIM.command(%{call ChangeDirectory(fnamemodify(a:file, ":h"), 0)}) - end -RUBY -endfunction - -" Define the NERDTree-aware aliases -if exists("loaded_nerd_tree") - call s:DefineCommand("cd", "ChangeDirectory") - call s:DefineCommand("touch", "Touch") - call s:DefineCommand("rm", "Remove") - call s:DefineCommand("e", "Edit") - call s:DefineCommand("mkdir", "Mkdir") -endif - -" Include user's local vim config -if filereadable(expand("~/.gvimrc.local")) - source ~/.gvimrc.local -endif -- cgit