vim

Is there a "vim runtime log"?

Sometimes I try a customization/command in my vimrc. Everything seens to be correct, but it just doesn't work. It's difficult to know what's happening when vim starts, and know which command failed or not, so it's really difficult to debug what can be causing a problem in my vimrc. It's a trial-error approach, which is time consuming an...

vim: erase key moves over character instead of deleting it. on retyping, prev characters do not change right away

when i type a line say Happy new and then <backspace><backspace> and then retype the old characters stay around until i type 3 or 4 characters. This is very disorienting. ...

tools for testing vim plugins

I'm looking for some tools for testing vim scripts. Either vim scripts that do unit/functional testing, or classes for some other library (eg Python's unittest module) that make it convenient to run vim with parameters that cause it to do some tests on its environment, and determine from the output whether or not a given test passed....

What does the :compiler command do in Vim?

I recently found that there is a command in Vim called compiler. You can call it with any common compiler (for example, :compiler gcc, :compiler php, etc.), but it doesn't seem to have any immediate effect. I searched on the manpages but didn't find anything useful about what it actually does, nor does the Vim Wiki. Does anyone know wha...

How to export the matches only in a pattern search in vim?

Is there a way to grab and export the match part only in a pattern search without changing the current file? For example, from a file containing: 57","0","37","","http://www.thisamericanlife.org/Radio_Episode.aspx?episode=175" 58","0","37","","http://www.thisamericanlife.org/Radio_Episode.aspx?episode=170" I want to export a new fil...

How does :g/^$/,/./-j (reduce multiple blank lines to a single blank) work in vim?

In the article, Vim Regular Expressions, Oleg Raisky gives the following command to reduce multiple blank lines to a single blank: :g/^$/,/./-j Can someone please describe how this works? I know :g command and regular expressions. But I didn't understand what the part /,/./-j does. ...

Programmatically execute vim commands?

I'm interested in setting up a TDD environment for developing Vim scripts and rc files. As a simple example, say I want to have vim insert 8 spaces when I press the tab key. I would set up a script that did the following: Launch vim using a sandboxed .vimrc file press i press tab press esc press :w test_out assert that test_out contain...

vim command to restructure/force text to 80 columns

I know there are ways to automatically set the width of text in vim using set textwidth (like http://stackoverflow.com/questions/235439/vim-80-column-layout-concerns). What I am looking for is something similar to = (the indent line command) but to wrap to 80. The use case is sometimes you edit text with textwidth and after joining lines...

XSD traversal in VIM

I use VIM as my text editor and I edit a lot of XML and WSDL files. WSDL files have an XSD section. Is there some VIM plugin I can use to traverse the XSD types? i.e., if I have the following line and the caret is where the '|' sign is: <xsd:element minOccurs="0" name="FooName" type="Magic|FooType"/> and I press Ctrl+Alt+Foo (or some...

What is the best way to write faster on Vim using a non-english keyboard?

I usually use Vim, and its great for the ability to do faster some actions than other editors. However, since I live in Argentina I have a Latin American keyboard, that makes everything in Vim pretty slower (to write / to search, I must press Shift+7). Since I don't want to be changing Keyboard layouts all the time (and its pretty diffi...

How to do inline paste from system buffer in Vim?

When pasting from the system buffer in a line like foo( someVal , <cursor is here>, someVal3); If I use "*p I get foo( someVal, , someVal3); <pasted text> If I use "*P I get <pasted text> foo( someVal, , someVal3); but I want foo( someVal, <pasted text>, someVal3 ); How can I get the result I want? edit If there is a newl...

Regex - Format with tabs and alphabetical

Is it possible to use regex to turn this <site-ui:header title="error" backURL="javascript:history.go(-1);" /> into this <site-ui:header backURL="javascript:history.go(-1);" title="error" /> Basically, my goal is to format this xml so that the fields are in alphabetical order (e.g. backURL comes before title), and each field...

How to Alphabetize a CSS file in Vim

I get a CSS file: div#header h1 { z-index: 101; color: #000; position: relative; line-height: 24px; margin-right: 48px; border-bottom: 1px solid #dedede; font-size: 18px; } div#header h2 { z-index: 101; color: #000; position: relative; line-height: 24px; margin-right: 48px; border-bot...

Install a vimball from the command line.

As this post points out you can install Vimballs using the normal: vim somevimball.vba :so % :q But if you want to install a from the command line how do you do it? I ran a 'man vim' and it seems like the best "from source install" option was the '-S' option so I tried to install haskellmode with it: wget 'http://projects.haskell.org...

How to delete empty lines in multi-ranges in Vim

I get a text file: <p>...</p> <pre> ... ... ... ... </pre> <p>...</p> <p>...</p> <p>...</p> <pre> ... ... ... </pre> <p>...</p> Notice that: there are some empty lines between [pre]...[/pre]. I want to delete them. But, I want keep those in [ p]...[/p] The text file becomes: <p>...</p> <pre> ... ... ... ... </pre> <p>...</p> <p>.....

Problems making an accurate Visual Studio scheme for Vim (vim scheme specialist needed) .

I'm trying to make an accurate Visual Studio scheme. I set hi function to blood color (#9A1102) for the "CSS function" (e.g. #thisisanid). But now the brackets with properties (id, class) in html elements also have blood color: (ironically the same color here in Stackoverflow). But I want them blue (#2902FC) e.g.: Sample of ...

How do I save a macro consisting of multiple search and replace into my .vimrc

I have a macro that I use to replace special characters for its html entities. I would like to save it in my .vimrc. According to this, I should use let @r=' *macro_text_goes_here* '. The problem is that my macro is a series of search and replace, something like this: :%s:á:\&aacute;:Ige :%s:é:\&eacute;:Ige :%s:í:\&iacute;:Ige So, I'...

Does anyone know of a vim plugin or script to convert special characters to their corresponding HTML entities?

I develop websites for corporate clients, so we see the , , etc. chars a whole lot. Sometimes I paste in huge blocks of copy, which might even contain pretty quotes ( ) or other strange characters from word processors. So, my question is this: Does anyone know of a vim plugin or script that can, in one fell swoop, convert all these char...

vim - how am I suppose to read this command to remove all blanks at the end of a line

I happened across this page full of super useful and rather cryptic vim tips at http://rayninfo.co.uk/vimtips.html. I've tried a few of these and I understand what is happening enough to be able to parse it correctly in my head so that I can possibly recreate it later. One I'm having a hard time getting my head wrapped around though ar...

How to change all selected chars to _ in Vim

I try to draw a class diagram using Vim. I fill the editor window with white-spaces. Type :match SpellBad /\s/ to highlight all the white-spaces. Ctrl+Q to select vertical white-spaces. Shift+I to insert Bar(|) and then Esc ........................... v+l +... + l to select horizontal white-spaces But I don't know how to change all s...