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

learn more… | top users | synonyms

-3
votes
2answers
49 views

C Programming on command line [closed]

What to do after opening vim name.c and writing the source code? I mean, to compile and execute.
1
vote
3answers
355 views

vim/emacs plugin to view recursive grep search search results?

Suppose I have a file formatted like this: file1:123 file2:4444 some/other/file:2233 This represents the search results from a command grep (i.e. the format file:line-number). I'd like to have a ...
1
vote
1answer
44 views

vim sudo hack auto reload

I've installed and aliased some a newer version of vim and aliased vim to call that version. I also aliased sudo so that it can just call the system default vi when I need to edit a file as sudo but ...
3
votes
0answers
22 views

How to remap “dead_hook” in Emacs and Vim?

I would like to remap some common symbols like ( and ) to the base line of my keyboard combining Alt Gr with other keys like j or k. I can remap Alt Gr+k to ) because that combination prints ĸ. The ...
1
vote
3answers
193 views

How to match two lines at once in vim

I have a file that contains records with tab separated format but in two lines, I want to arrange records in one line with tab separated values using vim editor pattern match. Ex. Abc PQR ...
3
votes
1answer
25 views

Can I/how to specify colors in hex or RGB in nano syntax highlight config?

I enabled syntax highlight in nano (PHP), but not happy with the default, I would like for example to have the comments displayed in very light grey. However, the documentation I found seems to ...
1
vote
1answer
29 views

Find files and send to a temp file

Vim does support a nice option to accept a file with list of files that are then opened in a Quickfix list. Rough example, I find all files in ~ that are smaller than 1KB and pass this to Vim: find ~ ...
2
votes
1answer
28 views

How can I selectively modify the lines in a file where the modifications depend on analyzing the select lines as a whole rather than individually [duplicate]

TL;DR I need to align the columns of the entries in fstab while ignoring the comments: /dev/foo /foo ext4 defaults 0 2 # comment line 1 /dev/bar /bar ext4 defaults 0 ...
1
vote
1answer
34 views

With crtl-p can I open a file outside the current tree?

In looking to have functionality that can match my textmate friends for opening files with quick regex capability I found ctrl-p - https://github.com/ctrlpvim/ctrlp.vim It builds, indexes and then ...
2
votes
0answers
51 views

vim makefile syntax highlighting issue

Vim doesn't want to highlight my target named " * .o " and its dependencies because of the char ' * ' that I use to target all object files. When I replace the ' * ' by letters the highlighting ...
51
votes
1answer
16k views

What's the recommended way of copying changes with vimdiff?

When comparing files, and updating a source code repository, I like to use vimdiff. To copy changes made from one file to the other, I usually use a key sequence like this:- Shift + V (select line) k ...
1
vote
1answer
44 views

vi needs two <enter> keystrokes instead of one

If I want to open a file using "vi", it needs two <enter> keystrokes instead of one. Any idea, how to fix it? Just few hours back it was working perfectly. I have been searching on the net ...
0
votes
1answer
19 views

Create remote file stream into terminal

I'm not experienced unix user so terminology may be not correct. Suppose I have a remote unix hosting which I'm connecting to from windows by ssh with putty. So I have terminal window with access to ...
114
votes
4answers
97k views

Delete from cursor to end of line on VI

I know I've probably looked over this a million times in all the VI documents I've read, but I can't seem to find the delete from cursor to end of line command.
15
votes
2answers
7k views

What is meant by a shell is in “vi” mode or “emacs” mode?

This question follows directly from the answer to one of my previous questions here. I am newbie to unix world and this site has helped a lot to understand some core concepts. In this case I am ...
1
vote
1answer
37 views

Why CR sequence (\r) getting entered in .vimrc file?

Please look at my '~/.vimrc' file below. :map g :w :map g :w See, the same line repeated. After writing 1st line, I pressed the "Enter" key. Now see the output of the od command below. ...
1
vote
1answer
17 views

Accessing to the lastly executed command and modify it before executing in VIM

Scenario. Imagine, that I want to search replace something. :%s/foo/bar/g Now, imagine that I made a mistype and executed the command :%s/fop/bar/g Every vim user knows than @: executes the ...
16
votes
3answers
1k views

Vim - how to replace one new line \n with two \n's

In vim editor, I want to replace a newline character (\n) with two new line characters (\n\n) using vim command mode. Input file content: This is my first line. This is second line. Command that I ...
0
votes
2answers
30 views

How to make a .vimrc command dependent on a file existing?

My .vimrc uses pathogen by doing execute pathogen#infect() However if I set up a new computer and haven't installed pathogen with mkdir -p ~/.vim/autoload ~/.vim/bundle && \ curl -LSso ...
0
votes
0answers
32 views

Is it possible to recover deleted sudoers file without recovery mode? [duplicate]

I deleted the sudoers file by accident, and I am trying to enter recovery mode, but no matter which flash drive I use, it says 'an unexpected error has occured.' I want to recover it from within the ...
2
votes
2answers
62 views

Screen - weird behavior after exiting Vim

I am facing problems with my configuring screen. My screen.rc is very simple and looks like this: altscreen on termcapinfo xterm ti@:te@ I wanted to configure screen to have the same behavior as ...
4
votes
3answers
332 views

Open file with started vim from outside (in terminal)

I have a started vim. I suspended it (Ctrl+Z). So I was in terminal session and I would like to open some file with the same vim session (new tab). I can open the file in new vim session. Actually, ...
0
votes
1answer
33 views

vimdiff to compare output instead of files

I am trying to compare two command output (no files) vimdiff "$(tail /tmp/cachain.pem)" "$(tail /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem)" I tried playing with redirection, pipe, and vim - ...
10
votes
4answers
973 views

How to scroll large datafile while keeping header

Suppose I have some large datafile, which overflow the screen in both vertical and horizontal direction. How can I browse this file, while the header-lines stay on the screen? For the moment, I am ...
2
votes
1answer
52 views

VIM with Python - Multiple # do not get colored as a comment

Something changed on my system and now VIM screws up syntax highlighting of commented lines. This makes having 'debug' lines very difficult as it looks like the line is still active based on the ...
0
votes
1answer
37 views

Show colors in gVim embedded terminal

Does anyone know how to show colors in the gVim embedded terminal? For instance when you do a !git diff file.c.
2
votes
3answers
319 views

Trailing spaces when copying from console

It's this annoying behavior I've been experiencing here and there occasionally: when you select text with mouse in console (that is, copy it), paste it, and realize you've got extra spaces at the end ...
0
votes
1answer
22 views

syntax highlghting in vim

I have text files which have extensions *.sc. So to make syntax highlighting for some of the keywords in that type of text files I created ~/.vim/syntax/sc.cim. Below is the file content. user $ cd ...
2
votes
3answers
1k views

VIM solarized color scheme looks wrong when using tmux

I am trying to use the solarized color scheme in VIM using gnome terminal (Ubuntu). When I run vim without tmux, it looks great, see below: If I add the following commands to my .bashrc # tmux ...
1
vote
2answers
168 views

What is the format of the default statusline?

I read about how to update the vim statusline here. And I am able to update it successfully. But, I would like to retain the format of default vim statusline and just add some more info to it e.g. ...
0
votes
1answer
46 views

Color encoding for shell script

I using KSH shell as my linux environment. I am writing shell script for one of my project. Currently shell script does not shows color encoding for variable ,etc. It comes in black and white mode. ...
1
vote
1answer
49 views

Why do I have to press space after a command in Vim?

I frequently run into the situation that I have to press space to "actuate" the command I entered, e.g. after I hit ~ to swap case of a letter. Why is that?
9
votes
5answers
11k views

Vim Error E138: Can't write viminfo file $HOME/.viminfo!

I'm afraid I've run into something rather strange. When I open a file normally, vim README.txt, everything is fine. But upon sudo vim README.txt, the file renders blank, and gives me a E138: Can't ...
4
votes
4answers
4k views

Problem with vim when logged in as root

When I login as root or edit a file by sudo mode all of the options in my /etc/vimrc are not working (e.g. highlight line-number etc.)
0
votes
1answer
105 views

How to upgrade Vim 7.2 to 7.4 latest on Red Hat 6.6 the easiest way? [duplicate]

I'm a Vim user, and usually I just install vim via a one liner "apt-get install vim", but for red hat how can I update the 7.2 version to 7.4 with a one liner? I googled it and many places tell me to ...
58
votes
9answers
20k views

Exit vim more quickly

I use Vim mainly for quick edits rather than long work sessions. In that sense, I find the keyboard sequence for quitting especially laborious: Esc, Shift + ;, w, q, Enter. How to quit Vim (possibly ...
4
votes
2answers
253 views

Set the bash display [while using GNU Screen utility] to not show the vim text after exit

Currently when I am not using screen utility, I am able to see the VIM content wiped out of the display when I quit VIM. However when I am using GNU Screen utility and opening a file in one of the ...
0
votes
2answers
28 views

Edit text with vim

I am trying to write command in Vim which can delete 9 and 11 symbols in third line. I did this 3s/9, 11/// but nothing happened as I expected it to be. It would be grateful to do this with your ...
1
vote
3answers
610 views

Trouble getting help in vim

I have just finished the vimtutor and everything went fine except for the last part (Lesson 7.1: Getting Help). I type :help and the help manual is shown as it is supposed to. But then I try (as ...
1
vote
1answer
49 views

vim: Match WORD in current block with balanced brackets

When matching in vim there are words, WORDs and blocks among other things. Now for editing code, blocks are useful, words are somewhat useful, but WORDs are mostly useless, because they often include ...
5
votes
3answers
8k views

“No protocol specified” when running vim with sudo

Recently I start to get "No protocol specified" when using sudo vim. It's just a warning I guess, because everything was working normally (I can open, edit and save files). The message doesn't appear ...
10
votes
3answers
4k views

How to switch to the directory listing from file view in vim?

I have opened a dir vim some/dir. I can navigate within the tree, yet once I opened a file I wonder, how do I close the file view in order to go back to the directory listing to navigate to another ...
0
votes
0answers
72 views

Tmux session name background color persists between sessions

I have tmux set to display the session name in the left status bar. The background color of the session is either red or green depending on if I have failing tests or passing tests. When I switch to ...
0
votes
0answers
46 views

How to run a command from vim and direct output to /dev/null

When writing a .tex file, I want to be able to view the pdf of the file. I remapped \e to show the pdf file in evince as below: nnoremap \e :!nohup evince %:r.pdf & >/dev/null ...
2
votes
1answer
75 views

Move one screen row up/down in a multi-line text

I have a multiline text in my Vim editor as, One line of text is spread across multiple lines as shown above. For editing, i would like to move up/down one display line (screen-row) at a time. But ...
4
votes
5answers
32k views

“Swap file xxx already exists” when editing apache configuration file in vim?

Using vim I keep getting a message saying "Swap file xxx already exists" when I'm editing an apache config. However, I don't see it in the working directory on in tmp. How do I delete this?
2
votes
2answers
41 views

Keep transparency at end of file vim

I am using urxvt, when using vim the transparancy after the end of the file I am editing isn't working it is just a solid color with '~' on each line. This problem only happens when using a custom ...
0
votes
1answer
52 views

How can I change my tmux color scheme based on the time of day?

I just implemented a few lines into my .vimrc that changes the color scheme from SolarizedDark to SolarizedLight based on the time of day. " Solarized light during the day, solarized dark during the ...
0
votes
1answer
55 views

vim won't open with plugins installed the pathogen way

I recently found out about vim-pathogen, and installing vim plugins on my Mac has been working great. I tried using vim-pathogen on an external Linux cluster, but as soon as I clone a plugin ...
3
votes
1answer
44 views

Is there a FileType name for files without suffix in vim?

With my current knowledge, I can use commands such as autocmd FileType markdown colorscheme zen to set a colorscheme for a particular type of file. I have a need to use a colorscheme for all those ...