Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. nnoremap j :call CheckJ()<cr>
  2. nnoremap k :call CheckK()<cr>
  3. nnoremap h :call CheckH()<cr>
  4. nnoremap l :call CheckL()<cr>
  5.  
  6. fun! CheckJ()
  7. if line('.') == line('$')
  8. norm! gg
  9. else
  10. norm! j
  11. endif
  12. endfun
  13.  
  14. fun! CheckK()
  15. if line('.') == 1
  16. norm! G
  17. else
  18. norm! k
  19. endif
  20. endfun
  21.  
  22. fun! CheckH()
  23. if col('.') == 1
  24. norm! $
  25. else
  26. norm! h
  27. endif
  28. endfun
  29.  
  30. fun! CheckL()
  31. if col('.') == (col('$') - 1)
  32. norm! 0
  33. else
  34. norm! l
  35. endif
  36. endfun
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement