in reply to A recipe for testing and debugging with vim

Aside from your post, some interesting tricks I use in my global (ie. the base config I inherit on every machine I work on) ~/.vimrc:

iab _perl use strict;<CR>use warnings;<CR> set expandtab set tabstop=4 set shiftwidth=4 set smartindent set nocompatible hi folded ctermfg=none ctermbg=none setlocal fo-=t fo-=r fo-=q fo-=o set backspace=indent,eol,start :nnoremap <Space> i<Space><Esc> function GetPerlFold() if getline(v:lnum) =~ '^\s*sub\s' return ">1" elseif getline(v:lnum) =~ '\}\s*$' let my_perlnum = v:lnum let my_perlmax = line("$") while (1) let my_perlnum = my_perlnum + 1 if my_perlnum > my_perlmax return "<1" endif let my_perldata = getline(my_perlnum) if my_perldata =~ '^\s*\(\#.*\)\?$' " do nothing elseif my_perldata =~ '^\s*sub\s' return "<1" else return "=" endif endwhile else return "=" endif endfunction setlocal foldexpr=GetPerlFold() setlocal foldmethod=expr " remove vim backup files function RemoveVimBackup() w ! find . -name "*~" | xargs rm endfunction " map ii to ESC map! ii <Esc> " execute file currently being edited map ,run :!./% " custom map ,rvb :call RemoveVimBackup()<CR>

Replies are listed 'Best First'.
Re^2: A recipe for testing and debugging with vim
by nysus (Parson) on Mar 08, 2017 at 05:29 UTC

      That's pretty nifty, but to be honest, I've used vi/vim for so long now that I prefer the editor to inform me when I already have a file open in a different instance of the editor, so personally, I wouldn't use such a thing as this.