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

learn more… | top users | synonyms

3
votes
2answers
51 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 ...
0
votes
1answer
16 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 ...
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
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
463 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 . . ...
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. ...
4
votes
1answer
31 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 ...
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 ...
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-...
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 ...
3
votes
2answers
43 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
614 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? ...
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
63 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 ...
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! ...
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 ...
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.
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)...
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/...
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 ...
1
vote
1answer
65 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
2answers
54 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
40 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)...
1
vote
1answer
36 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
43 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 ...
0
votes
2answers
31 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?
2
votes
1answer
46 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+...
1
vote
0answers
72 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
104 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 ...
20
votes
4answers
1k views

How to invoke vim editor and pipe output to bash

Sometimes I need to write text and then pipe that text into another command. My usual workflow goes something like this: vim # I edit and save my file as file.txt cat file.txt | pandoc -o file.pdf # ...
0
votes
0answers
16 views

urxvt, vim and X clipboard [duplicate]

I would like to setup my rxvt-unicode with the following behavior Be able to paste primary clipboard with the keyboard (whatever combination is normally used) Copy selected text to primary clipboard ...
1
vote
1answer
99 views

zsh fails at path completition when command is vim

When I try to autocomplete files (with vim as argument 0): vim ~/.conf <TAB> It shows: _arguments:450: _vim_files: function definition file not found _arguments:450: _vim_files: function ...
19
votes
3answers
1k views

In Vim , how can I copy from several lines? (not a range);

Assume I have 1 - funct1 2- funct 2 3 - funct 3 4 line 4 how can I copy line 1 and 3 (not a range of lines) and paste them, for example at line 8? If I do this in way with | arg like ( 1y|3y), I ...
2
votes
3answers
195 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: :% ...
1
vote
1answer
53 views

Why vim is pasting 50 lines instead of 96?

I had a file of 96 lines i selected all lines and paste with vim in new file but..paste only first 50 lines. What to check? I see this only on newest version of vim on slackware-current,the old 14.1 ...
3
votes
2answers
27 views

How do I prevent vim from automatically editing my input?

Sometimes I copy/paste from one .cpp to another in vim, and vim, confident that it knows what I want to do better than me, edits my entry. For example, if I copy/paste this: // A comment. Some(code); ...
0
votes
1answer
48 views

Vim saved file not updating on webpage

I am attempting to update an HTML file on my server, but when I do so it doesn't appear to be updating, but rather, serves an old copy instead. I went through the usual process of pressing :w and ...
2
votes
1answer
55 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 ...
2
votes
1answer
57 views

Using accents in Vim seamlessly

Very often I need to write text/program in foreign languages that need accents and special characters in vim, but sometimes it is very hard to get that working. What are the best alternatives to ...
0
votes
1answer
47 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
0answers
31 views

Send-keys across tmux panes in vim in Cygwin is painfully slow

I am using vimux or vim-tbone to send code to an interpreter in another pane. It works fine with any shell, but I can't get it to work properly in windows. I can't have a VM, so I use cygwin at work ...
7
votes
1answer
94 views

What is the historical origin of CTRL + P for up and CTRL + N for down?

I am a moderately experienced vim user, who is now beginning to use GNU emacs. At about the same time as I learned that Ctrl-p and Ctrl-n are the default for up and down in emacs, I also learned they ...
3
votes
0answers
23 views

Open multiple files from ranger in vim

When I highlight multiple files in ranger from the same dir, I can open them all in vim with r and than 0 or @ and than add vim. But if I highlight files from different dirs, than this doesn't work. ...
1
vote
1answer
28 views

ack executed through vim

I am trying to execute ack from vim. But for some reason vim decides to stop after executing ack. How can I stop vim from stopping? (on some systems what I call ack is called ack-grep) What I am ...
0
votes
0answers
22 views

How do I add a vim configuration to a user who is restricted to a specific directory?

So basically, I have created a user that only has access to a specific folder with: useradd --home /some/dir username Now what I would like to do is add my vim configuration to this user's "home" ...
0
votes
1answer
86 views

problem editing utf8 text file with vim

I have a problem editing a html file on a server via vim. The file is utf-8 encoded. While editing with vim (v7.3, no plugins active) I can see umlauts and editing and saving a line before the umlaut ...