vim

Making inserting a single character in Vim an atomic operation

I've long used this very useful shortcut in vim: nmap <space> i <esc>r this means that if I press spacef, for example, it will insert a single character f at the given position. unfortunately, however, this is not atomic, ie, if I press spacef and then navigate somewhere else, then press ., I get the equivalent of rf, not spacef. al...

How do I get emacs to start in Vi mode?

I've tried putting (setq term-setup-hook 'vip-mode) in my .emacs file but this only seems to load the vip module and I have to manually call vip-change-mode-to-vi and C-z doesn't work as an alias for that method. What am I doing wrong here? p.s. Please spare me any religious sentiments. ...

Tab Vs Space preferences in Vim

Vim is very accommodating when it comes to tab Vs. space preferences. As I understand it, the tabstop setting indicates the width of a tab character. The shiftwidth setting specifies how many columns to increment/decrement when using the << and >> commands, whereas the softtabstop setting influences the amount of whitespace to be inserte...

Copy and paste from external source

I use vim (Actually gvim on windows) as my main text editor. In my work flow I have to copy sentences to/from various external sources, therefore I use clipboard=unnamed to save me key strokes (p instead of "*p). I copy text from an outer source and I want to paste it over two different places in vim. I mark the first one (v) and then us...

Is it possible to have a Vim syntax file command span multiple lines?

I'm trying to create a syntax file and I want to create some keyword groups for different colour highlighting (e.g. reserved words, operators etc. would be different colours). I can get this to work by doing one of the following two options: Option 1 syn keyword MyLangOperators operator1 operator2 operator3 syn keyword MyLangOperators ...

Setting Vim whitespace preferences by filetype

At my work, I am required to follow the house style for indentation, which goes as follows: 2 spaces when coding html and ruby tabs when coding javascript, with tabwidth=4 recommended What is the best way to specify different whitespace preferences per filetype? ...

Vim indenting file for Treetop (Ruby parser)

Has anyone seen a vim indent file for treetop, the Ruby parser/generator? I've found a vim syntax highlighting file, but haven't seen one for indentation. ...

Mapping of <ctrl-#> characters

I've been trying to map certain sequences to parenthesis/bracket completion without any success. I've been trying the following commands to map certain control sequences but they don't seem to work. Does anyone know what I'm doing wrong here? :imap <ctrl-9> ( )hha :imap <ctrl-(> ( )hha ...

Color scheme in vim

I was trying to set 256 color for vim editor. I write C code using vim. In /usr/share/vim/vim72/colors directory I have many colourscheme script. When I tried to use any one of them using colourscheme command in .vimrc, it is working for all files with any extension. But when I am giving .pc extension to the file I am not getting the co...

I have a vim config. However, when I paste text...

I do "set:paste" That will allow me to paste text into putty very nicely. However, my "smart indents" and 'auto tabbing' --which is in my original config..is gone!? How do I make it so that I don't have to do "set: paste" everytime I want to paste something and if I do have to do that...I can easily go back to normal config? s...

delete first word of each line

how to delete first word of each line in vim? how about pattern on each line ...

Using vi, how can I remove all lines that contain [searchterm]?

I want to remove all lines in a CSS file that contain the word "color". This would include: body {background-color:#000;} div {color:#fff;} How would you do that using the :%s/ command? ...

Vim, Python and curses

Hello, I wrote a small python script for vim that uses the curses library. When I try to call the function curses complains about: Traceback (most recent call last): File "<string>", line 9, in <module> File "/usr/lib/python2.6/curses/__init__.py", line 33, in initscr fd=_sys.__stdout__.fileno()) _curses.error: setupterm: could not find...

How to do brace expansion tab-completion, for filenames in vim?

In vim (and bash), you can specify alternatives in filenames, eg: :arga project/html/{index,sitemap}.html This expands to "project/html/index.html" and "project/html/sitemap.html" (the :arga appends them both to the argument list; you can get to them with :n). Now, vim already does some filename completion on this, with TAB, by cycli...

How do I get perl-support.vim to recognize Perl files?

I installed perl-support.vim into ~/.vim (unzipped). When I create a new .pl file it shows me the default template, which means my installation is successful (I guess). I have already added filetype plugin on in ~/.vimrc & /etc/vimrc. How do I enter a perl-support command? The write up recommends typing \isu in normal mode for creating ...

What are your suggestions for an ideal Vim configuration for Perl development?

There are a lot of threads pertaining to how to configure Vim/GVim for Perl development on PerlMonks.org. My purpose in posting this question is to try to create, as much as possible, an ideal configuration for Perl development using Vim/GVim. Please post your suggestions for .vimrc settings as well as useful plugins. I will try to merg...

Is this the right version of Vim for OS X Snow Leopard?

I'd like to try Vim. I'm using Mac OS 10.6.2 (Snow Leopard). I downloaded vim7.0.224.tar.bz2 from here. However, I have doubts. It's the newest version offered, but the heading says "OS X 10.4 (Tiger)". Is there another, preferable version I should know about? ...

Why does Vim add spaces when joining lines?

I want to unwrap text in Vim. When I join lines I get an additional space between sentences. Why is that? ...

Incorrectly displayed characters in vim quick fix window

While compiling code using vim (not gvim) the output looks fine in the terminal window but when vim returns and displays the text in the quick fix window it has some incorrectly displayed characters. All other times in my terminal and in vim everything is displayed correctly. Any ideas? VIM - Vi IMproved 7.2 ...

How to implement own tag jump in VIM with CTRL-] ?

Hello. If :h is used in VIM, it will automaticall follow |links| via CTRL-], opening new help topics and maintaining tag jumps list (CTRL-T will go back in jumps history). How to implement such behavior in my own file format? For example, i want CTRL-] on text inside {} to open a file named something.txt and CTRL-T to go back. How to im...