Tag Archives: vim

vim: multiple buffers

Tweet In order to work with several view ports of the same file in the same Vim window, type:

You may also open another file in the same window. To do so issue the command::

Posted in Linux | Tagged | Leave a comment

vim: create function to remove white spaces

Tweet In the .vimrc file, add the following lines ( here ^M is a special character for the return carriage created using CTRL+V):

those functions call then be called within vim typing:

some Explanation of the function removeWhiteSpace(). … Continue reading

Posted in Linux | Tagged | Leave a comment

VIM : copy and paste reformats the text with lots of spaces

Tweet When I paste a piece of code or text from a copy (or the clipboard), lots of extra spaces are added at the start of each new line. The solution is to turn off the autoindent:

After you … Continue reading

Posted in Linux | Tagged | Leave a comment

VIM: switch all text to lower case

Tweet You can change the case of a character by typing ~ , however, if you want to change all text to the same case (let us say lower case here), then you should enter the visual mode. Go to … Continue reading

Posted in Linux | Tagged | Leave a comment

vim usage: wrapping, spelling, completion, indentation, …

Tweet code folding To fold a number of lines (5 for example) press zf5j. To fold code within curly brackets use za The folded lines will be replaced in the buffer with a line that looks like:

To open … Continue reading

Posted in Linux | Tagged | Leave a comment

vim: replace tabs by spaces

Tweet In the vim editor, the default behaviour of the tab key is to print a tab … not surprising. When coding, you may prefer tab to be replaced by spaces (because this is your coding style for instance). This … Continue reading

Posted in Linux | Tagged | Leave a comment

vim: replace the windows ^M character under Linux

Tweet Within VIM, there is a way to replace all the return carriage from Windows (that appear as ^M) by replacing them with the Linux version:

When \r stands for the return carriage in Linux (not \n as C … Continue reading

Posted in Computer Science | Tagged | Leave a comment

VIM: pasting text from GUI

Tweet In VIM, when you copy and paste text from a GUI application (e.g., firefox), VIM may insert a lot of extra white spaces by indenting the code automatically. The rendering is sometimes completely wrong, or you just do not … Continue reading

Posted in Linux | Tagged | Leave a comment