vim

How do I convert dos files to linux files in vim?

If I open files I created in windows, the lines all end with ^M. How do I delete them all in once? ...

What is the most convincing command in Vim.

I want to ditch my current editor. I feel I need something else. That do not expose my hands to the risk of RSI. I need to see why I should change editor. And it would be nice to believe, that I will be coding when I'm 80 years old. All the big guys out there are using Vim. The only Emacs guy I know are RMS. Paul Graham is a Vi dude. ...

lining up function parameter lists with vim

When defining or calling functions with enough arguments to span multiple lines, I want vim to line them up. For example, def myfunction(arg1, arg2, arg, ... argsN-1, argN) The idea is for argsN-1 to have its 'a' lined up with args1. Does anyone have a way to have this happen automatically in vim? I've seen the align p...

Is there a tool to convert a .vim colour definition file to use in VS.NET 2008

If you go to a site such as: http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-c.html It has a bunch of example colour themes for VI. Does anyone know of a tool that would take those files and convert them into .vssettings files to use in Visual Studio? If not, how about some good docs on ether of the formats. ...

Vim with Powershell

I'm using gvim on Windows. In my _vimrc I've added: set shell=powershell.exe set shellcmdflag=-c set shellpipe=> set shellredir=> function! Test() echo system("dir -name") endfunction command! -nargs=0 Test :call Test() If I execute this function (:Test) I see nonsense characters (non number/letter ASCII characters). If I use cm...

Using Vim for Lisp development

I've been using Lisp on and off for a while but I'm starting to get more serious about doing some "real" work in Lisp. I'm a huge Vim fan and was wondering how I can be most productive using Vim as my editor for Lisp development. Plugins, work flow suggestions, etc. are all welcome. Please don't say "use emacs" as I've already ramped up...

What are your favorite Vim tricks?

Post your favorite Vim tricks (or plug-ins or scripts). One trick per answer. Try to come up with something other than the basics, btw. :D ...

Vim shortcut for adding arguments to a function

Is there a Vim shortcut for jumping to the argument list of the current function? I often find myself needing to mess with the argument list of a function, and it's kind of annoying to have to do ?def or ?function or 10k or what-have-you until I finally get to it, then /( or t( or 5e to get to the right position in the argument list, an...

Vim: How do I exclude an entire word from my search?

Pretty basic question, I'm trying to write a regex in Vim to match any phrase starting with "abc " directly followed by anything other than "defg". I've used "[^defg]" to match any single character other than d, e, f or g. My first instinct was to try /abc [^\(defg\)] or /abc [^\<defg\>] but neither one of those works. ...

Auto-indent spaces with C in vim?

I've been somewhat spoiled using Eclipse and java. I started using vim to do C coding in a linux environment, is there a way to have vim automatically do the proper spacing for blocks? So after typing a { the next line will have 2 spaces indented in, and a return on that line will keep it at the same indentation, and a } will shift b...

Vim macros don't work when using viper + vimpulse in emacs.

Any other tweaks for making emacs as vim-like as possible would be appreciated as well. Addendum: The main reason I don't just use vim is that I love how emacs lets you open a file in two different frames [ADDED: sorry, this was confusing: I mean separate windows, which emacs calls "frames"]. It's like making a vertical split but I don...

How do you make vim unhighlight what you searched for?

I search for "nurple" in a file. I found it, great. But now, every occurrence of "nurple" is rendered in sick black on yellow. Forever. Forever, that is, until I search for something I know won't be found, such as "asdhfalsdflajdflakjdf" simply so it clears the previous search highlighting. Can't I just hit a magic key to kill the h...

In Vim, is there a way to paste text in the search line?

Say in vim I want to search for $maximumTotalAllowedAfterFinish and replace it with $minimumTotalAllowedAfterFinish. Instead of typing the long text text: :%s/$maximumTotalAllowedAfterFinish/$minimumTotalAllowedAfterFinish/g Is there a way to COPY these long variable names down into the search line, since, on the command line I can't typ...

Vim errorformat for Visual Studio

I want to use Vim's quickfix features with the output from Visual Studio's devenv build process or msbuild. I've created a batch file called build.bat which executes the devenv build like this: devenv MySln.sln /Build Debug In vim I've pointed the :make command to that batch file: :set makeprg=build.bat When I now run :make, the b...

Using vim's tabs like buffers

I have looked at the ability to use tabs in vim (with :tabe, :tabnew, etc.) as a replacement for my current practice of having many files open in the same window in hidden buffers. I would like every distinct file that I have open to always be in its own tab. However, there are some things that get in the way of this. How do I fix these...

How to move to end of line in vim

I am somewhat clumsy in my vi knowledge. I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on? ...

Anyone know of any (free / open source) VI integration for Visual Studio?

vi is for cool kids. ...

Fast word count function in Vim

I am trying to display a live word count in the vim statusline. I do this by setting my status line in my .vimrc and inserting a function into it. The idea of this function is to return the number of words in the current buffer. This number is then displayed on the status line. This should work nicely as the statusline is updated at just...

Can I (re-) map commands in vim?

I love vim and the speed it gives me. But sometimes, my fingers are too speedy and I find myself typing ":WQ" instead of ":wq" (on a German keyboard, you have to press shift to get the colon). Vim will then complain that 'W' is not an editor command. Is there some way to make W and Q editor commands? ...

Automatically folding #defines in vim

I work with quite a bit of multi-platform C/C++ code, separated by common #defines (#if WIN, #if UNIX, etc). It would be nice if I could have vim automatically fold the sections I'm currently not interested in when I open a file. I've searched through the vim script archives, but I haven't found anything useful. Any suggestions? Plac...