diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-05-31 12:12:46 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-05-31 12:13:57 -0400 |
commit | 0c58d72663c5a87c1f84a34dcfd805940c707fe9 (patch) | |
tree | 7fd13a335542708c5405684a83dba36a9c4edfe0 | |
parent | 6d7cbff74daa0a7706b43cfebaf4eab0319b1956 (diff) | |
download | conf-0c58d72663c5a87c1f84a34dcfd805940c707fe9.tar.gz conf-0c58d72663c5a87c1f84a34dcfd805940c707fe9.zip |
autoappend closing characters in vim
-rw-r--r-- | vimrc | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -645,6 +645,18 @@ nmap <silent>) 0 nmap <silent>g) g0 nmap <Bar> \ " }}} +" auto-append closing characters {{{ +inoremap { {}<Left> +inoremap {<CR> {<CR>}<Esc>O +inoremap {} {} +inoremap <expr> } strpart(getline('.'), col('.')-1, 1) == "}" ? "\<Right>" : col('.') == col('$') && match(getline(line('.') + 1), '^\s*}') != -1 ? "\<Down>\<C-o>$" : "}" +inoremap ( ()<Left> +inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")" +inoremap [ []<Left> +inoremap <expr> ] strpart(getline('.'), col('.')-1, 1) == "]" ? "\<Right>" : "]" +inoremap <expr> ' strpart(getline('.'), col('.')-1, 1) == "\'" ? "\<Right>" : col('.') == 1 \|\| match(strpart(getline('.'), col('.')-2, 1), '\W') != -1 ? "\'\'\<Left>" : "\'" +inoremap <expr> " strpart(getline('.'), col('.')-1, 1) == "\"" ? "\<Right>" : "\"\"\<Left>" +" }}} " Miscellaneous {{{ " have Y behave analogously to D rather than to dd nnoremap Y y$ |