vim

Searching word in vim?

I can search word in vim with /word. How can I exclude searches for word1, word2 and only search for word. ...

Correct indentation of HTML and PHP using Vim

I've been using Vim for a while, and I can't get proper HTML indentation working in PHP files. For example, what I want is for each child to be indented one tab more than it's parent, as shown below. <?php if(isset($sports)) { //Do something ?> <div> <label>Uniform Size</label> <ul> <li class="left"><label for="s" class="small">S<...

What's the most elegant way of commenting / uncommenting blocks of ruby code in Vim?

In VIM, at the moment when I need to comment out a section of Ruby code: I navigate to the first column in the row I want to comment out I press CTRL-v to enter visual block mode I navigate down till the place I want to end the operation I type r<space> if I want to uncomment the code or r# if I want to comment it out. This workfl...

Auto formatting for vi?

Does an auto-formatting tool exist for vi that'll allow me to define per language preferences? edit: I'm not looking for syntax highlighting. I'm looking for something that will apply formatting rules to my code. (Like brace positioning, spaces around oeprators, etc) ...

How do you get vim to display wrapped lines without inserting newlines?

I'm getting back in touch with my inner (g)vim due to an unscheduled MacBook mother(board) of a meltdown (my emergency backup Linux box won't run TextMate). All told I'm happy with vim's efficiency and power, but I'm mortified at how hard it is to get the kind of word wrap that even stupid HTML textareas achieve with no apparent effort. ...

Distinct quickfix buffers for vimgrep and make

When 'make'-ing under vim, there is often a need to vimgrep the files. In such cases, vimgrep takes over the quickfix buffer, so one needs to re-make in order to browse remaining compiler errors. Is there a way to avoid this mess? ...

vim: would like it to turn settings on only for certain file types

I've looked at this but it wasn't too much help. Maybe I didn't read it too well. Basically what I want is when I open a .txt file the settings: set wrap set linebreak are turned on. How might I go about doing that? Thanks in advance. Also, I'm using XP. ...

Smart indenting in vim (normally great) is a disaster when pasting in a chunk of code.

I guess other editors are smart enough to turn that stuff off for pasting but when using vim in a terminal it can't distinguish between pasting and actual typing. What kinds of solutions or workarounds do you have for this? Added: there's also a setting that makes comments automatically continue on the next line. The indenting at leas...

VIM + JSLint?

I spend my days in vim, currently writing a lot of JavaScript. I've been trying to find a way to integrate JSLint or something similar into vim to improve my coding. Has anyone managed to do something like this? Edit: tried this: Javascript Syntax Checking From Vim, unfortunately the output is very crude. ...

Empty out all methods in a file in vim, regex?

I am using the vim editor and I wanted to empty out all methods in the class, for instance class A { public: int getNumber() const { return number; } void setNumber(int num) { number = num; } }; I wanted to have a regex where I could substitute so that the result woul...

How can I use the + (or =) key in a mapping in vim?

I wanted to remap (for normal mode) <C-a> to <C-=> and <C-x> to <C--> but it didn't work. Is there another way to write this? ...

Is it possible to use VI or VIM keymap in NetBeans?

Vim is my favorite tool for programming in OSX, but my team mate all use NetBeans. Some of them use Eclipse Keymap. Any suggestion plug-in to enable VI command in NetBeans 6.5? Related: Does any IDE have a vi keybindings option? ...

VimL Script language: what is an acceptable alternative?

Problem: One of my favorite aspects of Vim is its flexibility. One of my least favorite is the VimL script language itself. I know everyone has his or her own preference for languages and editors, so I take it for granted that not everyone agrees with me. Question: If you are a Vim user, and if you have had a similar disaffection for us...

Close a split window in Vim without resizing other windows

If I have a Vim window open with 2 splits in it (3 total buffers visible) and I've adjusted the viewport of each split, then I close one buffer, the other two buffer's viewport's are automatically resized. Is there a way to maintain or at least better scale the split when I close a buffer? 1) Vim window with three splits, custom size: ...

vi / vim - how to set the tab label/title length to a fixed size in chars

As I open new tabs in vi/vim(7.2), if the opened files are in different paths the tab title displays the complete path and hogs the screen real estate so the other tabs are not visible. This means I can't use my mouse to click to the tab I want but have to resort to : & keyboard commands to move between tabs. Is there any way I can res...

Any good tutorial for moving from eclipse to vim?

At present I am using eclipse for JAVA project. I always wanted to use VIM for my project. Is there any good resource or tutorial that can help me? ...

Repeating surround with "." command in VIM

Did anybody get surround.vim to work with repeat.vim? This should enable you to repeat any command provided by the surround plugin with the "." command. I think surround.vim should already have builtin support for the repeat plugin, so it should work out of the box but I can't get it to work. ...

jump to matching XML tags in VIM

Vim's % operator jumps to matching parentheses, comment ends and a few other things. It doesn't, however, match XML tags (or any other tag, to the best of my knowledge). What's the best way to jump to the matching XML tag using vim? Note: What I really want to do is duplicate a section in an XML file without manually looking for the ...

Why is pasting a long one-liner very slow in Vim's insert mode?

My Macbook was stuck yesterday, when I tried to paste 1200 lines of 80 characters to Vim. It was much faster to download the file, and not to paste the text. I have thought that this problem might be the reason, why internet operators allow slower uploading than downloading. --edit The text is: http://dpaste.com/115362/ ...

How can you use Python in Vim?

I waste a lot of time between Vim and Python. I find it too slow to manually copy-paste from Python to Vim and vice versa. A good broken example is: %!python for i in xrange(25); print 6*i \n How can you do such tweaks direcly in Vim? [Solved] [Clarification] I need things to Vim, like printing sequences, arithmetics... - ...