My Vim Tips

I would like to accomplish a few things here. One of which is a fix for my using a Dvorak keyboard and thus h,j,k,l does not work. Some of my favorite command options and plugins. How I got Vim working in Eclipse. And last is an argument for the using tabs instead of spaces in source code.

My .vimrc

Download nascent.vimrc

You can either copy and past the code to you .vimrc file. Or you can add the line 'so nascent.vimrc' to your current rc file.

Configuring Vim for Dvorak

The code that fallows should be placed in the .vimrc of your home directory. For windows users you can either set a path variable $HOME and place it there or you can find you gvim location and it to the end of the existing .vimrc.

So here are what has been changed: d,h,t,n are the new movement keys.
The fixes for what is broken

There were also some changes for familiarity, 's'/'S' can be used to access command mode (the old location of the :, which still works).


Added Benefits
" Dvorak it!
no d h
no h j
no t k
no n l
no s :
no S :
no j d
no l n
no L N

" Added benefits
no - $
no _ ^

no N <C-w><C-w>
"no T <C-w><C-r>
no H 8<down>
no T 8<up>
no D <C-w><C-r>

My Favorite Commands

This one I have placed in my .vimrc
 " Map Q for formatting
map Q gq
:make
Runs make and will bring you to the line of the first error.
:copen/:cclose
Opens a lower window that shows the error list from :make Use enter to jump to the selected error.
:cn
Moves to the next error in the list.
:!ctags *.{code}
This is an application that is supposed to be installed with Vim, but was not by default on SUSE. This command will creat a tags file in your current directory. This will allow for tag jumping, some commands are listed below.
<C-]>
This will jump to a function when the curser is on a fuction call.
<C-t>
Brings you back to the place you left. These use a stack so you can traverse several and come back to where you started.
<C-n> or <C-p>
This will compete the text if it can find matching tags, repitition will cycle through matches and Vim 7 will provide a list. I am a littel confused on this because <C-n> is supposed to the same as :cn, but for me it does the same as <C-p>. What do others get?

Good links

Programming with Vim
Ten Things to Know about Vim
Look at Vim 7

Installing the vimplugin for Eclipse

The Eclipse vimplugin will integrate vim into Eclipse as the default editor. Note I don't know how to get it working in Windows.

Extract to your eclipse directory and run eclipse. I ran into an unexpected exception that was due to it not finding vim.org. Thus one can create a sym-link in the bin directory. # ln -s /usr/bin/vim /usr/bin/vim.org Simple.

Why I use Tabs

So there seems to be a big debate over coding with Tabs or Spaces. The article, Tabs VS Spaces, does a good job of explaining what the argument is about, and how to make editors use spaces instead of tabs. However, he makes no claim as to why spaces should be used for over tabs. Since it seems that tabs are frowned apon by the majority of what I read, I think an argument for tabs is inorder.

Tabs make code unreadable. I have not seen code where tabs make it difficult to read. I have seen mixing of tabs and spaces that will do this. I would like a deep explination here.

This may be the answer to this above. Tabs were apperantly defined as a multiple of 8 characters. So if this is the interpritation I understand. But I'm going to change it. Definitions of words change, tab is less useful if it is to be a multiple of 8, thus it gets modified to mean indent to a multipule of x. x being a variable provided by the user. Here is another reasoning to the changing its meaning. \n, why does linux just use a line feed? This does me little good, I usually want to start the text at the next line at beginning not the end so there should also be \r (carage return) to correct this. So why make \n mean both?

Now that tab is defined this is why I use/prefer it over spaces. I don't want my indents to be 8 characters, I don't want them to be 2 characters, I don't want them to be 4, my choice is 3. That's right I like three. If you don't like 3 then when you view the file with your editor you get your prefered 2/4/8. If spaces are used your stuck with 3. If I get someone else's file and the use 4 or 2 spaces, I'm stuck viewing it that way (there is no way to custimize it).

So now I request a good reason for spaces.