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

learn more… | top users | synonyms

6
votes
1answer
254 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 ...
0
votes
2answers
46 views

What is the difference between “find” and “till” in vim?

I see I can use t c or Tc to move to the next / previous character c I can also use fc or Fc to move to the next / previous character c Is the only difference between them that tc places the ...
1
vote
1answer
36 views

How to align columns of multiple lines at a fixed distance with vim

Here is another one of my vim question (They seem to become my trademark here.). I have a really long file basically consisting of lines of the following form: ;07 :ANZ textv S9_1 9_1_K3_2 ...
6
votes
2answers
88 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 ...
38
votes
8answers
22k views

How can I edit multiple files in VIM?

I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the ...
8
votes
2answers
177 views

Vim - map last shell command to the key

Is there any way to map leader-r to repeat last command sent to bash? For example, when working with C files I would like to compile and run program from vim without typing :!make or gcc. I know I ...
4
votes
1answer
116 views

Right-align comments in vim

I'm writing C code using vim and are searching for a possibility to right-align my comments so that they all end at col 80. To give a short example: int a = 80; /* initialize a */ int b = 7; /* ...
9
votes
2answers
899 views

tmux, TERM and 256 colours support

Introduction My question arises from the necessity of understanding why I have now (after multiple trials) Terminal and tmux supporting 256 colours and tput colors telling me there are only 8 of ...
6
votes
1answer
204 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?
1
vote
3answers
70 views

Vim Error 'E212: Cannot open file for writing', when trying to create new files outside of home dir

I am running Wheezy Debian. When I try to create a new file in a directory other than my home directory, such as /var/www, I get the following error in vim: E212: Cannot open file for writing. I ...
1
vote
1answer
24 views

Filename completion in gvim

for some reason, my filename completion in gvim is not working. In vim, its working properly. Commands and such are, however, completed correctly. I have set wildmode=full. An example: Assume i want ...
0
votes
1answer
50 views

How do I write a command in vim to run multiple commands?

I've written some commands that perform common functions by placing the following in my .vimrc files: command! FixWhitespace %s/ \+$//g command! FixCommas %s/,\S\@=/, /g Now I'd like to create a ...
2
votes
1answer
49 views

vim: Use different colorscheme when connected over SSH

On my desktop I use the hbrid color scheme in vim, with the preferred colors set for my consoles 16-color palette (as described in the README). However, on my laptop, I use the solarized color ...
12
votes
3answers
2k views

How different is Elvis from Vim?

I've been using Slackware for a while now, which ships with Elvis as its default editor. Most other Linux distributions seem to ship with Vim, instead of Elvis. Having gotten quite used to Elvis, ...
0
votes
1answer
50 views

(Vim) How to use TAB for indentation in all file types?

I'm using only TAB for indent, so I configure Vim for using only them: set autoindent set noexpandtab set tabstop=4 set shiftwidth=4 But some files (.py) still using spaces. I've search for it and ...
3
votes
1answer
28 views

Calling latex from vim stopped working

When I try to compile my latex document from within vim by issuing: :w|!lualatex % (leaving out the w command does not solve the problem) it compiles but it does not save any files. If I call lualatex ...
5
votes
2answers
240 views

Problem : how can I copy/paste this in vim?

I'm working with the vim editor and I found y,yw respectively to copy a line and a word but how can I do the following task in vim? www.pack.google.com From this line how can I copy and paste ...
4
votes
2answers
254 views

Copy-paste for vim is not working when mouse (:set mouse=a) is on?

I was trying to copy paste something from vim to another application and also, from that application to vim using right click with mouse and then copy and paste (or with Ctrl+v and Ctrl+c and also ...
2
votes
2answers
79 views

Can I speed up pasting into vim?

I copied a part of the HTML out of a web page and wanted to save it in a file. For that I started a new vim session in a terminal window, with a (new) filename specified on the commandline, hit i to ...
1
vote
1answer
77 views

Redirect VI command output to a file

I want to export the output of vi command :set fileencoding to another file. It seems vi's file encoding detection is better than file command. How to do that? I could write a macro with: :set ...
4
votes
1answer
46 views

How do I highlight commas not followed by a space in vim?

I've gotten into the habit of not appending spaces after commas in lists, when coding. To break this habit, I thought I'd get vim to highlight any comma (,) that is not followed by a space. So I've ...
13
votes
2answers
11k views

How do I get the solarized colour scheme working with gnome-terminal, tmux and vim?

There's a lot of questions around this, but it's because there are so many variables. I had to piece together instructions from many sites before I got this working. First, I could not easily set up ...
1
vote
2answers
87 views

Configure bash and/or vim to execute source ~/.bashrc everytime I finish editing it

I would like to execute source ~/.bashrc every time I finish editing a file with vim (i.e. after :wq vim command). How should I configure vim or bash to work that way?
3
votes
1answer
143 views

Collapse line vertically so that every word is on a new line

Given a string like: "Hello World, how are you today?" Is there a way in Vim to collapse this line vertically such that every word appears on a new line, i.e.: "Hello World, how are ...
1
vote
1answer
40 views

dot command in Vim, last change?

The dot command in Vim repeats the "last change", but I am not exactly sure what constitutes the "last change". For example, if I type the sequence: A;{ESC}j. Then a semi-colon is appended to ...
5
votes
1answer
74 views

Copy/paste across vim without X

In vim, "+p pastes from the system clipboard. However, when working remotely over SSH on a non-GUI box, this is not available. Is it possible to implement copy/paste in this environment? Merely ...
2
votes
3answers
57 views

How to enable and use code folding in vim

How can I enable and do code folding in vim? Do I have to change anything in ~/.vimrc? I type z+a and z+c and z+o and nothing happens. code folding on vim.
2
votes
1answer
38 views

vim: hide status line in the bottom

Sometimes I work with really small terminal windows and need every piece of space available. So I want to hide the vim status line. I already set laststatus=0 this hides one of the status lines. But ...
4
votes
1answer
65 views

Can we patch an already patched font?

Powerline is some sort of plugin for Vim and Gvim. In order to be more useful it uses fonts that has some pictures (symbols) added to them. In other words they've "patched" the font set. Recently ...
54
votes
9answers
10k views

Why can't Vim open a 100 MB text file when I have 16 GB RAM?

I have a 100MB MySQL database backup file and I have trouble to open it in Vim on my Linux box that has 16G of RAM. Vim just hangs (at least unusable). This is something I don't understand. I have 16 ...
0
votes
2answers
45 views

Insert single successive numbers at the beginning of each line in a text file with Vim

Assume I have a text file containing some strings: string_g string_r string_qqwer string_p string_f string_3qw string_e string_qw And I need to insert increasing or decreasing numbers before the ...
4
votes
2answers
61 views

Verify line endings from a text created by perl script

I am interested in seeing the contents of a text file in hex mode. I have tried :%!xxd and the problem is that I can not really understand which hex code represents each letter e.g. when you use an ...
1
vote
0answers
26 views

Open to specific gvim tabs

I have a working environment that I'd like to save via a script. -EDIT: I don't need to save it's state, I just want my script to define it. Though saving state would work too I guess. Currently it ...
5
votes
2answers
515 views

Why does Vi have multiple modes?

Why does Vi have multiple modes? I'm not interested in the functions of the modes unless that was a reason to have different modes. I'm only interested in the design / engineering reasons for ...
2
votes
4answers
1k views

less command and syntax highlighting

I need to use the less command with the syntax highlighting of the vim command for python, C, bash and other languages. How do I apply syntax highlighting colors according to vim colors for less ...
2
votes
2answers
41 views

Navigation Motion to Skip Comments

To edit configuration files, I'm using Vim. In order to move the cursor upwards or downwards to other configuration entries, I'm using Ctrl+d or Ctrl+u, respectively. Large blocks of commented lines ...
5
votes
2answers
3k views

Why can't vim find syntax.vim on my fresh Ubuntu installation?

I'm trying to make some basic customizations to vim. All I want is some syntax highlighting, etc. Basically, not just plain text. My .vimrc file consists of 7 lines: backspace=2 syntax on filetype ...
2
votes
2answers
55 views

Highlight extra white spaces and fixed length column in VIM

I want to highlight extra white spaces and fixed length column (e.g., 80 character in a line) using VIM I created two vimrc rule in my .vimrc file highlight ExtraWhitespacea ctermbg=darkred ...
6
votes
3answers
772 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 ...
7
votes
4answers
4k views

Ctrl-s hang terminal emulator?

I came across a sentence in vimdoc: Note: CTRL-S does not work on all terminals and might block further input, use CTRL-Q to get going again. and this key indeed hangs my vim. I was ...
1
vote
4answers
217 views

Enclose multiple lines in quote Vim

I have blocks of the following form: String that is not supposed to be enclosed in quotes String that is supposed to be enclosed in quotes String that is not supposed to be enclosed in ...
0
votes
1answer
39 views

How to edit files with VIM through FTP

I'm trying to use: vim ftp://user@hostname// - this gives me a correct directory tree, but when I try to open given file, by pressing Enter, at the first time - nothing happens (just cursor jumps to ...
7
votes
8answers
3k views

Compiling code from vim

New to vim and and I want to be able to compile code from within vim without running a new terminal and calling the compiler. How do I go about doing this? Note that this requirement is not ...
2
votes
1answer
83 views

Make vim stop splitting my Git commit messages

Vim has this awful annoying habit of splitting my commit messages and automatically line-breaking them, rendering the second line with a red background for some reason. How can I make vim stop ...
6
votes
3answers
3k views

Transaction check error in installing vim?

I recently updated my fedora to 20 and wanted to install vim.but running sudo yum install vim returned this error: Transaction check error: file /usr/share/man/man1/vim.1.gz from install of ...
1
vote
2answers
215 views

Why does Vim only activate my highlight configuration after I source my .vimrc manually?

I was cleaning up my vimrc today, splitting it into separate files to make it easier to maintain. On completion of these changes, all my configuration, mappings and plugins appear to be working, ...
0
votes
1answer
97 views

Can't install vim in fedora 20

When I tried to install VIM in fedora 20, appear this message below How can I fix this problem?
8
votes
3answers
380 views

Vim: pasting lines line by line

Let's suppose I have a file containing: xxx yyy zzz and another file: kkk qqq ppp I want to obtain: xxxkkk yyyqqq zzzppp Is that possible in Vim with some command? (I've tried using VISUAL ...
1
vote
0answers
50 views

Why does vim color this .bashrc line incorrectly? Fixable?

I have the following line in my .bashrc that allows me to use rlwrap with sqlplus. Why does vim seem to color this wrong? alias sqlplus='rlwrap -c -f /usr/bin/rlwrap -b ...
17
votes
5answers
2k views

vim - better colors so comments aren't dark blue?

Mostly I edit ruby files, although shell script file comments are also # Currently my comments show as dark blue on black which is really hard to read. See screenshot. How can I change their color? ...