Below you will find pages that utilize the taxonomy term “Vim”
July 21, 2008
Intro to Vim Tip #6 (Multiple viewports)
One feature of vim I don’t use enough is the ability to split the screen and view multiple files at once. I use this feature all the time when I use vimdiff, but not really any other time. I thought I’d take a moment to lay out some uses of it (thank Linux.com for the reference):
From Command Mode:
:sp splits the screen horizontally :vsp splits the screen vertically Ctrl-w Ctrl-w moves between viewports Ctrl-w [right arrow] moves active viewport 1 to the right Ctrl-w [left arrow] moves active viewport 1 to the left Ctrl-w 3[left arrow] moves active viewport 3 to the left Ctrl-w q will close the active window.
read moreOctober 7, 2007
Intro to Vim Tip #5 (Recording)
Search and replace is a great feature in most text editors, but what happens when you want to do more? Vim has a solution- recording macros. Suppose you have the following output from some ancient program that needs to be tweaked:
<br></br>X1222 22323 2A22 3303 0000 3334esss test 123<br></br>X2222 22353 2A22 3303 0001 3334esss tacd 456<br></br>X3222 22383 2A22 3303 0010 3334esss fals 789<br></br>X4222 22393 2A22 3303 0011 3334esss true 012<br></br>
read moreAugust 6, 2007
Spell checking only *.txt files in Vim
So vim 7 has native spell checking- which is great if you remember to turn it on. Enabling it in your .vimrc is fine if all you view is written text files, but annoying when it’s running while working on code.
That’s why I created this little snippet of sunshine:
add this to ~/.vimrc:
au BufNewFile,BufRead *.txt call ConfigureTxtFile() func! ConfigureTxtFile() setlocal spell spelllang=en_us set wrapmargin=80 set textwidth=80 endfunction I also use it to set my text width and wrap margins.
read moreJuly 14, 2006
Intro to Vim Tip #4 (Pasting)
If you need to paste into vim from somewhere else, and your code has tabs or spaces in it, you’ll notice that vim may add extra tabs. see, vim doesn’t see it as a paste event, it sees it as “you typing really fast”- and one thing vim does will is auto-indent. The problem is when you paste, you don’t want auto-indentation because your code is already indented.
to temporarily turn off auto-indenting, try this from insert mode:
read moreJuly 10, 2006
Intro to Vim Tip #3 (Visual Mode)
Another well used mode is Visual Mode, which turns your cursor into a hilighter.
open a textfile with several lines of text ad move the cursor to the middle
switch from command mode to visual mode:
v You’ll notice as you move the cursor around, you highlight different sections from the point you started to the point you left. you can press [esc] to return to command mode.
hilight a few lines of text from command mode:
read moreJuly 10, 2006
Intro to Vim Tip #2 (deleting)
Deleting in vim can be done several ways- in insert mode, the delete key and backspace key perform as you’d expect them to, but what if you want more?
delete the character to the left of the cursor:
[esc]d[left arrow] delete the character to the right of the cursor:
[esc]d[right arrow] deleting the current line from insert mode:
[esc]dd deleting the current line and the one below from insert mode:
read moreJuly 10, 2006
Intro to Vim Tip #1
Vim is a great tool, but using is can be a pita in the beginning- hence, we go through the basics. There are several command modes, but we’ll only discuss a few at first: Command Mode and Insert Mode.
Command mode is used to perform actions like saving, searching, etc. Insert mode is used to insert and delete text. You’ll be switching between them a lot.
Open a file from the cli:
read more