vim

vim question: tabbing a block of code

How do you tab a block of code, to the right to the left, up and down? ...

How to get vimdiff to display output from cvs diff --side-by-side

CVS diff has the option to display revisions side by side and denote diffs with usual patch symbols like: import zlib import zlib > import time import traceback import traceback import cElementTree as ElementTree ...

Auto format a file to print in vim

Sometimes I work with a file that contains source code, columns, plain text, sometimes all 3. It looks great on the screen. However, when I send it to a printer, it comes out a mess: columns/tables are misalignment, code looks like a spaghetti, etc. I use vim editor (7.2). How do I reformat the file to please the printer? Perhaps I sh...

vimrc - current working directory

I would like to be able to access the current working directory in my vimrc. For example, I can access the current file by using %. Specifically, I have the following line in my vimrc: map ,l :!latex % When it runs everything works fine, except the resulting dvi and other files are stored in my home directory instead of my current work...

the weirdest VI problem EVER

Ok, so I am trying to type the following in .cshrc file: alias ls 'ls --color=auto'. I type one character at a tiem. However, when I reach --color= i type a and cursor goes to the next line. I checked the .vimrc file and didn't fine anything out of whack. I am using vim7.2 EDIT I noticed it is only happens in the .cshrc file, and c...

Is there a way to pass arbitrary text to Vim?

I want a way to pass some literal text to Vim. I've seen that it can read from stdin with the "-" argument, so you can pipe things to it, e.g. the output of other commands. But is there a way to pass any text into it like vim - "Here's some random text" and open Vim with that string in the buffer? It complains if I try this comma...

Multiple autocommands in vim

I've got some sections in my .vimrc that look like this: autocmd Filetype ruby setlocal ts=2 autocmd Filetype ruby setlocal sts=2 autocmd Filetype ruby setlocal sw=2 now it seems I can convert them to this: autocmd Filetype ruby setlocal ts=2 sts=2 sw=2 but here's my question: is there a vim way to have a structure like this? <som...

How do I successfully use VIM as an external editor for Code::Blocks?

Hi, I really like Code::Blocks for its build system and step through debugging abilities - ie I really enjoy using wrappers to gcc/gdb more than using them from Makefiles or the command line. The problem is, I'm so brain damaged (or spoilt, some might say) by years of VIM use that I cannot edit in a standard Windows text editor. So, I ...

Vi /Vim restore opened files

Hi, I was wondering if this common IDE feature is available. Suppose i open many files using VIM, using vsplit and split. Then , I close everthing. The next day, i want to recover those files. That is, recover the way they were opened, not having to open each one (using split and vsplit) again. Is that possible? UPDATE: Using :mkse...

what is the difference between C, cc, and S commands in vim

They seems to erase the line and enter the insertion mode. ...

Using vi, how can I make CSS rules into one liners?

Example bad: #main { padding:0; margin: 10px auto; } Example good: #main {padding:0;margin:10px auto;} I have a ton of CSS rules that are taking up too many lines. And I cannot figure out the :%s/ commands to use. ...

Reading efficiently PATHs in Vim

How can you open the following PATH by ctrl-w-f to a new window? Path /usr/masi/codes/11 The PATH refers to a file 11.tex. I need to use 11 instead of 11.tex because my LaTeX or pdflatex does not understand PATHs with tex when I input/include the file. Possible solutions are to add something to .vimrc to use perhaps differently p...

Differences between Emacs and Vim

Without getting into a religious argument about why one is better than the other, what are the practical differences between Emacs and Vim? I'm looking to learn one or the other, but I don't see a difference between them so I can't decide. I have never used an editor of this type (I've always been a bigger fan of IDEs), so anything that ...

Preventing vim to auto-expand folds

I'm using foldmethod=marker and #{{{ #}}} markers in Python code. After typing #{{{ vim automatically expands all folds below the cursor. Is it possible to turn this off? ...

How can I code in C++ with the same indentation style both in Vi and Emacs ?

How can two developers work on a same C++ code base such that they can work transparently ? Is there any common indentation style for C++ code such that once it is established, the two developers can produce code with the same indentation level. I have found Emacs very aggressive for Indentation, it tries to force its way, while Vi is...

Changing the Leader in MacVim?

I'm trying to change <Leader> in MacVim to be something less carpal-tunnel inducing. I have added this line let mapleader="," to my .gvimrc, but "\" is still the only key that works. Am I missing something? ...

basic vim questions on nerdtree toggling and keyboard mapping

i have this line in my vimrc: nmap p :NERDTreeToggle so what is the hotkey for toggling NERDTree? how do i remap it to CTRL-D? what is the difference between nmap, map, nnoremap, inoremap, etc? thanks. ...

Debugging matchit plugin in vim (under Cygwin)

The "matchit" plugin for vim is supposed to allow you to use the % key to jump between matching start/end tags when editing HTML, as well as /* and */ comment delimiters when editing other kinds of code. I've followed the exact instructions in ":help matchit", but % still doesn't work for me. It seems silly to ask "Why doesn't this wor...

What is a regular expression I can use in Vim to find CVS conflicts?

What is a regular expression I can use in Vim to find conflicts in CVS and possibly other version control systems? ...

Maximize Emacs windows without making others disappear

Is there an Emacs equivalent of Vim's C-w _? This command "maximizes" the current window by making it as tall as possible (thus shrinking all of the other windows to be as small as possible). Importantly, in Vim the other windows don't disappear when you enlarge the current window too far. Instead the current window stops enlarging so...