vim

How do you paste multiple tabbed lines into Vi?

I want to paste something I have cut from my desktop into a file open in Vi. But if I paste the tabs embed on top of each other across the page. I think it is some sort of visual mode change but can't find the command. ...

Javascript syntax highlighting in vim

Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes I need to scroll around in order to get the syntax highlighting adjusted, as sometimes it mysteriously drops all highlighting. Are there any work-arounds or ways to fix this? I'm using vim 7.1. ...

Deleting lines of code in a text editor

Edit: This question had been tagged "Tolstoy" in appreciation of the quality and length of my writing:) Just reading the first and the last paragraph should be enough:) If you tend to select and move code with the mouse, the stuff in middle could be interesting to you. This question is about how you use text editors in general. I’m loo...

Smarter Vim recovery?

When a previous Vim session crashed, you are greeted with the "Swap file ... already exists!" for each and every file that was open in the previous session. Can you make this Vim recovery prompt smarter? (Without switching off recovery!) Specifically, I'm thinking of: If the swapped version does not contain unsaved changes and the edi...

Screen + vim causes shift-enter to insert 'M' and a newline

When running a vim instance in gnu screen hitting shift enter in insert mode adds an 'M' and then a newline, rather than just a newline. Does anybody know what the problem might be, or where to look? Thanks in advance Relevant system info: Ubuntu 8.04.1 Screen version 4.00.03 (FAU) 23-Oct-06 VIM - Vi IMproved 7.1 (2007 M...

How to setup VIM properly for editing Python files - *.py

I've troubles setting VIM (7.1.xxx) for editing python files. Identing seems broken (optimal 4 spaces). I've followed some tutorials I found via google. Still no effect :/ Please help. ...

Are there CScope-style source browsers for other languages besides C/C++ on Windows?

I'm specifically interested in tools that can be plugged into Vim to allow CScope-style source browsing (1-2 keystroke commands to locate function definitions, callers, global symbols and so on) for languages besides C/C++ such as Java and C# (since Vim and Cscope already integrate very well for browsing C/C++). I'm not interested in IDE...

How to increment in vim under windows (where CTRL-A does not work...)

While CTRL-X works fine in vim under windows, CTRL-A selects all (duh). Is there a way to increment a number with a keystroke under windows? ...

Multiple tabs in windows vista and gvim

Hi all, I am trying to get the "Edit with Vim" my Right click context menu to work, so that each new file I open opens in a new tab in a single instance of vim. Currently, using Regedit I have set \HKEY-LOCAL-MACHINE\SOFTWARE\Vim\Gvim\path = "C:\Programs\Vim \vim72\gvim.exe" -p --remote-tab-silent "%*" The registry key is of t...

Vim / vi Survival Guide

What are the essential vim commands? What does a new-user need to know to keep themselves from getting into trouble? One command per comment, please. ...

Tabs and spaces in vim

How do I prevent vim from replacing spaces with tabs when autoindent is on? An example: if I have two tabs and 7 spaces in the beginning of the line, and tabstop=3, and I press Enter, the next line has four tabs and 1 space in the beginning, but I don't want that... ...

Counting occurrences in vim

In order to know how many times a pattern exists in current buffer, I do: :%s/pattern-here/pattern-here/g It gives the number of occurrences of the pattern, but is obviously cumbersome and also has the side-effect of setting the 'changed' status. Is there a more elegant way to count? ...

How to replace a character for a newline in vim?

I'm trying :%s/,/\n/g but it inserts what looks like a ^@ instead of an actual newline, the file is not on DOS mode or anything. What should I do? EDIT: If you are curious, like me, check this other question as well. ...

Why is \r a newline for vim?

From this question. You have to use \r when replacing text for a newline, like this :%s/%/\r/g But when replacing end of lines and newlines for a character, you can do it like: :%s/\n/%/g What section of the manual documents these behaviors, and what's the reasoning behind them? ...

Duplicate a whole line in Vim

How do I duplicate a whole line in Vim in a similiar way to CTRL+D in IntelliJ IDEA/Resharper or Ctrl Alt Arrow in Eclipse? ...

What is the best way to force yourself to master vi?

A good while ago, I read an article by the creator of viemu, clearing up a lot of the misconceptions about vi, as well as explaining why it's a good idea (and why it's been very popular for the last 30 years+). The same guy also has a great set of graphical cheat sheets that teach the basics a few bits at a time. I'm convinced. I've b...

where can I find vim-enhanced resources?

I recently installed vim-enhanced , but I can't find any article/tutorial related to it.All I could find is a page that briefly describes it's new features , along with several RPM's to download . What exactly does it have to offer to scripting languages that regular vi/vim can't ? Thanks ...

Is there a Firefox add-on to use vim to edit textboxes?

or "How do I answer questions on SO in Firefox using gVim inside the textboxes?" ...

What Is The Vim Feature That You Like The Most?

I am interested in what people use as their text editor, and would specifically like to know what is the feature of vim that you like the most? In answering, please state what you mostly use vim to do, sysadmin tasks, programming, and in what language you mostly program in. ...

What is the difference between <C-C> and <C-[> in vim?

One of the best tips for using vim that I have learned so far has been that one can press <C-C> (i.e. CTRL+C) or <C-[> (ie. CTRL+[) instead of the ESC(ape) key. However I use a dvorak keyboard so <C-[> is a little out of reach for me as well so I mostly use <C-C>. Now I've read somewhere that these two key combinations don't actually hav...