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

learn more… | top users | synonyms

4
votes
3answers
174 views

Stop vim from messing up my indentation on comments

For some reason Vim thinks all of my comments should have all indentation removed. If I add # to the beginning of a line, suddenly all leading whitespace is removed. How can I stop this? I have ...
1
vote
1answer
31 views

pattern matching in vim

I have a file with following content: 635147+876+5597+1686+54=8643360 2415+382376+88324+81544+926+68619475+677+222852=69398589 80+21+4478882+8945092=13424075 62+9598=9660 16832904+537+51460155+6822+2+...
3
votes
2answers
45 views

understand patterns in vim [duplicate]

I have a following file: 8635147+876+5597+1686+54=8643360 2415+382376+88324+81544+926+68619475+677+222852=69398589 80+21+4478882+8945092=13424075 62+9598=9660 16832904+537+51460155+6822+2+4901436+...
20
votes
6answers
9k views

How do I make Vim behave like “tail -f”?

I would like to know if there is a way to make Vim behave like tail -f. Even the best Vim plugin I've found so far doesn't do what I expect. I really want to see the file update in real-time. Even I'...
4
votes
2answers
54 views

How can I stop vim from editing directories?

Sometimes I accidentally tell vim to edit a directory instead of a file in it vim directory-name # what I typed vim directory-name/blah.txt # what I meant to type Instead of immediately ...
20
votes
1answer
3k views

gvim -p limit of opened tabs?

When I run : gvim -p *.xyz I find that not all files are opened in tabs. It feels, like a kind of tab limit? But ! When I try to open unopened with : :tabnew it is opened next to previous ...
0
votes
1answer
18 views

Can I jump to a jump by its number in vim?

If I execute :jumps command it shows me a list of previously visited files/lines jump line col file/text 97 152 0 ... Can I jump to a jump by the jump number without iterating over them by ...
1
vote
4answers
8k views

What is a vi equivalent of vim's 'set ruler' command?

Is there a way to show the current row and column position in vi? In vim, I know there is the set ruler command, but what are my options when using vi?
6
votes
3answers
4k views

Globally replace Vi with Vim on Fedora

On Debian-based systems the alternatives system handles both the vi and vim executable. So if vim is installed and you execute vi, you also get vim, which I find very nice, because I absolutely hate ...
0
votes
0answers
9 views

How to customize the entries in the vim/neovim completion menu? [migrated]

In the insert mode of vim, when you hit <ctrl> p on a partially written word, a menu popups with possible matches for completion. How can I customize those matches ? (I have a ruby-clangc gem ...
3
votes
2answers
1k views

Vim script check running platform

" Get running OS let os = "" if has("win32") let os="win" else if has("unix") let s:uname = system("uname") if s:uname == "Darwin" let os="mac" else let os="unix" endif ...
1
vote
1answer
110 views

Bash command-line completion function for vim and emacs 'scp://' remote file paths

For easily specifying remote files for editing with vim or emacs from the shell, I would like to have tab-completion like available for scp. Completions for scp work well and fast, if your .ssh/...
3
votes
1answer
77 views

how to understand \n in vim

I have a text file with following content: elephant rhino giraffe /* animals who live in Africa */ I would like to add # character at the end of each animal. I can do this with :%s/\n\n/#\r\r/g ...
11
votes
2answers
470 views

Vi editor: What's the fastest way to delete multiple rows in a file?

I'd like to use the Vi editor to delete multiple rows in a file. Please give me idea or suggestion. My goal is like this: Before: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 . . 29 30 . . ...
0
votes
1answer
38 views

Nano: Remember 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?
3
votes
1answer
196 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 ...
1
vote
1answer
26 views

How to tell vim to NOT REREAD FILE when I switch back to it

My list of actions: e xx.txt e xx2.txt "in a different window change xx.txt :b# At this point I would like vim to tell me that the buffer has changed, but to not load new contents into the buffer. ...
1
vote
2answers
77 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
4k views

YouCompleteMe not working after default install

I was trying to install YouCompleteMe with Vundle and it installed fine (it downloaded the git repository I pointed it to). I went into the folder and ran install.sh with the clang semantics and ...
0
votes
0answers
32 views

How to force vim to interpret ANSI color escape sequences [duplicate]

If I have a file that has color control characters for the data, such as this example: ^[[96mJul 16 22:12:25 192.168.100.101 This is the data^[[39m And I want to view it with Vim, is there a way to ...
4
votes
1answer
32 views

How to edit multiple files in Vim?

In Vim (more specifically, MacVim), if I've already set the working directory using :cd and I want to open all the *.py files within that directory, is there a way to do so from within Vim? I expected ...
2
votes
2answers
49 views

How to open a file in VIM and move cursor to the search result

Consider the file tmp.txt whose contents are: x abcd I want to open it in VIM and move cursor to the c character. So I run VIM with the arguments: $ vim -c "/c" tmp.txt But it sets the cursor on ...
-1
votes
2answers
55 views

Vim: set “cursor keys” hjkl to wasd [closed]

I admit that I'm not an expert vim user so forgive me not providing previous attempts! I wish to overwrite/remap the basic vi/vim (and gvim) "cursor keys" hjkl to the ordinary "gamer layout" wasd (w-...
1
vote
1answer
4k views

Terminal colors for Vim Airline and Tmux Tmuxline

When using Vim on its own with Vundle and Airline the theme appears normally: When I have loaded it up in Tmuxline, the theme uses different colors and even Vim looks different: Here's my Tmux ...
2
votes
2answers
33 views

Setting editor in mutt: vim with parameters?

I am exploring mutt as an email client - and I like it very much - my only problem is setting the editor to be vim with some extra parameters. Ideally, I would like something like set editor='vim -c ...
17
votes
5answers
15k views

How do I cycle through panes inside a window in tmux like in screen?

I thought Tmux - move window to pane was the same question but it doesn't seem to be. Coming from using GNU screen regularly, I'm looking for tmux to do the same things. On of the things I do ...
3
votes
2answers
44 views

How can a user Edit a file even when Write bit is off on a file

Here is the thing i just had a urge to play with umask on my training machine. i created test user john and logged in using john. and set the umask to 0200 and created a testfile in vim and saved it. ...
7
votes
3answers
616 views

Can vim edit a remote file as root?

I've found this question that explains how to edit a remote file with vim using: vim scp://user@myserver[:port]//path/to/file.txt Is it possible to do this as root (via sudo) on the remote host? ...
4
votes
1answer
348 views

Why is Vim eating up Ctrl when used with Ctrl+v and how to fix it?

I'm using Vim /etc/zsh/zshrc to add key bindings for zsh because it doesn't work with inputrc. In my terminal with tmux when I type Ctrl+v then Ctrl+LeftArrow the shell will show ^[OD. However, when I'...
16
votes
5answers
21k views

How can I exit from read-only mode in Vim?

I opened a file in readonly mode; is there a way to get out of readonly mode?
0
votes
1answer
20 views

Highlight Vim escape characters e.g. \n

I'm using the Jellybeans vim colorscheme but it doesn't highlight any escape characters. For example if I'm using C++ and have the following... std::string word = "hello\n"; ... the whole string ...
0
votes
3answers
65 views

Vim Search and Replace - Regex

I want to perform a search and replace. A newline before any non-digit should be replaced with tab. I tried %s/\n\D/\t/g but it replaced the first character of the word following the newline, which ...
36
votes
4answers
94k views

How do I quit from Vi?

I started Vi on my Ubuntu machine. However I'm new to Vi, and now I can not quit. I see the editor and I can write text, at the bottom line there is a label "recording". How do I quit Vi?
1
vote
2answers
31 views

VIM: function that checks if external program is running

Using a vim function, I would like to check if a program is running using pgrep, and if it is not running then do something. In particular, I want to achieve something like this: function! ...
131
votes
4answers
118k 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.
1
vote
0answers
7 views

Vimdiff copy above/below

do and dp are kinda limited to take one or another version of the conflict, in many cases it's just java imports when you need both changes, is there any way to make a map that copies the other side'...
0
votes
0answers
18 views

How to give an arbitrary name for a register in vim

Is there any possible way to give an arbitrary name for a register in vim. I am able to use "[a-z]p while pasting. But, I would like to know, if there is anyway by which we can use arbitrary names for ...
5
votes
6answers
2k views

vi shows as vim

When I type vi into a terminal it shows the following display: Note that it says vim not vi, I'm sure I haven't downloaded vim yet and that this is actually vi not vim: for example the arrow keys ...
3
votes
1answer
66 views

Vi undo updated file?

I just deleted a bunch of text on a file and saved it. Is it possible to recover the older version of file back? I know I should have taken a backup, just trying my luck.
7
votes
2answers
201 views

Problem using Ctrl+Arrow keys in Vim when using Byobu with tmux

In Vim, I had set the Ctrl+Arrow keys to skip words. This works just fine when running Vim inside the gnome-terminal. However, when using byobu (tmux), it shows weird behavior : it deletes ...
0
votes
1answer
32 views

System messages in vim

O/S: Arch Linux (Kernel 4.3.3-2-ARCH) While editing files with VIM 7.4 it occassionally happens that system messages appear on the screen, ruining my workflow but obviously not altering the ...
2
votes
1answer
30 views

Automatically set number in vim without modifying vimrc because of limited permission

Hi since I dont have permission to modify vimrc. But I really need to view the line numbers every time. Is there an alternative way to do the following without modifying the vimrc file?Thank you! :...
2
votes
1answer
32 views

Opening files within archives from vim

I know that vim can open files within zip or tar{,.gz} archives interactively: open the archive first, then navigate to the correct entry and press enter. lesspipe (https://github.com/wofr06/lesspipe)...
2
votes
2answers
239 views

Set makeprg to gradlew

First a bit of context for those who don't know gradle. It's basically like make except that you don't have to have gradle installed on your computer. It ships with projects as a file called gradlew. ...
0
votes
0answers
35 views

Trying to execute vim function from plugin - can't get syntax correct

I found a pretty neat VIM plugin which adds functionality for managing Perl scripts; it's called Perl-Support. I got it installed fine, and I'm trying to take advantage of all the custom functions/...
1
vote
2answers
200 views

White terminal cursor and yellow Vim searches

I have a blinking block cursor in the XTerm. The goal is to always be able to tell my current position. It usually works fine, but it fails when I place my cursor on a background similar to the cursor ...
0
votes
0answers
25 views

Vim goes haywire inside tmux

I am using vim-airline and have enabled tab line. I have set TERM=screen-256color in .tmux.conf and I can see that being printed in and out of tmux. Vim with airline works perfectly fine outside of ...
53
votes
8answers
70k views

Vi vs vim, or, is there any reason why I would ever want to use vi?

I know a bit about *NIX text editors (currently migrating from nano to vim), and, after looking around a bit on the Unix & Linux SE, have noticed that vi is used instead of 'vim' in a fair number ...
2
votes
5answers
2k 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 ...
122
votes
2answers
71k views

refresh changed content of file opened in vi(m)

I have a config-file that I keep open in vim, but that sometimes gets changed on disk, without these changes being reflected on the terminal. Can I refresh the content on the screen without closing ...