You can open several files in tabs from the command line with vim, just type:
vim -p file1 file2 file3
And each file specified on the command line will be opened in a new tab.
To open a file in a new tab inside vim use :tabe file
To close a tab do :tabc
You can quickly switch between tabs typing gt or gT in normal mode. To switch to a particular tab prepend the tab number to gt, i.e. type #gt, where #gt is the tab number.
Vim has a so called “very magic” mode for regexes which allows you to use parenthesis, brackets, the alternative separator (i.e. ‘|’), pluses, etc. with their special meaning but without the need to escape those characters.
(see :help /\v)
Let’s say you have the following in your buffer:
If you execute
you will get
but it required a lot of backslash escaping in the regex. You can avoid the need to escape parenthesis, curly braces, pluses, etc. using vim’s “very magic” mode for regexes. The following would do exactly the same as the previous substitution command but with fewer escaping required:
In Bash, when I want to repeat the last argument of the previous command, I usually type !$. I just discovered that you can also use ALT+. to cycle through the last argument of previous commands.
Just like <TAB> expands a filename given a prefix you can also expand a file name given the middle part of a file name.
abc1def abc2def abc3def abc4def abc5def
$ ls *2*<ESC>g
Which will expand to:
$ ls abc2def
via a stackoverflow question