I have used many text editors. Some for specific tasks such as LaTeX editing (Eg: Texmaker), coding (Eg: gedit with plugins) and the others for more generic text editing.
As a system administrator I have been using Vi/Vim all along for editing configuration files and the likes. It was always convenient as almost every Unix system has vi/vim. For me the first Unix editor I used was Emacs. I felt more at home with Emacs key combinations than a hard to fathom Vim modes. Time passed and after a little while, I got used to basic Vi concepts. Since then all of my editing in command line was done in vi/vim.
As I've said recently, I have been transforming myself from a sysadmin to a sysadmin/developer kind of person. For coding purposes I used gedit. Some people might think of gedit as the notepad.exe of Linux, but that's so not correct. In fact gedit is a powerful text editor with a lot of plugins to extend it's capabilities. For example there there are plugins for LaTeX, Python consoles, bash terminal, snippet completing, snap open, integration with VCSs, smart tab/space, code formatter, class browser, Ruby on Rails modes, encryption, smart indentation, ToDo list, web browser, full screen editing, split screen, PO file editing, markdown preview, etc. among other things. As you can see, it's no toy editor. It's fully fledged editor for serious work.
Let's get back to the topic. I love gedit and I use it whenever I need. But from a couple months ago, my main editor is Vim. Vim is the most popular improved clone of the original Vi editor. It's been around for about 18 years. So you too might be wondering "Why, oh WHY, do those #?@! nutheads use vi?" or why Vim, an 18 year old, hard to learn terminal based text editor?!
I can take a lot of posts to answer that or assume you will try it yourself and get into your own terms with Vim. I'll go with the latter and share with you what my current (as of 15 July 2009) Vim configuration is.
My Vim configuration: Gavim
Note: I'm working on a Fedora Linux system. By default there's a very decent Vim configuration in Fedora. So I took the default global Vim configuration file in a Fedora 10/11 system and did the tweaks to get it to my liking. As you would have expected, a significant part of the vimrc is straight from Fedora.
Some of the plugins I use are taken from vim.org, while some are taken from their sources (mostly from GitHub repositories).
And oh, I only use Vim not gVim (Vim with a GUI).
In the first few lines of my Vim configuration file is an entry which says,
which is to tell that it shouldn't try to be compatible with older Vi, and just use the Vim behaviour. I also liked to have the editor show the line numbers on left. There are other other small tweaks I like to have.
All these things are included in my Vim configuration files repository, and the files are well (hopefully) commented. So anyone interested can refer to my vimrc and find more about those.
One thing to notice is I'm using the key "," as my leader key.
let mapleader = ","
Vim 7 also has built in spell checking abilities. I find this very useful as I use Vim for every typing needs these days. I have configured 2 keyboard shortcuts to enable and disable spell checking.
Eg:map <F8> <Esc>:setlocal spell spelllang=en_us<CR>
map <F9> <Esc>:setlocal nospell<CR>
This means that I can press F8 key to turn spell checking on with language set as English (USA) and turn off by pressing F9.
I also like to have the ability fold/unfold code blocks when coding. For this I used another Vim built in.
which sets the folding based on syntax (i.e. programming language), and doesn't enable it by default.
I also have set a place holder character to be displayed while typing "space" and "tab" characters. These are displayed until you type a new character after the tab/space.
And BTW, the theme (colour scheme) I'm using for Vim is called "darkblack". It's a dark theme which provides very good readability. It is included in my repository.
To get the best view for most of the themes and the smoother fonts you need to tell Vim to use 256 colors in the terminal.
As you already know most Linux systems have excellent font rendering. The default on Ubuntu systems are not good, but other systems like Fedora was having quality font rendering by default for a while. So having a nice colour theme with smooth fonts is a very pleasant experience. See the screenshots for proof. :)
Those are the major Vim features I'm using. You can see everything in the configuration files. Now let's check the major Vim plugins I'm using.
Plugins I use
Different plugins may have different installation steps. Check the "Readme" files of the plugin for more details. Generally it involves copying the .vim file in the plugin package into the plugin directory of the vim configuration directory.
$ cp ./NERD_tree.vim ~/.vim/plugin/
The NERDTree plugin by Martin Grenfell is an excellent file system tree browser plugin for Vim.
You can set the exact key binding to activate NERDTree by specifying
Eg:nnoremap <leader>d :NERDTreeToggle<cr>
Once installed you can toggle the tree browser pane by pressing [leader]d in command mode. Eg: ,d
I have also set this:
Scratch gives a temporary scratch buffer area which will be discarded when you exit vim. This is not saves in a file. It's quite useful to jot down something quick while you are editing.
if expand('%') == g:ScratchBufferName
map <leader>s :call ToggleScratch()<CR>
Snippet completion is a very useful thing to have when you are coding. This is a feature which can be found on almost all Integrated Development Environments (IDE). Snipmate is a cool plugin with brings some of snippets from the popular test editor TextMate to Vim.
Martin Grenfell have a useful collection of snippets to use with Snipmate.vim.
This is a simple Buffer Explorer plugin which with list the open buffers and let you go to any of them.
This plugin takes care of working with different version controlling systems such as Git, Bazaar, Subversion, CVS, etc.
How to use this for you
That's all I have to tell about my Vim configuration for now. Some of the general configuration and some plugins I use are not mentioned in this post. But you are welcome to check it out.
Just in case if you are interested in using these for your Vim setup, be my guest. Be informed though. This works fine with Fedora 10/11 systems. I haven't checked on other systems, which might ot might not have differently compiled Vim setups. In any case you are welcome to grab the files and tweak it to your liking.
Here's the link to my Vim files repository: gavim
You can find more instructions in the "Readme" file there.