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

learn more… | top users | synonyms

17
votes
5answers
14k 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 ...
2
votes
2answers
41 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
563 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
346 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
20k 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
17 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
52 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 ...
32
votes
4answers
89k 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
116k 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
6 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
16 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
65 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
190 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
26 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
26 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
233 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
187 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
23 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 ...
51
votes
8answers
67k 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 ...
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 ...
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 ...
118
votes
2answers
67k 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 ...
1
vote
1answer
52 views

Vim color scheme not being applied

I am installing this theme using these instructions. $ vim --version VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 08 2016 11:38:28) Included patches: 1-1689 Here is my ~/.vim/colors: xxx@xxx:~/...
0
votes
1answer
47 views

Vi help problem with / in command mode

Hope someone can guide me in the right direction. I have an issue with the vi text editor, when in command mode after I enter ":" and want to use "/", the forward slash does not come up. What I get is ...
3
votes
1answer
31 views

Why in “:normal”command ^[ seems doesn't work with A? (vim)

Today, I learnt a bit of vim normal command, and below is my experiment: :normal i Insert ^[ yyp :normal A Append ^[ yyp # RESULT OF EXECUTE FIRST COMMAND FOR SEVERAL TIMES Insert Insert ...
11
votes
3answers
3k views

Select code block in vim

Given a code like this: 588 while ($linecounter > 0) { 589 $token = " "; 590 while ($token != PHP_EOL) { 591 if (fseek($handle, $pos, SEEK_END) == -...
0
votes
2answers
48 views

How to fetch all the even lines and odd lines from a file and save them into two different files such as Evenfile & Oddfile? [duplicate]

The question is very simple. Suppose I've a file named "a.txt" and it has 100 lines. Now I want to extract odd lines i.e lines 1,3,5...etc and save them to a different file such as Odd.txt and the ...
2
votes
0answers
32 views

Benefits of using vim buffers over tmux panes / dwm terminals

What are the benefits of using vim buffers over separate instances in several terminals? I've been using vim for quite some time, but at the same time I've been using tiled window manager (dwm/xmonad)...
9
votes
2answers
972 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 ...
2
votes
1answer
101 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 ...
40
votes
3answers
41k views

How can I set “vi” as my default editor in UNIX?

I believe I can do something like export EDITOR=vi, but I'm not sure what exactly to enter, and where. How can I set "vi" as my default editor?
1
vote
1answer
28 views

trigger vi mode key binding in normal mode only

I've created some custom key bindings for bash vi mode. They trigger while I'm in insert mode and I want them instead to trigger when I'm in normal mode. I'm using vi mode set -o vi in a terminal ...
1
vote
3answers
42 views

how to make a large command line broke in two lines be executed as a single line inside of a script

I am very begginer with Unix. I am using IBM z/OS390 and I am using the OMVS shell. I don't have "vi" installed at all so I use "oedit". If I try to initialize the app.jar straigh from OMVS shell it ...
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
1answer
46 views

Different vim colors and styles in Tmux and Gnome

I am using tmux, and recently found out that the same vim colorshemes inside and outside of tmux have different colors Left is tmux in gnome-terminal, right is plain gnome-terminal, gnome-terminal ...
0
votes
1answer
44 views

How to Execute !gvim current line in Viewer?

Code find-xargs(less)-gvim %http://unix.stackexchange.com/a/277889/16920 find . -name "*.tex" -exec grep -il "agent" {} + | less -s -M +Gg Output ./InfectiousDiseases/1.4.2016.tex ./...
0
votes
2answers
30 views

How to tell if tabs or spaces are being used in vim [duplicate]

I have a file that has data such as: 1 Foo 2 Bar 3 Kazam Is it possible using vim to know if a space is being used a delimited vs a tab?
3
votes
1answer
203 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 ...
2
votes
2answers
424 views

How to toggle mouse support in vim?

I have been working on my laptop a lot lately, and I am accidentally clicking while typing. I know I could remove set mouse=a in my .vimrc, but sometimes I like using the mouse. What can I do to ...
2
votes
1answer
40 views

tmux: how to bind a key to launch shell command?

I use tmux to develop, with two panes: one to edit the code, and one to compile it. I need to switch pane very often to launch the compile command (say "mvn install"). How can I bind a key (say "Ctrl+...
11
votes
4answers
8k 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 vim-...
1
vote
0answers
70 views

Strange VIM behaviour

I recently installed a minimal version of Fedora 23 Server edition. I use VIM as editor, and I noticed a strange behavior when I edit any text file that is not a new file during. Whenever I open ...
0
votes
1answer
81 views

Nano vs Vim or Vi [closed]

I have been using nano for quite a while now and I prefer using it anyway. But still I don't understand why people still emphasize on vi or vim. Can anybody specify me the reason why vim editor is ...
2
votes
3answers
194 views

sed regular expression behaving differently than in vim and perl?

Here's a sample 'test.txt' abcdX1yad45das abcdX2fad45das abcdX3had45das abcdX4wad45das abcdX5mad45das sample desired output: X1yad X2fad X3had X4wad X5mad I could get it working in vim with: :% ...
25
votes
6answers
4k views

Why is it risky to give sudo vim access to ordinary users?

I'd like to create a new user and give him sudo access. To be specific, I want him to use sudo vim and edit httpd.conf. I wrote this in sudoers: user ALL=(ALL) /usr/bin/vim /etc/httpd/confs/httpd....
23
votes
7answers
35k views

What is `^M` and how do I get rid of it?

When I open the file in vim I am seeing strange ^M characters. Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here: What is ...