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

learn more… | top users | synonyms

2
votes
1answer
638 views

bash script - supervisor program

I have to write a shell-script that have to do the following tasks: -in every 5 seconds it saves:     -how many users are using joe and/or vi;     -if ...
1
vote
1answer
184 views

Wildmenu “closes” when opening a single item directory

TLDR; I want to open wildmenu with <Tab> and keep it open until I open a file. Suppose that I have the following directory structure: ./file1 ./file2 ./dir1/file3 ./dir1/dir2/file4 ./dir1/...
5
votes
2answers
5k views

Change colors in console/virtual terminal

Is there a way to alter all the available colors in console / virtual terminal? By console, I mean what you get after pressing CTRL + ALT + F1 and not anything like xterm or urxvt. So, I guess that ...
42
votes
3answers
43k 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
1k views

VIM: Display Hex Code Inline

I would like to have hex codes been displayed inline, no matter what filetype is activated in the current session. So far I've found something existent and suitable for my needs: https://github.com/...
6
votes
1answer
3k views

vi[m] read range of lines from another file

On Linux, editing file_B in vim I want to add line 10-25 from file_A. Example: One has a whole set of HTML-Documents with quite the same header and yes, one could create a template and start from ...
1
vote
1answer
62 views

How can I hook functionality to the “go to line”-command in Vim?

I just got the idea that I wanted to make it so that Vim centered around a line when I jump to it. Is there a way to make zz be executed automatically after I have called the colon command followed ...
2
votes
2answers
2k views

How do I set vim as the default editor when I sudo?

I'm working on a CentOS 5.9 machine, and I simply want to type sudo vi somefile and have my trusty vim with syntax highlighting, etc. This seems simple enough, but after many attempts, it's ...
5
votes
1answer
7k views

How do I highlight the current line and the cursor in .vimrc?

I am trying to highlight the current line as well as the cursor position in Vim. Here's my .vimrc: set cursorline hi CursorLine ctermbg=8 ctermfg=15 "8 = dark gray, 15 = white hi Cursor ctermbg=15 ...
0
votes
1answer
494 views

Why is vim offering me spelling suggestions instead of using the completefunc?

I am trying to set up vim for writing email. I have a plugin to provide autocompletion of email addresses (notmuch abook ). If I do :set completefunc it tells me it is CompleteAddressBook as expected....
1
vote
1answer
282 views

Comment the if statement and the matching endif keyword

In vim, I can find the matching if statement and prepend the appropriate comment symbol. (e.g. %s/.alarm./#\0/g), but then I am left with dangling endifs that I have to find manually. I could simplify ...
1
vote
1answer
27 views

Is it possible to affect the behavior of all vim commands in normal mode?

Is there a way to affect the behavior of all vim normal-mode commands? Say, after every command succeeds, I want to trigger some post-behavior.
2
votes
2answers
314 views

Live diff-mode editing in vim

I want a live view of diffs while I am editing a file. vimdiff is able to do something I want, like highlighting the differences between two files. However there are two drawbacks of vimdiff that ...
2
votes
3answers
639 views

Open multiple files in Vim with a filelist

I have a file 'filelist' that contains the following lines: text1.txt text2.txt text3.txt I am looking for a command line invocation that opens the 3 files in vim. I tried the following: $ cat ...
93
votes
2answers
48k views

Ctrl-s hang terminal emulator?

I came across a sentence in vimdoc: Note: CTRL-S does not work on all terminals and might block further input, use CTRL-Q to get going again. and this key indeed hangs my vim. I was ...
3
votes
1answer
4k views

Vim - how to increase each number in visual block?

I have the following SQL: update am.PERMISSIONS set PRM_ORDER = 35 PRM_VISIBLE = b'1' where PRM_ID = 3; update am.PERMISSIONS set PRM_ORDER = [35] PRM_VISIBLE = b'1' where PRM_ID = 7; update am....
2
votes
2answers
2k views

How do I set bash aliases and variables from within vim?

In cmdline mode, the following examples do not work for me. !alias lol='echo lol' !lol='echo lol'
2
votes
2answers
2k views

gvim colors the same as is the terminal

Is there a command I can put in the .vimrc to make gvim look like vim's setup in the terminal? Same back ground, syntax highlighting, colors, and font. To add to my question, is there a may for gvim ...
3
votes
1answer
330 views

Autocompletion of email addresses in vim

I'm playing around with various bits of an email solution, including notmuch and alot. I write my emails in vim and I'd like to have tab completion of email addresses while writing email. Is there a ...
1
vote
2answers
84 views

What are some ways to compare file type and encodings to resolve buggy grep…?

In this case I have a folder of .txt files I created using drag and copy and paste from Adobe Acrobat PDFs and Text Editor in OSX. I've been editing these files in vim. Now I'm using grep to find ...
2
votes
1answer
490 views

Is there a file menu plugin for vim (not gVim) that creates a text-based GUI menu system?

I'm curious to see if there are any plugins that create a menu inside vim (not gVim). Perhaps something simple like a menu bar at the top, with drop down menus that are drawn with text. EDIT: The ...
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
0answers
45 views

screen flashes when I press ^S in gvim

I bind ^S in gvim, by: map <C-S> :w<CR> Now if I press the ^S combination, althrough file is saved (I saw the XXX written message), but gvim window flashes, is there a way to avoid that?
2
votes
1answer
114 views

Convert table in LaTeX

I copy the table from Calc (or Tracker) In my research I know three ways: 1: Record a macro: @a0f cw & <ESC>;.;.I\hline <ESC>A \\ (the spaces count ;) ) And then VG:normal @a<...
2
votes
1answer
127 views

Vim :fold of python code not different to C/C++ code

When I enter the command :fold inside my python code in .py files, Vim inserts the /*{{{*/ and /*}}}*/ tags. They, of course, cannot be parsed by python interpreter. When I'm in python I would like ...
3
votes
1answer
91 views

Switching to edit mode in VIM rc?

Still related to the previous question, but switching mode with exe "a" doesn't seem to work, I still have to press the a button manually Here upon opening a newly created a file, a template is in ...
1
vote
1answer
71 views

Jump to the first position of text “<CURSOR>”

I'm using a file template directory for newly created files, autocmd! BufNewFile * silent! 0r ~/.vim/skel/tmpl.%:e Now I want to add another function, that move the cursor to somewhere (defined in ...
1
vote
3answers
1k views

No syntax highlighting when editing crontab

I am trying to figure out why I don't have syntax highlighting when editing my crontab. I have both $EDITOR and $VISUAL set to /usr/bin/vim: > echo $EDITOR /usr/bin/vim > echo $VISUAL /usr/bin/...
5
votes
3answers
3k views

Can't open syntax.vim error when using vimrc

When I try to open my .bashrc file. then it shows these lines: Errordetected while processing /etc/vimrc: line 45: E848: Can't open file /usr/share/vim/vim70/syntax/syntax.vim Press ENTER or type ...
5
votes
6answers
16k views

How to select complete file in vi, to be pasted in gedit?

I know that doing %y a will yank complete file into register a. However this doesn't help in pasting the file content in another text editor (say gedit). What alternative is there for doing so?
1
vote
2answers
61 views

Adding a line in vim adds it at the line after the cursor, I would like to insert

I have this keybinding in .vimrc: map + :put=''<cr> map - dd I find it really useful for fast layout and source file cleaning with + and -. But using :put=""<cr> adds a line after the ...
2
votes
2answers
478 views

Seeing scons file like python file in vim. File dependent properties

I know I can setf python and then the file is recognized as python. However I must redo this everytime I reload the scons file. I have read some weeks ago that one could write in the last lines of a ...
5
votes
2answers
4k views

exact match in regrex when using vim, man, or less

when using vim, man, or less, I want to do some exact match in regrex for example, when using man, I want to check the argument '-c' if I use /'-c' the matching could be -cim -covert.........
2
votes
3answers
103 views

Ctrl+W in vi[m] to erase to whitespace

I want to mimic the functionality of bash readline in vim. Is there an easy way to do that? Currently in vim Ctrl+W "cuts" from cursor back to special char or whitespace. ie. In bash Ctrl+W "cuts" ...
25
votes
2answers
32k views

How do I get the solarized colour scheme working with gnome-terminal, tmux and vim?

There's a lot of questions around this, but it's because there are so many variables. I had to piece together instructions from many sites before I got this working. First, I could not easily set up ...
1
vote
2answers
197 views

How can I load the right hand pane of vim with a new file in linux?

I want to compare two files(say A and B) side by side(vertically) in in Vim. I open one of those two files(say A) and as per this answer in this site issue a Ctrl+w v . Now both the panels are showing ...
6
votes
2answers
907 views

Remove all Vim undo files in all but one directory

I just realized that I have tons of Vim undo (.un~) files sprinkled around my file system. I'd like to delete all of these files except in one directory—~/.tmp. My first problem is that I can't seem ...
2
votes
1answer
66 views

Manipulate color in VIM

In hlsearch mode, seems that you can set only one color. Now I want to use a script to get multiple colors for multiple keywords, is that possible?
0
votes
1answer
338 views

Vim - Tabs in :o Show up as ^I and Autocomplete Does Not Function

The title basically says it all - in Vim, my tab's show up as ^I, and I'm wondering if anybody knows why this might be. This is especially annoying when using :o to open a file, as the autocomplete ...
0
votes
1answer
84 views

Select line not selecting whitespace

Is there a way to select (or paste) text without trailing/ending whitespace? eg. To copy the whole line I press y, to paste it somewhere else I use p, but it pastes the whole text with the trailing ...
0
votes
1answer
108 views

Automatically insert fold tags around visually selected text in vim

I have started to use set foldmethod=marker, because I find it more convenient to use rather than syntax. But it has the disadvantage of needing to write // {{{ my title and // }}} around any ...
4
votes
1answer
236 views

Different vim colorscheme depending on mode

I'm often doing the same mistake in vim: I forget whether I'm in insert or command mode, then I type in, I get random commands or I modify/delete code, and I have to undo. I do this mistake really ...
3
votes
2answers
105 views

Is there a way in vim to know I am in the left most split?

I want to detect whether or not I am in the right most (or left, top, bottommost) split. In other words, when ctrl-w h would do nothing. Is there a way to do that?
1
vote
1answer
1k views

vim install on freebsd has taken 5 hours and counting

Ok, so installed portmaster and I'm trying with it, I'm hoping it won't take time. So I've been up all night and my vim installation is still going on. I have an amazon ec2 freebsd server setup. I ...
4
votes
1answer
394 views

lsof doesn't return files open by the same user

Consider this simple scenario: I open a text file ~/textfile.txt with vim in one terminal (tried with both edit and read-only modes). In a different terminal, I run /usr/sbin/lsof ~/textfile.txt ...
0
votes
1answer
892 views

Changing color of tabs titles in vim color files

In my custom color.vim file there are multiples entries like these ones: :hi VertSplit gui=none cterm=reverse :hi Folded ctermfg=grey ctermbg=darkgrey :hi FoldColumn ctermfg=4 ctermbg=7 :hi IncSearch ...
2
votes
2answers
1k views

How do I get pkg_add to look in the correct directory on the remote ftp repository when installing vim?

I have a brand new clean installation of FreeBSD 9.1 on Virtualbox. Running pkg_add -r -v vim, the terminal runs an ftp script to: ftp://ftp.freebsd.org/pub/FreeBSD/pub/i386/packages-9.1-release/...
2
votes
2answers
846 views

.exrc file in home dir not effective

I made a simple .exrc vim config file in my home directory on RHEL 5.8. Here are the contents: set nu However, when I go into vim, the line number are not shown. It may be worth noting that I am ...
1
vote
4answers
95 views

Editors Nano/VIM not using resources

Does anyone here know the resources it takes for editors to search and replace in a large file? The reason I am asking, is I have a 32 core server that HTOP is only showing one core at 100% when ...
3
votes
3answers
312 views

File goes missing for a short period of time after saving it using VIM

I am having a strange problem that seams to be caused by VIM, the Linux VFS cache, ecryptfs and/or something file system related: I open a file in VIM, modify it and save it. I try to access the ...