Changing the default text editor to vi on Ubuntu is fairly easy however it may be tricky depending on how it has been set since there are numerous ways. In BackTrack Linux for instance the default editor is set using select-editor so if you follow another Ubuntu Linux howto it may tell you to modify the default editor using update-alternatives. Below I describe setting the default text editor using both of the mentioned methods and note a couple other locations where it can be set.
Recently I was contracted to do some work for a new client that had around 25 CentOS Linux and Ubuntu Linux servers. The client needed various system administration tasks completed such as updating the servers, modifying a couple scripts that performed automated tasks, and a couple other basic tasks. I typically use vi to modify scripts or text files on Linux servers so when I started to perform my tasks I started getting annoyed as the vi default configuration included the line numbers which makes it a pain to copy/paste from the files you are editing. You can obviously turn off the line number display by typing “:” followed by “set nonu” (both without the quotes) however that does get old. Use the information below to change the default vi configuration so line numbers no longer display by default.
I recently started using the Vim editor again. It used to be my favorite because of all the great plugins. I have been getting lazy the past year and have been using nano but recently I had to work on a few systems which only had vim and I was not able to install another editor. I am am going to write a few article’s on my favorite plugins.
Tab complete is probably the best thing about linux and the shell so it only makes sense to be able to use it with vim. Adding this plugin makes it possible to tab complete while using the / to search in vim. Below I will show how to add plugins to vim.
As anyone knows from my previous posts I have been giving Ubuntu 10.04 a test drive and so far I am pretty happy with it. I have been spending most of my time configuring the various small things I prefer in Linux. One of those things is I like to have vi as my default editor. Below I will outline a simple way to change your default editor in the shell.
My Linux distribution of choice is CentOS so that is where I typically spend time. Recently though I have been working for a project that runs on a Gentoo Linux server. So far I really like Gentoo though there are some things that I am used to that are totally different. One minor issues I have had is how vi/vim (vi IMproved) handles text that is pasted into it. Every time I was pasting data into a file I was editing with vi. Initially I thought it must have been some odd formatting coming from the file I was copying the text from however I ruled this out quickly when I pasted into notepad first to remove all formatting and then into vi and sure enough the spaces on the left still existed. Below I explain the issue, provide an image of a shell window showing the issue, and how to resolve the problem.