vim

Delete all spaces and tabs at the end of my lines

Any idea on how to delete all the spaces and tabs at the end of all my lines in my code using vim? I sometimes use commands to add things at the end of my lines, but sometimes, because of these unexpected blanks (that is, I put these blanks there inadvertently while coding), which serve no purpose whatsoever, these commands don't do the ...

Vim different textwidth for multiline C comments?

In our C++ code base we keep 99 column lines but 79-some-odd column multiline comments. Is there a good strategy to do this automagically? I assume the modes are already known because of smart comment line-joining and leading * insertion. ...

Format CSS with VIM like in Textmate

In TextMate there is this awesome option to "Format CSS" and "Format CSS Compressed". This option doesn't seem to exist in vim. Perhaps it's in a plugin I'm not aware of? Or maybe I need to integrate CSS Tidy somehow? ...

Regular Expression for Highlighting Indented Bullets in Vim

I'm trying to write some matching rules in a Vim syntax file to highlight indented bullets. My problem is that the syntax highlighting uses a background color, so I would like to match only the bullet character and not the preceding whitespace. How can I say "match \d., +, -, and * only if preceded by ^\s\{0,1} (but do not match the wh...

Vim - Nerd commenter . First line commented out differently.

Hi, When using nerd commenter in visual mode, the first line is commented differently. Initial code const IMG_SIZE_SMALL = '32x32'; const IMG_SIZE_MEDIUM = '64x64'; const IMG_SIZE_LARGE = '192x192'; After doing ,cc in visual mode selecting these lines. /* const IMG_SIZE_SMALL = '32x32';*/ //const IMG_SIZE_MEDIUM = '64x6...

Run the CommandTFlush command when a new file is written

Hi, I'm trying to make Vim run the command 'CommandTFlush' whenever a new file is writte. For those not using the Command-T plugin, the 'CommandTFlush' command is used to rebuild an index of files in the current directory. What I want to do is run the command after the file is written to disk, so that CommandTFlush will find the file ...

Is there a good Vi(m) command for transposing arguments in a function call? Bonus points for Emacs

For example if I have some code like: foo = bar("abc", "def", true, callback); Is there a nice command to move true to the 1st or 2nd position leaving the commas intact? P.S as a bonus my friend want to know if this works in Emacs too. ...

GNU Source-highlight use same colours as vim

I'd like to have GNU Source-highlight [ http://www.gnu.org/software/src-highlite/ ] use the same colorings as my vim setup [ http://vimdoc.sourceforge.net/htmldoc/syntax.html ]. I'm using a recent Ubuntu and not done any customization over the default installs of vim of source-highlight other than to enable highlighting in vim. ...

vimrc make comments italic

How do I change the vimrc to have the comments in my code italicized? in my vimrc file i have: highlight Comment ctermfg=blue that makes the comment blue. ...

Not reading ~/.vimrc

I have a ~/.vimrc file that vim doesn't seem to be reading. There is a file at /etc/vimrc, and it looks like it is using that one. My understanding is that the one in the home directory should override this one, shouldn't it? Update cat vim_strace | grep .vimrc stat64("/etc/vimrc", {st_mode=S_IFREG|0644, st_size=1438, ...}) = 0 ...

How can I change the vimrc console font

I connect to my linux box via putty. I've been able to modify the color scheme via my vimrc file, but how can I change the console font? I see an option for guifont but I am not using a GUI... ...

ctags and Fortran's interfaces

I'm wondering how to get ctags working with interfaces in Fortran, eg: INTERFACE SOME_ROUTINE MODULE SOME_ROUTINE_A MODULE SOME_ROUTINE_B END SOME_ROUTINE So that either SOME_ROUTINE_A or SOME_ROUTINE_B is called depending on the parameters passed to the subroutine. If I've got my cursor over a call to SOME_ROUTINE in Vim, and hi...

How do I define a range and sort by number in Vim using regular expressions?

This post is a two-parter. I'm trying to sort a set of ip statements that look like: ifconfig em0 alias 172.16.80.1/28 ifconfig em0 alias 172.16.180.1/32 ... ifconfig em0 alias 172.16.1.1/32 by ip. Is it possible to return a range by using a regular expression? The following returns an error %/172.*/sort n and this doesn't (app...

Recursive Tab Complete Filenames on :edit in VIM

I had found a .vimrc configuration that allowed me to simply type :e <<characters_in_filename>> and then tab and the path would expand out to :e full_path or show me a list of options if there are similarly named files in my current path. Anyone know how to make this happen? note: I'm away of FuzzyFileFinder, Peepopen, and Command...

Syntax Highlighting in VIM after :bd

Hello. When I useVIMthe syntax highlighting works, except after I return to a buffer using:bdthe highlighting disappears. I can enable it again using:syn on.This problem occurs only for files without an extension. I remember I had to change some settings to get files without an extension to be highlighted in the first place, but I can't...

Correct pattern for a VIM autocommand?

I have a windows directory (U:\S) that contains files that must not be changed. Their read-only bit cannot be set, so they must remain writeable. As I have to look into some of the file's content rather regurarly with VIM, I want to make sure that I don't accidentally change the file's conent. So, I put the following line into my .vim...

Vim ex knowing number typed before

I'm making a shortcut that places a # at the front of each line, in the next x lines. x is a number I type before entering the shortcut, like typing 11dd deletes the next eleven lines. The command is .,+10 s/^/#/g. Here the number ten should really be whatever was typed before the shortcut. How do I make the shortcut change according to...

How to get the content of the current buffer in vim command mode?

There is a vim function Send_to_Screen(text) which sends some text to a console screen session. I have a mapping vmap <F4> "ry :call Send_to_Screen(@r)<CR> which calls the function with the current selection. Now I want do define another mapping which calls the function with the contents of the whole buffer, but I don't get it to work...

vim: combine :g with comand which uses range

I have a text which is made of lines and some of them look like that: A test1 test test test test A test2 test test test test The line starts with A (arbitrary but unique string) and ends with an empty line. I like to remove all redundant newline symbols from the real lines (without affecting other lines, not matc...

How to remap <Ctrl-Home> to go to first line in file?

How to remap <Ctrl-Home> to go to first line in file? I tried the following command, but it doesn't work (environment is xterm in KDE). Vim recognises the Home key and goes to beginning of line, but looks like it doesn't recognized <Ctrl-Home> combo. noremap <Ctrl-Home> gg ...