vim

Cancel the select pattern in VIM

Hi all When I try to search some words in a article, it would highlight the pattern. After I have already found what I want, what should I do to cancel the select pattern, which means I don't want the words to be highlighted. Best Regards, ...

vim linebreak after hyphen with gq

Hi, Is there some way to configure vim's gq function so that it allows line breaking after a hyphen (in a compound word)? e.g. twentieth- century And by the way, I'm not on my own laptop, but on one of the lab, which runs Windows, so any solution not using programs like par or fmt get bonus points :-) (though I'm also interested in s...

$PATH variable not properly set in gvim/MacVim when it is opened from the finder

I am using MacVim (basically gvim for the mac). If I open macvim from the command line then my $PATH variable will be properly set. If I open macvim via point and click with the finder, the $PATH variable will NOT be properly set. Can anyone give me some insight? Note: I know at least part of my path is set in ~/.bashrc, but ...

html indenting in vim

I don't know if this is possible, but does anyone know of an indent script that will support this scenario? (| is cursor) given <div>|<div> if I press enter, I want to see <div> | </div> instead of <div> |<div> ...

Set “makeprg” via modeline in Vim

By default, makeprg is set to just make. However, I’ve got a lot of projects where different build configurations and targets reside in the same directory. This of course necessitates that I specify a target when invoking make. For example, I’ve got a project that’s set up to build a source file <foo>.cpp by invoking make foo, and the ...

Little vim regex

I have a bunch of strings that look like this: '../DisplayPhotod6f6.jpg?t=before&amp;tn=1&amp;id=130', and I'd like to take out everything after the question mark, to look like '../DisplayPhotod6f6.jpg'. s/\(.\.\.\/DisplayPhoto.\{4,}\.jpg\)*'/\1'/g This regex is capturing some but not all occurences, can you see why? ...

vim/macvim: locate where a method/symbol is defined

I'm using macvim/vim for most of my Ruby + Ruby on Rails development. Is there currently a way to jump to where a method was defined within a project, even if it's not in the same file as where it's being invoked? Either a language agnostic way or a Ruby/Rails specific way works. ...

Convert file one word per line

I would like to convert a text file containing words, space separate to a file where each word appears on a separate line sdf sdfsd= sdfsdf sdfsdf will become sdf sdfsd= sdfsdf sdfsdf thanks ...

Map a caps lock key that is mapped to ctrl system wide to Escape just in vim

Hi all, i have mapped my caps lock key to ctrl with the following command under linux: setxkbmap -option ctrl:nocaps I really like this mapping and want to keep it, but I also would like to map the caps lock key to Escape when I am inside vim. But when I try to map it with :map <C> <Esc> or similar it does not seem to work, presum...

How to fill a line with character x up to column y using Vim

How can I fill the remainder of a line with the specified character up to a certain column using Vim? For example, imagine that the cursor is on column four and I want to fill the remainder of the current line with dashes up to column 80. How would I do that? ...

closing php tag in string stops syntax highlighting

In my vim files, when I have a closing php tag in a string, my syntax highlighting stops at that point Example: <?php ... Everything good up to this point $xml = '<?xml version="1.0"?>'; $foo = 'bar' <-- starting here I loose highlighting to the end of the file ?> I'm running version 7.2.245. anyone have ideas why this happens...

Can someone point me to a good Vi (or Vim) app for windows?

Hi all, I've been inspired by yehuda katz ( http://yehudakatz.com/2010/07/29/everyone-who-tried-to-convince-me-to-use-vim-was-wrong/ ) to start using Vi (or vim) as opposed to my current tool of choice, Notepad++. I had a look on the vim.org site but couldn't find any recent windows vim app, am i looking in the wrong place or something...

Disable Vim plugin for certain filetypes

Hi all, I'd like to disable a plugin for certain filetypes in Vim. I'm a Vim newbie, so take it slow with me :) I have the autocomplpop plugin, and I really like it. However, if I'm editing a LaTeX file, it shows completions for every single English language word I've already used. It's distracting! I'd like to disable it for .tex file...

Is it possible to modify the cindent rules for one case in vim?

I am currently using vim as my editor for programming in D. The indent rules are pretty much identical to C, but I've run into a case that vim doesn't handle by default. In D, case statements can take strings which are not properly handled by cindent. For instance, this works: switch(blah) { case 1: // something case some_variabl...

Conditional colorscheme in .vimrc

I am using vim and MacVim. I have a 256-colour colorscheme which I like for my MacVim, but if I load it into regular vim, it obviously does not work (I get blinkies instead). I would like to be able to use the same vim config on all my systems, so: Is there a way to check for palette size in .vimrc and set one of the two colorschemes ac...

edit with vim in irb

Hi, I'm trying to set up editing within irb using vim as described in this vimcast: http://vimcasts.org/episodes/running-vim-within-irb/ I did the gem install interactive_editor and it seemed to install the gem to /home/me/.gems/ruby/1.9.1/gem/interactive_editor, and I also edited my .irbrc file and added: require 'rubygems' require '...

compiling vim with python support

I'm trying to compile vim 7.2 with python 2.5.1 support, but I'm having some trouble. 1) I run configure which seems like it is working as expected ./configure --with-features=huge --enable-pythoninterp --prefix=/home/username/vimpy I can see that changes to --with-features works as I expect (the final compiled version has new features...

Run vim script from vim commandline

Over the last couple of months, I've built a series of files full of vim-commands to auto-generate boilerplate code for my projects. It's allowed me to work faster. However, the only way I know how to run these scripts is by assigning them to key-combinations in ~/.vimrc. There's only so many keys I can remap. Is there a way to run t...

Set VIM to open files in "read-only" mode by default?

Hi folks, Straightforward question here and I can't make it any simpler than the title: How do I set VIM to open files in "read-only" mode by default? Thanks! ...

How can I override ~/.vim and ~/.vimrc paths (but no others) in vim?

Let's say I have a tarball of all my vim config - everything normally inside ~/.vim (plugins, autoload, colours, all that stuff), and a vimrc file. I extract this to a directory somewhere. So in the directory where I am ($PWD), there is a "vim" folder and a "vimrc" file. (note: this directory will be read-only, so vim shouldn't try to wr...