
vim - How to run a shell command through vimscript ... - Stack …
2012年5月26日 · There is <C-_> for ^_ and <CR> for ^M (in vim, not in vi). Do not suggest using raw control codes in vimrc, this scraps the output of tools that expect text (like cat vimrc | grep fmt ). It may also make VCS systems take vimrc as a binary file effectively disabling plain vcs diff and scrapping output of vcs diff -a just as it does for grep .
Simplest way to run a vim script - Stack Overflow
I assume to run a vim script I would want to be 'inside' the vim process (so for example, I could highlight text or do whatever might be necessary for the input to the vim script). Currently I do this in a quite tedious manner: I put the function in vimrc and then whenever I want to run it I …
Execute a script directly within vim/mvim/gvim - Stack Overflow
2010年7月2日 · vim tutorial: Mapping keys in Vim. You can map keys so perl executes current script as suggested by jts above. map <C-p> :w<CR>:!perl %<CR> will map Ctrl+P to write file and run it by perl. imap <C-p> <Esc>:w<CR>:!perl %<CR> lets you call the same in insert mode. You should have .vimrc (_vimrc for Windows) file in your vim/home folder.
vim script: how to execute a command in a vim function
2011年9月29日 · Have a look at this script from vim.wikia.com which does pretty much what you are asking for. Key-line seems to be this one: let nowcolors = 'elflord morning desert evening pablo' execute 'colorscheme '.split(nowcolors)[i]
What's a quick way to comment/uncomment lines in Vim?
2009年11月5日 · A few regular Vim commands do not work with my setup on Windows. Ctrl + v and Ctrl + q are some of them. I later discovered the following methods worked to uncomment lines. Given. Some indented comments # Practice in Vim # Practice in Vim # Practice in Vim # Practice in Vim # Practice in Vim # Practice in Vim # Practice in Vim
Passing and using arguments to command in Vim script
2014年7月31日 · This is so common that Vim has a special notation for it; See :help <q-args>. Now, for :execute , you'd need another level of quoting (and based on your comments it seems you went down that road): :command! -nargs=1 FW execute "echo" string(<q-args>)
vim - How to get visually selected text in VimScript - Stack Overflow
the use of getpos('v') is critical if you want the current selection (say within a map expression) as opposed to the last selection. such maps need an <esc>gv prefix otherwise. additionally, if you separate the function into range and text components, you can just sort the range components rather than reverse the text, which should be faster ...
Scripting common tasks in Vim - Stack Overflow
2017年8月16日 · The vim script language is a bit too limited to try to do grand things in, for my taste. (Although vim 7 has made great strides in that respect, by borrowing a bunch of things from Python.) Note that @ does something very simple: it takes the contents of a register and replays them as if you had typed them in normal mode.
How to get path to the current vimscript being executed
2011年2月12日 · In my vim plugin, I have two files: myplugin/plugin.vim myplugin/plugin_helpers.py I would like to import plugin_helpers from plugin.vim (using the vim python support), so I believe I first need to put the directory of my plugin on python's sys.path. How can I (in vimscript) get the path to the currently executing script? In python, this is ...
vi - How do I exit Vim? - Stack Overflow
2017年5月24日 · Commands marked with '*' are Vim-only (not implemented in Vi). Safe-quit (fails if there are unsaved changes)::q[uit] Quit the current window. Quit Vim if this is the last window. This fails when changes have been made in current buffer.:qa[ll]* Quit all windows and Vim, unless there are some buffers which have been changed.