Created
September 6, 2015 13:40
-
-
Save b3niup/0f9dff576bc36eff8ff9 to your computer and use it in GitHub Desktop.
vim H and L mappings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Jump to first character or last column | |
noremap <silent> L :call FirstCharOrLastCol()<cr> | |
function! FirstCharOrLastCol() | |
let current_col = virtcol('.') | |
normal ^ | |
let first_char = virtcol('.') | |
if current_col >= first_char | |
normal $ | |
endif | |
endfunction | |
" Jump to first character or column | |
noremap <silent> H :call FirstCharOrFirstCol()<cr> | |
function! FirstCharOrFirstCol() | |
let current_col = virtcol('.') | |
normal ^ | |
let first_char = virtcol('.') | |
if current_col == first_char | |
normal 0 | |
endif | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment