Automatic closing brackets for Vim [closed]

For those of us, who want a vanilla vim: inoremap ” “”<left> inoremap ‘ ”<left> inoremap ( ()<left> inoremap [ []<left> inoremap { {}<left> inoremap {<CR> {<CR>}<ESC>O inoremap {;<CR> {<CR>};<ESC>O This autocomplete in insert mode, provided set paste is not set. Keep it in the vimrc to avoid typing it every time and when we … Read more

Smart Wrap in Vim

This feature has been implemented on June 25, 2014 as patch 7.4.338. There followed a few patches refining the feature, last one being 7.4.354, so that’s the version you’ll want. :help breakindent :help breakindentopt Excerpts from vim help below: ‘breakindent’ ‘bri’ boolean (default off) local to window {not in Vi} {not available when compiled without … Read more

Best way to insert timestamp in Vim?

To make it work cross-platform, just put the following in your vimrc: nmap <F3> i<C-R>=strftime(“%Y-%m-%d %a %I:%M %p”)<CR><Esc> imap <F3> <C-R>=strftime(“%Y-%m-%d %a %I:%M %p”)<CR> Now you can just press F3 any time inside Vi/Vim and you’ll get a timestamp like 2016-01-25 Mo 12:44 inserted at the cursor. For a complete description of the available parameters … Read more

Working with huge files in VIM

I had a 12GB file to edit today. The vim LargeFile plugin did not work for me. It still used up all my memory and then printed an error message :-(. I could not use hexedit for either, as it cannot insert anything, just overwrite. Here is an alternative approach: You split the file, edit … Read more

reformat in vim for a nice column layout

If you’re on some kind of UNIX (Linux, etc), you can cheat and filter it through the column(1) command. :%!column -t The above will parse on delimiters inside string literals which is wrong, so you will likely need pre-processing steps and specifying the delimiter for this file for example: %!sed ‘s/”,”/\&/’ | column -t -s … Read more