Since vim doesn't support having some lines editable and others not, I figured it out that I can simulate this by keeping meta data about lines and remapping all keys to a function which checks cursor position and decides whether to put the character in question or not. So far so good, now I need to prohibit the cursor from going to certain locations. I remapped h,j,k,l keys like this:
map <expr> h Key_h()
map <expr> j Key_j()
map <expr> k Key_k()
map <expr> l Key_l()
That also works like a charm. Somewhere in the those functions I call setpos() like this:
call setpos(".", [0, a:line, a:column, 0])
Unfortunately the only thing this does is to send cursor the first column at the line it is currently in. Further movement with h,j,k,l does nothing. From inside the mapped functions Key_h(), Key_j() I return nothing, since cursor movement is already performed.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sunday, January 15, 2017
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment