vim (Vi IMproved) is a text editor supporting different editing modes.

learn more… | top users | synonyms

7
votes
2answers
927 views

What encryption does vim -x use?

I read man vim, :h -x and :h encryption none of this actually says what algorithm it's encrypted with.
7
votes
3answers
412 views

Vim to print file on terminal and exit

I would like vim to do this in order to have syntax highlight as set up in vim (or without need for extra tools). So instead to use cat file | <some_sh_tool> I would use vim +"some_opts" +"..." ...
7
votes
1answer
2k views

How can I disable bells/visualbells in vim?

How can I disable bells/visualbells in vim? I've tried: set noeb set novb .. but nothing has changed afaik. Just to be clear, I'm referring to the visual bell I get in vim when I do something ...
7
votes
3answers
4k views

disabling mouse support in `vim` in a `gnome-terminal` environment

Edit: The problem of an enabled mouse in vim appears to be specific to gnome-terminal (version 3.4.1.1-1; I am using gnome 3 fallback mode). If I run xterm, mouse support in vim is disabled by ...
7
votes
1answer
147 views

Navigate through a stack of locations in vim?

Typing `` at location X brings you back to the last visited location in the text file. Hitting it again brings you back to X This switching is similar to Ctrl+6 to open the last opened file. But how ...
7
votes
1answer
5k views

Switch VI to use backspace key instead of Control+H for backspace?

I'm on Solaris 10 and by default vi version SVR4.0, Solaris 2.5.0 is installed. The system was set up so that when I ssh to it Control+H does backspace, and backspace outputs ^? I added stty erase ...
7
votes
1answer
208 views

VIM: folding bullet points

I'm quite new to VIM, but have been trying to teach myself over the past week, yet I'm encountering a problem which has proven to be quite frustrating: Currently I'm mostly using VIM to take notes, ...
7
votes
1answer
1k views

Select lines using ranges in Vim?

I would like to select lines visually. Usually I'd SHIFT-V and select with j and k to highlight the lines. How do I do it using a colon-range command? e.g. :10,12<?> to select lines 10 - 12 ...
7
votes
3answers
440 views

Block motion for any bracket type?

If I want to, say delete a block, I can use text object motions. I.e if my text looks like this: (let [a 1 b {:x 3 :y 4}] a) And the cursor is for example on character 3. If I type diB ...
7
votes
1answer
374 views

Case-preserving search and replace in vim?

In vim, I know I can search with or without case sensitivity. But if I want to search for a string in either upper or lower case, and replace it with a replacement of the same case, is that possible ...
7
votes
1answer
160 views

making vim fold also hide newline after function

How can one make vim's fold function - when using foldmethod=syntax - also hide one newline after each function, if-else and struct (using Go).
7
votes
1answer
430 views

Note-taking and outlining using Vi: On startup, highlight tags and display tags in a preview window [duplicate]

I am using vi as a note-taking and outlining tool and therefore I thought that this stackexchange site would be appropriate to ask this question. I am constructing the "tags" file by myself. What I ...
6
votes
5answers
758 views

Terminal and Vim

I open a terminal then I open Vim. Then I work on my source code, but unfortunately I click on the close button of the terminal title bar and my work is lost. Is it possible to configure Vim such that ...
6
votes
5answers
4k views

vi command for adding blank line?

In vi, I can use o or O to add a blank line and go into insertion mode. But what if I want to stay in command mode, is there a command for this? In googling, I'm seeing suggestions to add stuff to my ...
6
votes
4answers
7k views

What causes swap files to be created?

As part of the program I wrote, I constantly read and write data from files. I noticed that as part of doing so, I am inadvertently creating swap .swp files. What do you think is going on? What would ...
6
votes
4answers
1k views

Indent several lines with VIM?

For eample, I'm editing this code: <html> <body> <script> var a = 10; a += 100; </script> </body> </html> now I need to indent the script line: ...
6
votes
4answers
4k views

Auto indent / format code for vim?

I'm trying to use vim more and more when i can. One of my biggest grip between vim and an IDE like aptana is the ability to auto indent. Is there a means of auto formatting code (html, css, php) so ...
6
votes
2answers
2k views

Is there a way to place a comment in a file which vim will process in order to set filetype?

For example, if I want to have a file with the name gitconfig (no leading .) be recognised by vim as being of filetype=gitconfig, is there a means of indicating this in a comment or something similar ...
6
votes
4answers
939 views

vim search around line breaks

When I am editing a LaTeX document in vim, often times I want to search for a phrase. Because I have LaTeX setup to wrap lines, sometimes half of the phrase will be on one line while the other half ...
6
votes
4answers
909 views

Block editing *live* in Emacs or Vim

jEdit supports block editing, but Emacs and Vim seem to have some serious usability issues on the same subject. If someone could fill in the unknowns here it would be much more bearable to use either ...
6
votes
3answers
478 views

Looking for a centred, full-screen terminal

There exist out there several different 'distraction-free editors' for writing: these provide a fullscreen, minimal environment with the goal of forcing oneself to focus on the task at hand. I want ...
6
votes
2answers
325 views

vim - don't highlight search term after a search & replace?

After performing a search and replace, my installation of GVIM highlights any text remaining that still matches the search pattern. Example input text: foo foo fighters I run :%s/foo/bar/gc and ...
6
votes
4answers
2k views

How to split and edit patches?

Sometimes I need to split a big patch into smaller (disjoint) ones, e.g. for every separate feature included. Usually I do it via standard vim yank/dd commands and split-window switching. But are ...
6
votes
5answers
2k views

vim editing/switching between multiple files efficiently in large directory structures

I am by no means a vim power user, I am just beginning to grasp the advanced motions and commands with vim. But there's one drawback that I can't seem to get around. I grew up with graphical ...
6
votes
2answers
390 views

Remove all Vim undo files in all but one directory

I just realized that I have tons of Vim undo (.un~) files sprinkled around my file system. I'd like to delete all of these files except in one directory—~/.tmp. My first problem is that I can't seem ...
6
votes
3answers
326 views

VIM see regular expressions matches as you type

If I type /regex then the cursor temporarily jumps to the first match and all matches are highlighted. This updates as I type. Is it possible to get this behavior when I'm getting ready to make a ...
6
votes
2answers
1k views

red-green color blindness compatible vim theme

I am looking for a vim theme accessible to users with red green color blindness. In particular, the red text on a dark terminal background all but disappears. Do any of you know of a good theme? Or ...
6
votes
3answers
3k views

Vim :s replace first N < g occurrences on a line

In vim, I sometimes have occasion to replace the first few occurrences of a match on a line, but not every one like g would. e.g.: a a a a a to b b b a a I know I could use ...
6
votes
2answers
214 views

How to write a column of consecutive integers in Vim over existing text?

For example, imagine I had the following text: / apple / orange / banana / bread How could I efficiently add consecutive integers in a column to make? /1 apple /2 orange /3 banana /4 bread Note ...
6
votes
1answer
772 views

Is there an equivalent to whitespace-mode in emacs for vim?

Is there a way I can see spaces and tabs wonderfully visualized in vim, like I can in emacs by toggling whitespace-mode?
6
votes
1answer
196 views

How can I count the number of words in a file whilst editing the file in vim

I know I can use wc for counting characters, words and lines of files at the command line. Is there any way I can can count the number of words while in vim?
6
votes
1answer
1k views

In vim, how to map “command-right” and “command-left” to beginning of line and end of line on mac?

I'm trying to get it to be like default text editing in Mac. I tried map! <D-Left> 0 and map! <D-Right> $ in ~/.vimrc, but of course it didn't work. How can i do this?
6
votes
3answers
601 views

How can I open a file in VIM in readonly mode if it already has a swapfile?

When I use the command :e filename to open a file and this file is already opened by another vim instance, I get a prompt asking me if I want to open the file in read-only mode, edit anyway, recover, ...
6
votes
3answers
687 views

How to search the current word in all opened tabs in Vim?

I have started learning Vim word-search using * and # while the cursor is over the current word. But this search is limited to the current file buffer. Is there a command or a shortcut to extend this ...
6
votes
1answer
688 views

Only one file name allowed error

Sometimes I forget to do sudo vim and open files to which I don't have write permission. I saw this post and it was really helpful. When I did :w !sudo tee % it asked me for a password and then the ...
6
votes
2answers
348 views

Indent the middle of multiple lines

I often run into situations like this: title : Jekyll Bootstrap tagline: Site Tagline author : name : Name Lastname email : blah@email.test github : username twitter : username feedburner : ...
6
votes
1answer
184 views

Why does mapping <esc> cause arrow keys to fail in vim?

When I do inoremap <Esc> <Esc>`^ in vim, the next time I switch to insert mode (after using Esc) the arrow keys fail to move the cursor (they insert letters instead). Why does that ...
6
votes
1answer
156 views

How to highlight logs with bash coloring on vim?

I have some nicely colored logs from some tools with bash color codes. When I view them through less or similar tools it get color rendered by bash (obviously). However it is pain to watch and edit ...
6
votes
1answer
2k views

How to set the bash display to not show the vim text after exit?

My question is simple, but I am finding it hard to frame/explain it easily. I log into several Unix boxes with different accounts. I see 2 different things for user1 and user2, while editing text ...
6
votes
1answer
2k views

Vim not running inside tmux

When I try to open a file using vim inside tmux the whole window freezes. I have to kill the window with C-a &. Here are my ~/.vimrc settings: :set autoindent :set ts=4 :set number :set ...
6
votes
2answers
77 views

How do I only undo pasted text in vim?

TL;DR; version - How do I undo text that was pasted in from my OS copy buffer without undoing other text that was typed in since I went into insert mode? Longer description: Put something in your ...
6
votes
2answers
1k views

Fixing CTRL-* in vim under GNU screen

When running vim under GNU screen, I'm finding that combinations of CTRL with the arrow and Pg* keys don't work as expected. I'm using the Ubuntu 10.10 vim-gnome package. On a different machine, ...
6
votes
1answer
260 views

vim: how do I set :match and :2match search results to different colors?

For example, I want something along the lines of: :match search /<div/ guib=Green :match search /<\/div>/ guibf=Blue only that doesn't work.
6
votes
3answers
578 views

Vim: How to get rid of filetype-specific map?

Edit: Working version. I've mapped [[ and ]] to my own functions: nmap <silent> ]] :let &tabstop += 1 <CR> :echo 'tabstop =' &tabstop <CR> nmap <silent> [[ :let ...
6
votes
2answers
252 views

Is there a method for making Google Chrome open textareas in vim?

I used to use Firefox on a daily basis but have switched to Google Chrome, and have been using it for 2+ years now. The one plugin that I miss is this one, It's All Text!. This plugin allowed for the ...
6
votes
1answer
300 views

Interactive tree command

Is there any version of tree command that displays file structure as a tree structure, but in a way that I can interactively walk trough? Why do I need it exactly - I am trying to simulate TextMate ...
6
votes
1answer
287 views

Application-specific keymapping

In general, I want to make specific keymaps for application, that working only in it and doesn't affect any other app. For example, I already use my Caps key to toggle input language (via xorg.conf), ...
6
votes
1answer
879 views

Rename current file in vim

Searching over net shows :f filename would rename the current file in vim. But executing this and later exiting vim, shows the new file with all the contents and also the old file is present with the ...
6
votes
1answer
149 views

Sending commands to dbx from Vim

Using this information, I've been able to debug code using dbx and display the code from within Vim. What would be really cool is if I could send commands (step, next, print, stop in ... etc) to dbx ...
6
votes
1answer
250 views

How to change Vim's command type mode programmatically?

Is there a simple way to switch from one command type mode to another without loosing the current command line? In my ~/.vimrc file I remap the <space> and <c-space> character, coming ...