Skip to content

Instantly share code, notes, and snippets.

@b3niup
Created September 6, 2015 13:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b3niup/0f9dff576bc36eff8ff9 to your computer and use it in GitHub Desktop.
Save b3niup/0f9dff576bc36eff8ff9 to your computer and use it in GitHub Desktop.
vim H and L mappings
" 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