vim:keys: WIP fix swapping of ]] and ][
Make ][ and ]] work like they used to with the new functionality through a workaround. The problem is that recursive mappings are evaluated at runtime not "compiletime" - which is what I would need in this situation. I still want both mappings blocks so that they are not entangled and I can turn each one off without affecting the other.
This commit is contained in:
@@ -274,13 +274,15 @@ vnoremap <leader>utc <Cmd>s/\v(^\|[^0-9])\zs[0-9]{10}\ze([^0-9]\|$)/\=strftime("
|
|||||||
" TODO: [count] sections? (see :h [[)
|
" TODO: [count] sections? (see :h [[)
|
||||||
nnoremap <silent> [[ m':call search('^\S.*{', "bW")<CR>
|
nnoremap <silent> [[ m':call search('^\S.*{', "bW")<CR>
|
||||||
vnoremap <silent> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\S.*{', "bW")<CR>
|
vnoremap <silent> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\S.*{', "bW")<CR>
|
||||||
nnoremap <silent> ]] m':call search('^\S.*{', "W")<CR>
|
" map ]] here and remap ][ down below for better modularization
|
||||||
vnoremap <silent> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\S.*{', "W")<CR>
|
nnoremap <silent> ][ m':call search('^\S.*{', "W")<CR>
|
||||||
|
vnoremap <silent> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\S.*{', "W")<CR>
|
||||||
|
|
||||||
" Match the behaviour of [[ and []. ]] forward to next '}' in the first column
|
" Match the behaviour of [[ and []. ]] forward to next '}' in the first column
|
||||||
" and ][ fw to next '[', instead of the other way around.
|
" and ][ fw to next '[', instead of the other way around.
|
||||||
noremap ]] ][
|
noremap ]] ][
|
||||||
noremap ][ ]]
|
" TODO: fix this with the relaxed mappings by evaluating the current rhs of ]]
|
||||||
|
" nmap ][ ]]
|
||||||
|
|
||||||
" Strip trailing whitespace
|
" Strip trailing whitespace
|
||||||
nnoremap <leader><space> <Cmd>silent! %s/\v\s+$//<CR>
|
nnoremap <leader><space> <Cmd>silent! %s/\v\s+$//<CR>
|
||||||
|
|||||||
Reference in New Issue
Block a user