Aug 052010
 

Hey there,

here is a list of the most important commands for the goodlike texteditor „vim“ 😉

automatically wrap lines:

:set wrap ( „:set nowrap“ to turn wraping off)

Set the width of a line. In this example a line should have 80 character:

:set textwidth=80

If you want to paste something from the GUI, vim often inserts a lot of spaces and tabs. You can prevent this with entering this command before pasting the GUI-stuff:

:set paste

and after inersting the stuff you should disable pasting with:

:set nopaste

You can set the filetype of a file ( for syntax highlighting for example ) with:

:set filetype=java

You can toggle syntax highlighting with:

:set syntax=on and :set syntax=off

This list will be continued…

Have fun with vim!

use vim syntax highlighting for wsgi

 Linux, Python, vim  Kommentare deaktiviert für use vim syntax highlighting for wsgi
Jun 132010
 

Hi there,

if you want to have the python syntax highlighting for wsgi-files, you just have to edit this vim file:

sudo vim /usr/share/vim/vim72/filetype.vim

After opening this file search for the keyword python. You can search with vim via the „/“-command. Type „:/ python“ and search the line:

“ Python
au BufNewFile,BufRead *.py,*.pyw        setf python

You just have to add ,*.wsgi after pyw. It should look like this:

“ Python
au BufNewFile,BufRead *.py,*.pyw,*.wsgi        setf python

Now you can open a wsgi-File and the syntax-highlighting should be enabled.

Have fun!

Remove CR-LF in windows files with vi(m)

 Linux, vim  Kommentare deaktiviert für Remove CR-LF in windows files with vi(m)
Jun 062010
 

If you want to delete the Carriage Return and Line Feed (CR+LF) in windows-created files, you can use the vi(m).

( Because Windows uses CR+LF as Line-End, unix/linux just uses the LF-Character )

Open the file via vim:

vim <WindowsFile>

After opening the file you have to enter the following sequence:

:%s/^M$//g

For creating the „^M“ you have to press CTRL+V and CTRL + M, otherwise it would not work!