vim (Vi IMproved) is a text editor supporting different editing modes.
3
votes
3answers
282 views
Persist clipboard contents in vi
If I want to copy text from a file in vi to another file, I have to highlight the text, Control-Shift-C it, quit the first file, open the second, and then paste it via Control-Shift-V. It feels like ...
3
votes
2answers
75 views
Shortcut for tabn & tabp in vim/vi
When I open several files using vim+tabf, switching across the files will involve using tabp & tabn.
Can I have a quicker way to do so?
3
votes
2answers
141 views
Open up many files in panes at once
When I need to edit multiple files, it's really a pain to have to open them one by one. Is there a way to open multiple files in VIM from the commandline?
3
votes
1answer
312 views
vim -N mode: where to use it?
I am following the Peepcode screencasts to learn vim.
The presenter mentions about the -N mode but doesn't elaborate it much and says that it should be the default mode.
My questions:
What is the ...
3
votes
2answers
923 views
Turning off splitting lines in vim
One of the most annoying features of vim is splitting lines. For some reasons someone found it would be good to split lines even in whitespace sensitive formats. For example changing:
echo ...
3
votes
2answers
232 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 ...
3
votes
5answers
385 views
vi - how to join differents specific lines
I'm looking for a solution about a "paste" problem on vi/vim .
How to join specific lines in a text file? I have a file like this:
15/10/2011 Revolution day
16/10/2011 About Rome
- differents ...
3
votes
3answers
286 views
Open another file with split windows, and switch between them
If I open vim with:
$ vim -o a.ext b.ext
I get a window that looks like this
+----------------------+
| a |
| |
| a.ext ---------------+
| b ...
3
votes
1answer
227 views
Select between given characters in vim
Given three sample lines:
some('lorem _ ipsum');
$some['lorem _ ipsum'];
<span class="some _ class">
(cursor is in _ position)
Which is the fastest way to select (for pasting in other ...
3
votes
2answers
829 views
Make sed ask for confirmation before each replacement?
Is there a way to make sed ask me for confirmation before each replace? Something similar to 'c' when using replace inside vim.
Does sed do this at all?
3
votes
1answer
38 views
What is the point of Virtual replace mode in Vim?
The help says that virtual replace mode commands in Vim gr & GR replace characters in screen estate and not in file.
:help Virtual-Replace-mode
I am understanding this as something like ...
3
votes
3answers
103 views
vi / vim - how to automatically strip trailing spaces on save?
Is there a .vimrc setting to automatically remove trailing whitespace when saving a file?
Ideally (to be safe) I would like to only have this functionality for certain files, e.g. *.rb
3
votes
1answer
47 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
...
3
votes
2answers
224 views
The key codes for Caps Lock, Shift, Left Control and FN key?
Can somebody please provide the key codes for these keys:
Caps Lock
Left Shift
Left Control
Option key
FN
The key code I'm talking about is something along the lines of \<Esc>[200~, although ...
3
votes
2answers
118 views
How to add a line in many files
I have many .html files and I need to add a meta tag after <head>'s start tag in each file.
How I can do that?
Can vim help me?
3
votes
2answers
140 views
Vimrc, map control-; to an action
How do I map holding down Ctrl and pressing ; in Vim?
It doesn't work on my Linux terminal. Ctrl-l works fine after putting <c-l> some_action in my vimrc, but <c-;> some_action does ...
3
votes
2answers
492 views
Copy & Paste over several files with vim?
Vim seems nice for most of the times and outperforms other editors in some categories. But what about Copy&Paste? (It seems to me that even MS DOS' EDIT.COM seems to outperform vim in this ...
3
votes
1answer
1k views
What packages are required to install vim on Fedora?
What RPM packages are required to install vim on a recent version of Fedora?
3
votes
1answer
3k views
Vim 7.3 with Lua: How do I use it?
The latest Vim release is awesome!
I compiled it with --enable-luainterp=yes and it does have the Lua feature:
% gvim --version | egrep '\+lua'
+linebreak +lispindent +listcmds +localmap +lua +menu ...
3
votes
1answer
38 views
Can I access X11's clipboard from tty1-6?
Sometimes, when I'm running on battery and don't need a window manager, I'll log into tty1, fire up fbterm and Vim and work. Later, if I need the window manager, I'll use the log in GUI but switch ...
3
votes
1answer
68 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 ...
3
votes
2answers
75 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 ...
3
votes
1answer
208 views
Only one file name allowed error
Sometimes I forget to do sudo vim and open files to which I don't have write permission. I saw this post and it was really helpful.
When I did :w !sudo tee % it asked me for a password and then the ...
3
votes
1answer
66 views
Vim mapping behaving strangely
I have the mapping shown below, in my ~/.vimrc. However, this mapping also hijacks the Enter key. So, whenever I hit Enter it executes the tabedit % command. I am using gvim 7.3
nnoremap <C-m> ...
3
votes
2answers
715 views
(G)VIM uses a different $PATH than my system
Because Ubuntu provides no up-to-date packages for TeXLive, I installed it manually. However, some programs need TeXLive as dependency. So what I did is I installed the TeXLive package from the Ubuntu ...
3
votes
3answers
166 views
What does . match?
In working with regular expressions, I have been told that a dot character . will match everything.
Except for newlines \n.
Are there any other exceptions? What about the NUL character \0, or the ...
3
votes
2answers
113 views
The right way to wrap block of lines in custom text in vim
I would like to be able to select several lines using vim when editing an HTML file, then enter some hotkey and get these lines wrapped in a django comment block.
For example, I have:
one line
...
3
votes
2answers
824 views
How to copy from one vim instance to another using registers
How can I select the + register? I have problems following the instructions below to copy/paste text from vim to another vim:
In the vim, highlight, select + register, and yank (save) to it:
Shift-v
...
3
votes
1answer
176 views
`man ascii` is misaligned when using vim as a pager
To use Vim as a pager for man I have
export MANPAGER="/usr/share/vim/vim73/macros/manpager.sh"
in my profile. Now man pages look very good with colors and stuff. However, when trying man ascii as a ...
3
votes
3answers
56 views
vi: backspace in insert mode not erasing characters
I am new to vi, actually I have started learning vi from today and I have got stuck at the behavior of the backspace key. Actually when I fired up vi on my Ubuntu 12.04 for the first time my backspace ...
3
votes
2answers
54 views
Vim - loop through files in cope
how can I lop through buffers in quickfix list :copen and make some actions with it.
Or any alternative way to put those files to args list and I can use argsdo.
3
votes
2answers
139 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 ...
3
votes
1answer
62 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 ...
3
votes
1answer
95 views
How to scroll large datafile while keeping header
Suppose I have some large datafile, which overflow the screen in both vertical and horizontal direction. How can I browse this file, while the header-lines stay on the screen?
For the moment, I am ...
3
votes
1answer
271 views
How to set the bash display to not show the vim text after exit?
My question is simple, but I am finding it hard to frame/explain it easily.
I log into several Unix boxes with different accounts. I see 2 different things for user1 and user2, while editing text ...
3
votes
1answer
169 views
Saving with CTRL-s in vim
I have added this line in .vimrc so that pressing control-s saves the current file
:nmap <C-s> :w!<cr>
:imap <C-s> <esc>:w!<cr>
But this is not working. Any ...
3
votes
1answer
157 views
Is there a Vim syntax file for ANSI-colored output of CLI apps?
I have quite a lot of Perl scripts which print colored output to the terminal, using Term::ANSIColor. This is the same as when a shell script does e.g.
echo -e '\e[1;31mError:\e[0m Your fault.'
...
3
votes
1answer
254 views
Vim high CPU usage upon opening JS files
Vim and especially Gvim stops responding and utilizes 100% of CPU upon opening big .js files (1000+ lines). Pressing Ctrlc stops the process. Whatever Vim does trying to open the file, it displays the ...
3
votes
1answer
183 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 ...
3
votes
1answer
719 views
vim is too slow when saving files
I run vi under Linux CentOS 5.3. Each time I exit from a file, I have to wait several seconds before vi saves the file. The same thing happens with vim.
I ran this command:
strace -odetails -ff -f ...
3
votes
2answers
3k views
How to map ALT key in .vimrc?
In order to be able add blank lines without going into insertion mode, I'm trying to map ALT-o and ALT-O to o<ESC> and o<ESC>
I've tried the following in my .vimrc
map <M-o> ...
3
votes
2answers
454 views
cursor position after pasting in vi / vim
One thing that has always bothered me in vi / vim:
If I "yank" (a.k.a. "copy") some text, then move to another place in the file and do a "paste", my cursor remains at the beginning of the text I ...
3
votes
2answers
48 views
vim shortcut to open a file under cursor in an already opened window
In vim you can open a file under the cursor by using the gf command.
One can also easily open that file in a new split window by hitting <c-w> f. This is a really nice and time saving feature. ...
3
votes
1answer
181 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 ...
3
votes
4answers
159 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 ...
3
votes
1answer
201 views
How to configure vim to interact with interactive command line shells?
From time to time I want to use vim as scratch pad for commands that I would like to send to a command line shell like psql (Postgres), ghci (Haskell programming language), octave ('calculator'), ...
3
votes
2answers
289 views
Ansi escape code in VIM
I have a log file with colored log entries, where colors are defined by ansi escape codes. When I display the file (using cat or more), terminal understands the ansi codes and logs are colorful. But I ...
3
votes
2answers
803 views
E763 with vim and spell checker
I want to add germand spell checking to vim. So I set
:set spl=de_de spell
then there is a dialogue, where I can create a directory called .vim/spell. And then there is another question where I can ...
3
votes
2answers
318 views
Avoid reformatting bullet lists with formatoptions+=a
I am using Vim with formatoptions +=a as described in Vim: word wrap for documents to format lines automatically while I write documents, expecially Markdown documents.
My problem is that Vim wants ...
3
votes
1answer
139 views
How does this vim command work `:g/#/+1t.`
I was playing vimgolf (very addictive by the way) and I can't understand one of the solutions to this challenge http://vimgolf.com/challenges/4d1a34ccfa85f32065000004
The challenge is to convert this ...



