Close all viewports (split screens) in Vim at once
Use :qa for “quit all”. If you have unsaved buffers you’ll have to add a bang: :qa!.
Use :qa for “quit all”. If you have unsaved buffers you’ll have to add a bang: :qa!.
You can do this in vim using the ! command. For instance to count the number of words in the current file you can do: :! wc % The % is replaced by the current filename. To run a script you could call the interpreter on the file – for instance if you are writing … Read more
yank those lines in register: :364,757yEnter if you want to copy those lines and paste to some certain line, t is your friend. for example: :364,757t2Enter will copy those lines to under 2nd line. if you want to copy them to right under your current line: :364,757t.Enter
bindkey -v is enough to enable vi mode in ZSH. If you are worried the setting will be overwritten by another plugin, put the setting at the bottom of your ~/.zshrc. After vi mode is enabled, you enter the “insert” mode by default. To enter “normal” mode, use Esc. And i or a to switch … Read more
You mean conflict markers such as <<<<<<<, =======, and >>>>>>> on merges to indicate that the automatic resolution failed?! You can use my ConflictMotions plugin for that; it provides ]x and [x mappings, ]= for navigation within a conflict, and even corresponding text objects ax and a=.
Certain keys, when pressed, will trigger Vim’s indent feature, which will attempt to set the correct amount of indentation on the current line. (You can manually trigger this by typing == in normal mode.) You can change which keys trigger this behavior, but first you need to know what indenting mode is being used. First, … Read more
In vim, the macros are just stored in registers. You can recall the content of any register and execute it as a macro (which is what the @ does). To see a list of what is in your registers, use :reg.
You can either use :silent or :silent! as a prefix to any command or you can add the ‘e’ option to the substitute, which is often easier. :%s/x/y/ge :silent! %s/x/y/g :silent %s/x/y/g For more information, see :help :silent :help :s_flags The information on the e flag is a few paragraphs down from the :s_flags help.
You can map using :mksession and :source to a set of keys for easy saving and restoring. Here’s an example from my .vimrc that uses F2 and F3: map <F2> :mksession! ~/vim_session <cr> ” Quick write session with F2 map <F3> :source ~/vim_session <cr> ” And load session with F3
This is the simplest way I know of to do this easily from the command line: vim +”argdo se bomb | se fileencoding=utf-8 | w” $(find . -type f -name *.php) Or better yet if the number of files is expected to be pretty large: find . -type f -name *.php | xargs vim +”argdo … Read more