vim (Vi IMproved) is a text editor supporting different editing modes.
7
votes
4answers
254 views
How am I supposed to edit files on a network with Vim?
Currently I'm doing it by SSHing into a server, and executing Vim on the server. This has the benefit of not having to deal with cumbersome syntax of opening files from a remote server over SCP, and, ...
1
vote
1answer
24 views
How to Replace Path in Search field using VIM
I'm trying to replace this text in VIM
Actual Path /home/omipenguin/Servers\ Information/systemscript.sh/sysinfo.txt
with this new path
/home/sysinfo
I tried
%s/\/home\/omipenguin\/Servers\ ...
1
vote
1answer
44 views
Rewriting lines from the ending
I want to read a file and write its lines from the ending (which means that I want to replace the first line with the last line, the second line with the penultimate line and so on) just by using VIM ...
4
votes
1answer
34 views
Idle terminal safe character
I'm using iTerm2 on a Mac to do Linux work. In order to avoid losing terminal connections, I turned on "When idle, sent Ascii code". The default is 0. This works like a charm to keep connections ...
5
votes
2answers
64 views
Lowercase all but the first (Uppercase) letter from UPPERCASE in cyrillic
To make all letters a lower case except the first letter. The first letter would look like "Uppercase" after I changed (from UPPERCASE in cyrillic). The rest (not UPPERCASED) leave unchanged.
I'm ...
2
votes
2answers
31 views
Setting programming font in RHEL 5 + gvim
I am working on RedHat RHEL5. I want to change the font in GVIM.
The only font format that my GVIM accepts is
*-courier-medium-r-normal-*-*-140-*-*-m-*-*
It refuses to use Courier\ New or ...
2
votes
1answer
29 views
How can I set check interval for set autoread option in VIM
How can I set check interval for set autoread option in VIM? Is it possible?
1
vote
1answer
27 views
Vim key binding to cycle through windows
How do I bind one single key to cycle through the windows? For example, each time I want to switch a window, I have to click ctrl-a (default was ctrl-c) then use arrow key up/down/left/right to ...
4
votes
2answers
40 views
How can I use caps lock to change language in VIM
Can I use capslock for changing languages in VIM instead of Ctrl + 6 in case of "keymap=russian-jcukenwin"?
How can I do it?
Maybe something like mapping it in the $VIMRC file? How can I map ...
1
vote
1answer
80 views
How can I select all copy from vim and paste to other program e.g. mail client?
How can I do the following?
Copy all text from vim and paste it to an external program e.g. mail Outlook? I tried +y and gg*yG but the paste does not work.
1
vote
1answer
28 views
vim flag to append a line and save
I'm trying to mock an editor as part of writing feature tests for a CLI that I'm working on. I need to mock an editor which is opened and quit directly without saving, as well as an editor which ...
38
votes
7answers
3k views
Exit vim more quickly
I use Vim mainly for quick edits rather than long work sessions. In that sense, I find the keyboard sequence for quitting especially laborious: Esc, Shift + ;, w, q, Enter.
How to quit Vim (possibly ...
1
vote
2answers
44 views
gvim on RHEL (Red Hat Enterprise Linux) install in home directory
How to install gvim on a RHEL server that doesn't have it (for use with SSH with X11 forwarding*)? No sudo access is available, so it has to be in the user's home directory.
*Getting all the ...
0
votes
1answer
45 views
(g)vim - NerdTree and tagbar above each other left to edited file?
Any chance to get (g)vim displaying NerdTree and tagbar above each other left to edited file?
+-----------+-------------+
| nerd tree | edited file |
| contents | |
+-----------+ ...
1
vote
1answer
28 views
Can vim warn on a tabpagemax overflow?
If I open a collection of files in vim tabs using a glob pattern, I'd like to be warned if the number of files matching the pattern exceeds the value of tabpagemax. For example, if the following,
$ ...
5
votes
2answers
64 views
Carriage return vs newline in vim
In vim, when I opened a file, I wanted to add two empty lines at the end of each current line. I used the following switch:
%s/$/\n\n/
Apparently, this does not work, but what does work is:
...
4
votes
2answers
79 views
VIM substitute occurrences of pattern after a particular word in a line
I have such lines in my text.
text before pattern = garbage** text after pattern is pattern
If in VIM I do %s/pattern/saturn/ it replaces all occurrences of pattern. But I only want to replace ...
1
vote
3answers
127 views
less command and syntax highlighting
I need to use the less command with the syntax highlighting of the vim command for python, C, bash and other languages.
How do I apply syntax highlighting colors according to vim colors for less ...
3
votes
2answers
91 views
Sudoedit Vim force write (update) without quit
I'm doing some scripting with Vim and I've just started using sudoedit.
Problem is, when I :w it writes to the temp file, so any testing of the script can't happen unless I quit the editor.
How can ...
1
vote
1answer
52 views
Managing multiple Vims (vim and MacVim)
My machine came with Vim 7.3 and I just installed MacVim 7.4, so now I'm juggling both and I'm not sure how to manage the two. I'm plagued by questions like:
Should I remove the older version?
Where ...
3
votes
3answers
82 views
vim search numbers containing specific number of digits
I need to find specific length numbers in a big document. I tried to use regex for this. For example, If I need to search for numbers with exactly 2 digits, I use /d/d (i.e. /d twice followed by a ...
2
votes
1answer
51 views
How to insert both vimscript variable and string into vim search and replace
I've only just found out about Vimscript's existence as of today, so forgive me if this question is more basic than it seems, but I've been struggling to find an answer to this question for the better ...
0
votes
2answers
37 views
Vim: searching upward/downward in file from specific point/position
I want to search a word from my current cursor position in vim to upward in file.
How to achieve this?
Also how to do same for downward in file.
2
votes
2answers
49 views
Vim autocomplete to include punctuation between words
I'm currently programming in Tcl/Tk. I have some widgets called .entry,stdin and .entry,stdout and I'm using supertab for autocompletion. The comma is there because I'm using a package called gridplus ...
2
votes
2answers
49 views
Vim alerts after a few seconds when no event occurred
I use Vim in a tmux session, and recently I've noticed that Vim is raising an alert after a few seconds when I switch to another tmux window. Nothing has happened in Vim after I move windows - usually ...
10
votes
5answers
280 views
vim - better coloring so comments aren't in such hard-to-read dark blue?
Mostly I edit ruby files, although shell script file comments are also #
Currently my comments show as dark blue on black which is really hard to read.
See screenshot.
How can I change their color?
...
4
votes
3answers
59 views
vim - how can i do a 'change word' using the current paste buffer
I have some text in my paste buffer, e.g. I did a yw (yank word) and now I have 'foo' in my buffer.
I now go to the word 'bar' and I want to replace it with my paste buffer.
To replace the text ...
3
votes
2answers
39 views
Make vim open files as nomodifiable, under certain conditions
How can I make open files as readonly and nomodifiable, if they're in a certain folder hierarchy, but do NOT contain a certain extension?
For example, if I open files on /server/(production|uat)/* I ...
2
votes
1answer
138 views
Use of ! in VIM
I have seen that sometimes :q works but sometimes we have to use :q!. This is the case for many commands. I was wondering what is the general use of ! in vim and when to use it. I tried to google ...
1
vote
4answers
51 views
Exracting fields in file and storing it in different file in vim
I have file int the following format:
.
.
.
Name:abc
Occupation:def
.
.
Name:xyz
Occupation:ghi
.
.
I want to extract the name and occupation field and save it in another file out.txt ...
2
votes
0answers
46 views
Tmux is not able to distinguish between insert and shift-insert
Insert when in xterm, gives ^[[2~ and,
Shift+Insert gives ^[[2;1~
All this is good until I start tmux.
Note that the $TERM variable remains the same, so this issue should not be related to ...
0
votes
1answer
39 views
is there a vim shortcut or can I create one for 'tabe other_file'
When possible I create 1 or 2 letter abbreviations for aliases and the like, e.g. x for exit or p for pwd at the command line.
When using vim and doing multiple tabs for different files (which I can ...
3
votes
1answer
83 views
TERM=(linux|xterm) vi in an xterm or the AAABBBBBBCCDDD-problem
Usually when I want to run vim in a desktop konsole session, I make sure the TERM variable is set to linux as the arrow keys don't work in insert mode with TERM=xterm. They show capital A..D instead ...
5
votes
2answers
124 views
How to re-run vim auto-indentation on a tex file?
I have a LaTeX source file with its indentation messed up.
I am looking for a way to force vim (may be through one of vim-latex-suite commands) to re-run the automatic indentation commands over the ...
4
votes
1answer
66 views
How can I jump to files from vim opening them in a separate tab?
I have installed tags so I can jump to a function body in another file via CTRL + ]
I know that I can do gf to jump to another file.
I know that I can do CTRL-w s to split the vim window.
What I don't ...
1
vote
4answers
43 views
Pasting with spaces added into heads of lines (analogy to comment-chars)?
Please, consider a situation, where you find a nice example and want to copy it to your existing code to see, how it works.
The indentation is almost never right right away. If there are several ...
2
votes
1answer
56 views
Vim gg=G (reindent whole file) without losing current position
Recently my main work was editing .xml files. Google told me that for re-indenting a file I need to press gg=G in normal. But moving to gg is something that I don't want. Is there any way to do the ...
1
vote
1answer
49 views
Deleting Word text-objects in VIM
In the expression (word (first-Word second-Word)) on typing diW with the cursor on f, I get (word second-Word)) when I would like just the Word first-Word deleted. On typing diW with the cursor on s ...
1
vote
3answers
62 views
Applying a change to every line?
How to add 4 spaces to every line between marks (bound with m-letter and current line). How to do the same when using visual block?
1
vote
1answer
51 views
vim regex to search for lines containing string1 AND string2
How in vim/vi can I search for all lines that contain string1 and string2, where either string can appear anywhere on the line separated by whitespace and possibly other words?
I would also like to ...
3
votes
2answers
88 views
How to switch to editing command in text editor [duplicate]
When typing a complicated command that started on the command line in Bash, how do I switch to editing it with ViM?
3
votes
2answers
77 views
How can I create my own spelling file for vim?
At the moment I'm writing a document where need to use a lot of acronyms, technical language, and non German words.
Now I was thinking if I could create a spelling file (tech_speak) which checks for ...
6
votes
3answers
192 views
Looking for a centred, full-screen terminal
There exist out there several different 'distraction-free editors' for writing: these provide a fullscreen, minimal environment with the goal of forcing oneself to focus on the task at hand.
I want ...
3
votes
2answers
164 views
What is meant by a shell is in “vi” mode or “emacs” mode?
This question follows directly from the answer to one of my previous questions here. I am newbie to unix world and this site has helped a lot to understand some core concepts. In this case I am ...
2
votes
1answer
53 views
Counting number of lines I type in vim
I want to track number of lines I write everyday. I want that count to be visible on vim status line.
It should look something like [# lines today | # lines since the beginning].
A log file that ...
1
vote
1answer
135 views
syntax highlighting in vim over ssh
When I ssh from work to the local network, I can turn syntax on in my vim instance and it works. When I go home and ssh in, I turn on syntax highlighting and nothing happens. While at home, if I use ...
4
votes
7answers
267 views
Uncommenting multiple lines of code, specified by line numbers, using vi or vim
I have learned from this Stack Overflow question that it is possible to use vi/vim to comment out a specified range of line numbers. For example, suppose I have the following bash script:
...
0
votes
1answer
20 views
Disabling/enabling language specific mappings in Vim
I have :set keymap=russian-jcukenwin.
In this keyboard mapping ` maps to ё. I want to unmap this backtick.
:lmap `
l ` *@ё
:lunmap `
E31: No such mapping
Why lunmap ` gives an error? ...
0
votes
0answers
73 views
Why is this copy/paste in vim configuration not working properly?
I have the following in my .vimrc
vmap <C-c> y
imap <C-p> <esc>P
So that I can do my classic sortcut for copy/paste. It works fine on Cygwin but not in my ssh session to ...
10
votes
5answers
497 views
VIM commenting out what I paste
I got this when trying to copy this gist on vim: https://gist.github.com/w0ng/3278077
I notice the same behaviour everywhere: If I paste something that includes a comment, everything that follows ...