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

learn more… | top users | synonyms

1
vote
1answer
46 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
33 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 ...
1
vote
1answer
42 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. ...
16
votes
3answers
3k 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
37 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
97 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
427 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, ...
2
votes
1answer
135 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 - ...
2
votes
1answer
66 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
50 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
550 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
26 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
2answers
417 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
52 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
60 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
14k 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
5k 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
307 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 ...
4
votes
2answers
297 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
30 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
685 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
51 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
9k 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 ...
11
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
102 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
69 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
115 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 ...
5
votes
5answers
36k 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
62 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
101 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
87 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
45 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 ...
1
vote
1answer
155 views

Where to find the .vim directory?

I'm trying to find out my .vim file which is a hidden file and that should be in my home , I want to install a vim plugin and for that i need to access the plugin folder which is in .vim file. I'm ...
0
votes
0answers
34 views

Nano: Rember cursor position at start

Can Nano save the current position of the cursor at exit and, when you reopen the file, restore the old cursor position, like vim does?
2
votes
2answers
80 views

Vim: copy from file to clipboard [duplicate]

I ask a simple question: how to copy from a text file using vim,and paste to clipboard? If i use yY I can paste,but only on vim file(using p),on clipboard i can't paste content. If i use "+Y paste ...
3
votes
0answers
174 views

tmux causing bold fonts in vim

I have installed tmux with vim, using the solarized colorscheme and airline plugin. All is good until I start tmux, where all the font turns bold and the airline status bar is looking weird. I have ...
0
votes
1answer
15 views

Is there another brief way to detect if an item is in a vim list other than `index(L, item)`?

In python, there is a syntax i in L to detect if a value is in a list. Is there a similar syntax in vim other than index() function?
2
votes
1answer
41 views

vim how to unabbreviate

I have abbreviated main to '#include.....', I was looking to unabbreviate it for one vim session, and tried the following :una main I get error 'E24: No such abbreviation'. The problem is, it's ...
2
votes
0answers
45 views

System clipboard is flushed out, once I exit vim

I use yy to access the system clipboard always. yy is mapped to a function as, function! Copy_ToSystemClip() .w !xsel -ob end function inoremap yy Copy_ToSystemClip()<CR> It copies to the ...
1
vote
1answer
651 views

How can I compile a C program that I've edited in Vi or Vim?

I'm trying to compile and run a c project from vim and vi #include<stdio.h> int main(void) { printf("Hello! This is a test prgoram.\n"); return 0; } and I get this output ...
1
vote
1answer
127 views

vim issue with tab/space in multi-line abbreviations in vimrc

i am trying to write a vim abbreviation to create a template program in c I have given the abbreviation as below in the .vimrc abbr main #include<stdio.h> \^M#include<string.h> ...
1
vote
0answers
24 views

How to save/reload split windows in vim?

How do I get the same split-settings back if I exited vim with :qa?
2
votes
1answer
36 views

Setting up a secondary Vim environment

I've setup the YADR dotfile repo on one of my machines, and find it very powerful/useful. Though it's definitely slower than my present Vim setup with all its plugins, I'd still like to be able to ...
17
votes
8answers
4k views

Open a file given by the result of a command in vim

I find myself doing the following almost every day Run a find (find -name somefile.txt) Open the result in vim The problem is I have to copy and paste the result of the find into the vim command. ...
0
votes
1answer
56 views

executable bit on files created by vim

Is there any setting for vim create new files with full permissions? that is falling just under the umask restrictions, and only on files created by vim. It shouldn't modify the bits of an already ...
1
vote
3answers
2k views

“E488:Trailing Characters” error in Vim after typing :<F7>

I have written the following in vimrc.vim :filetype plugin on :let s:save_cpo = &cpo :set cpo&vim :let &cpo = s:save_cpo :set runtimepath = ~/home/nikcha/.vim/plugin :set fileformat = ...
1
vote
1answer
63 views

Vim how to reset the screen before editing?

On Linux, if I do a command with long output, for example dmesg and then edit a file with vim the screen is like after reset command. On HP-UX, if I do a command with long output, for example dmesg ...
1
vote
1answer
47 views

vim: multiple substitutions like sed

Simply question,with sed is possible to do a multiple substitution sed -e s/uno/due/ -e s/uno/due/ Is possible something similar with VIM internal substitution? :'<,'>s/445/53/a/444/53/g ...
4
votes
1answer
1k views

ls and vim color on SunOS 5.8/Solaris 8

I want to use ls and vim with color on Sunos 5.8 SunOS 5.8 Generic_117350-11 sun4u sparc SUNW,Sun-Blade-2500 I have installed ls (GNU coreutils) 6.9 and vim 7.2 In ~/.cshrc: setenv TERM sun-color ...