Advertisement
Guest User

Untitled

a guest
Apr 9th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.29 KB | None | 0 0
  1. function! s:Gm(isVisual)
  2.   normal! ^
  3.   let first_col = virtcol('.')
  4.   normal! g_
  5.   let last_col = virtcol('.')
  6.   execute 'normal! ' . (a:isVisual ? 'gv': '') . (first_col + last_col) / 2 . '|'
  7. endfunction
  8. nnoremap <silent> gm :call <SID>Gm(0)<CR>
  9. vnoremap <silent> gm :call <SID>Gm(1)<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement