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

learn more… | top users | synonyms

3
votes
5answers
1k 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
35 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
83 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 ...
2
votes
1answer
73 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
79 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
47 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
2answers
211 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 ...
4
votes
3answers
593 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
1k 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
49 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
108 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
484 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 ...
2
votes
3answers
95 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" ...
12
votes
2answers
8k 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
91 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
319 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
51 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
116 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
51 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
57 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
165 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 ...
2
votes
2answers
48 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
562 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 ...
3
votes
1answer
95 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
258 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
518 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: ...
1
vote
2answers
227 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
73 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
123 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 ...
0
votes
1answer
92 views

How to reload a file in vim?

Various editors like gedit detect if the file is changed and asks to reload it. Sometimes in vim when I got many files to edit, I sometimes end up opening same file in different tabs for quick look ...
3
votes
0answers
570 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 ...
1
vote
2answers
93 views

Cron creates vim process but does not display vim

Under MacOSX 10.8.2 I am able to run vim as follows in the bash shell: /usr/bin/vim -c "normal G" -c 'startinsert' ~/.journal If I put the exact same command in a script: #! /bin/bash export ...
2
votes
1answer
198 views

Launch R code from within vim-r-plugin as separate window instead of inside tmux/screen?

I use the vim-r-plugin to write R code in vim. It is a nice plugin and I love that the plugin lets me run code directly from within vim. However, the R prompt is opened in a console which is ...
1
vote
1answer
42 views

Replaced matched text in Vim with pattern

Here's a minimal example of what I'm trying to do. Start with: "this") "that") [hundreds of lines like this] End with: "this",&this) "that",&that) [hundreds of lines like this] I have gotten this ...
3
votes
4answers
161 views

What are some of the main differences between vim and vi?

What are a few of the main differences between vi and vim? Are there any significant keyboard shortcut differences, any features that one has that the other does not? Yes, I do know that I asked ...
3
votes
1answer
70 views

Is this crazy vim register voodoo (incrementing alpha registers) possible within a macro?

I have 4 lines. foo ["bar"] baz ["k"] daskhfkjhadsfj ["askfjhfjdsh"] dfjhafkjhfha ["skkksks"] I'd like to do a macro that takes the word and yanks it into a register, but I want the register to ...
6
votes
1answer
605 views

Rename current file in vim

Searching over net shows :f filename would rename the current file in vim. But executing this and later exiting vim, shows the new file with all the contents and also the old file is present with the ...
2
votes
1answer
141 views

In Vim, how can I automatically determine whether to use spaces or tabs for indentation?

Sometimes I edit others source code where the prevailing style is to use tabs. In this case, I want to keep the existing convention of using literal tabs. For files I create myself, and files that ...
9
votes
1answer
580 views

Vim: Making XML text “pretty”

Is there an easy way within vi to make your XML text "pretty"? For example: I want this.. <person> <name>Nick</name> <age>26</age> ...
0
votes
3answers
916 views

Kate vs VIM/Emacs regarding speed [closed]

I'm trying to learn C++ in school using a UNIX environment and our professor urges us to use VIM or Emacs because a GUI is disadvantageous for two reasons: Moving your hands off the keyboard and ...
3
votes
1answer
1k views

How to enable nano-like whitespace highlighting in vim?

nano has a useful bit of syntax highlighting that actually highlights whitespace (tabs and spaces), under two conditions: (1) the whitespace does not have a non-whitespace character between either the ...
6
votes
3answers
445 views

How can I open a file in VIM in readonly mode if it already has a swapfile?

When I use the command :e filename to open a file and this file is already opened by another vim instance, I get a prompt asking me if I want to open the file in read-only mode, edit anyway, recover, ...
3
votes
1answer
96 views

Why does insert-mode map “<F4>” unpredictably inserts itself or executes intended key strokes?

In Vim 7.3.1-762, mintty 1.1.2 (xterm), cygwin, Windows XP, the insert-mode map <F4> executes the intended key strokes at one time but inserts itself at another time. This undeterministic ...
3
votes
4answers
479 views

Utilize a different user's vimrc as well as vim folder

First of all, to prevent an X/Y Problem, I'll just state that what I really want is: Run vim as the root user. Instruct vim to use my nice pretty color scheme and all my plugins. Do all this without ...
0
votes
1answer
168 views

Write out without quitting in Vim?

I looked through the vim manual, and I could only find the commands for "write and quit" and "write (if edited) and quit". Is there a command for "write out without quitting", similar to ^o in nano?
1
vote
2answers
865 views

How to change variable color in vim solarized theme?

I have just installed solarized theme for vim from https://github.com/altercation/vim-colors-solarized But the problem for me is that the background stays black and I have the variable names in ...
18
votes
6answers
5k 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 a fair about of question use vi instead of ...
2
votes
1answer
611 views

Using CtrlP isn't giving very good results - am I using it wrong?

I was hoping that I could just type "job.php" and be directed to the job.php in my /lib/model/ folder, but I've mostly just get many other files returned: [No name] > ...
1
vote
1answer
263 views

Reload Vim highlight setting and colorscheme

If I change Vim's highlight setting, how do I "reload" it for colorschemes to take effect? So, in my case, I remove highlight's cursor line number— se hl-=N:CursorLineNr Changing highlight from— ...
3
votes
1answer
267 views

What does vim consider to be a word? [duplicate]

Possible Duplicate: Match word containing characters beyond a-zA-Z I do not understand vims definition of a word. From the help for the motion w (:h w): w [count] words forward. ...