Sunday, August 19, 2018

When I develop a vim script, how can I debug it?

I write a command to get the file full path.
:let @p=expand('%:p') | norm "pp
I want to make a shortcut 'cP' for it. Now I need add the 'cP' shortcut function into my _vimrc. I am not sure the first time I will do it right. So I need save my editing file status into a file by using 'mksession' command. Now I have two files 'test.txt' and '_vimrc' in editing.
But mksession will save the gvim startup _vimrc contents, not the _vimrc file that I changed it. So next time when I open gvim, still load the old _vimrc. My _vimrc changes not affected.

The final result in my _vimrc is:
nnoremap cP :let @p=expand('%:p')<CR>:norm "pp<CR>

This is a simple command that need some change in _vimrc. So if I write a script function, how can I debug it?

--
--
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.

No comments:

Post a Comment