I feel silly for only recently discovering tabs in vim. :tabnew file Opens up a new tab, :tabn Goes to the next tab, and :tabp Goes to the previous tab. Works great in both gui and non-gui mode.
gt and gT in command mode also do next tab and previous tab
Efficient Editing With vim
11–20 of 125 posts
Re: Efficient Editing With vim
#12Re: Efficient Editing With vim
#13I feel silly for only recently discovering tabs in vim. :tabnew file Opens up a new tab, :tabn Goes to the next tab, and :tabp Goes to the previous tab. Works great in both gui and non-gui mode.
gt and gT in command mode also do next tab and previous tab
Re: Efficient Editing With vim
#14Re: Efficient Editing With vim
#15I feel silly for only recently discovering tabs in vim. :tabnew file Opens up a new tab, :tabn Goes to the next tab, and :tabp Goes to the previous tab. Works great in both gui and non-gui mode.
set bufhidden
nmap :bp
nmap :bn
If you put this in your .vimrc file, you'll need to put a '^M' at the end of the nmap lines. You do this by doing and it puts in a special character that means newline. Then you can switch between open buffers with ctrl+l and ctrl+h even if you have unsaved changes. it will end up looking like this: set bufhidden
nmap :bp^M
nmap :bn^M
Unfortunately if you have many files open and don't touch them all it prevents you from quitting with a message 'E173: 17 more files to edit'. I haven't worked out how to obliterate this without damaging features I want (e.g. not quitting when there's unsaved data in those other files).The default vim that ships with linux distributions is often a pile of junk that has been hacked by the distribution, is missing features like these. You want to get vim-extended under redhat-like distributions (they've significantly improved the quality if their junk vim in recent releases), and vim-nox or vim-full in debian-like distributions.
Re: Efficient Editing With vim
#16Amazingly, this is the first I've heard of fx/tx/Fx. How ridiculously awesome.
document.getElementById('asweetid')
and you want to grab just the id for use elsewhere. In command mode pressing f' will move your cursor to the quote, yf' will put 'asweetid' into your yank register and a p anywhere else will paste it. I also make heavy use of ctx where x is a character on a line that I want to replace up to. The best part about vim, I think, is how I think about the commands in my head and they just kind of flow out of my fingers.
"Hmm I want to change (press c) to (press t) that closing paren (press shift 0)."
Even just typing that my left hand instinctively moved toward the caps lock to go to command mode.
Re: Efficient Editing With vim
#17I think it's the first time that I want to install vim to try it. As a Windows user, I always found NotePad++ and other text editor an easier choice but I can now see some powerfull utilities to vim now. Very clear article.
Users who want to run Windows vim with no titlebar, create a file _vimrc in your base vim directory (on my windows desktop it's C:\Program Files\Vim). In this, put this line:
set guioptions-=TRe: Efficient Editing With vim
#18Amazingly, this is the first I've heard of fx/tx/Fx. How ridiculously awesome.
It's helped me polish off those last few vim commands that I never got used to. I recommend looking at it daily.
Re: Efficient Editing With vim
#19Warning: learning Vim makes you look for Vim like commands in any program you interact with using the keyboard. Everything else will be frustrating.
:q
Instead of switching to the mouse and hitting the "x". Then I had to explain to the person that I wasn't sticking my tongue out at them.Re: Efficient Editing With vim
#20Warning: learning Vim makes you look for Vim like commands in any program you interact with using the keyboard. Everything else will be frustrating.