vim (Vi IMproved) is a text editor supporting different editing modes.
0
votes
2answers
22 views
Vim: Substitute based on another match in the line
I have rather large files in which I need to substitute NX for N1 but only if the line already contains NX as a pattern. So far I do it manually by first searching for occurrences of NX with:
/NX
...
0
votes
0answers
11 views
Glitch with auto chmod line in .vimrc
I found a useful line for my .vimrc file from here that makes any file beginning with #! on line 1 executable when I save it. Here's the line:
au BufWritePost * if getline(1) =~ "^#!" | silent !chmod ...
0
votes
1answer
15 views
VIM switching between split buffers
i tried to split a vim in 2 buffers with 2 different files
vim file1.txt
:sp file2.txt
but ctrl + w is not working to switch between them.
giving below error
E486: Pattern not found: ...
2
votes
2answers
42 views
cat command in shell does not terminate on receving EOT through serial port
I have shell/perl script which kicks off cat commands to receive incoming serial data from n external device.
The external device is designed to send to send a EOT character when it's done ...
1
vote
1answer
42 views
I'd like to run a few terminal commands from inside vim
There are two common things I do when I code something. I either open that file in the browser or run it in node. So I'd like to create a couple of shortcuts inside vim to that effect.
I'd like F5 to ...
1
vote
1answer
33 views
Vim keep showing error message about color scheme for no reason
Error detected while processing /usr/share/vim/vim74/syntax/synload.vim
line 19:
E185: Cannot find color scheme 'MyColor'
Those lines of errors keep yelling about cannot find color scheme. But, ...
0
votes
0answers
17 views
Where can I find good vim synonym-antonym dictionary?
Today I learnt that by using CTRL-X CTRL-T I can find a related word of current word from vim Thesaurus dictionary, which is amazing to me.
I used the famous moby thesaurus from ...
0
votes
1answer
22 views
Where can I find a reference/tutorial for all vim7.4 bulit-in functions? [closed]
Recently, I found Vim has its own functions.
This trick I learnt online helps me solved a index-number change problem:
:s/\d\+/\=submatch(0) + 1/
Which I'm sure that submatch() is a vim internal ...
3
votes
1answer
18 views
vipe misbehaving on bash process substitution
I have the following simple command:
$ echo <(vipe)
I expected it to open a vim buffer, which I can edit, then when I'm done, echo the name of the temporary file assigned to hold the vim buffer ...
1
vote
0answers
26 views
Is there a way to share vim command history? [migrated]
By that I mean what people do in bash this way:
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
That is, when I run a command echo test1 in one shell, and then press Up ...
2
votes
0answers
26 views
vim arrow keys insert mode mapping
I want to move the cursor without using arrow keys in insert mode too. I've tried the following:
:imap <A-h> <Left>
but after moving cursor left by Alt-H from insert mode I get back to ...
1
vote
1answer
33 views
Complete language abbreviation list for vim's `set spelllang` option?
I'm starting using vim's spell check function today. But seems it treat Chinese characters as wrong spell word.
Thus I did a little research, and find I should use set spelllang=X option.
But the ...
2
votes
1answer
40 views
Can I re-login a disconnected session? [duplicate]
For some network reasons, my previous SSH sessions to server have disconnected. When I create a new session, I find the previous session still exist:
[root@localhost ~]# who
root pts/0 ...
1
vote
1answer
21 views
Search in vim for string starting and ending with a pattern
Let's say I want to highlight/search all the lines in a file opened with vim with following criteria.
Criteria: Lines which start with "start123" and end with "321end". There could be anything ...
8
votes
3answers
647 views
How can I search in vim for a pattern that is NOT case sensitive?
I occasionally search through files in vim or less using / or ? but as far as I can tell, the search patterns are case sensitive.
So for example, /foo won't find the same things that /FOO will. Is ...
-1
votes
3answers
77 views
How to toggle between vim buffer and command shell screen in vim?
I find it annoying to constantly press Ctrl-Z and then fg to go between these screens (where command terminal is the command line that you used to invoke vim from). It also generates unwanted fg ...
2
votes
2answers
57 views
vim: how to trace back all changes done to file during the day
Does anybody know how to setup vim (the text editor) in such a way to make it possible to trace back all the changes done to a file within a day? I need it for the cases when I have accidentially ...
3
votes
3answers
81 views
Vim want to write on a block
I have this file
dvb-apps:
dvb-apps:
dvb-apps:
dvb-apps:
dvb-apps:
dvb-apps:
dvb-apps:
dvb-apps:
dvb-apps:
dvb-apps:
dvb-apps:
~ ...
1
vote
2answers
42 views
Vim VM-created .swp file exists and Vim ignores it
I have a file open in Vim inside a Linux virtual machine guest and I then try to open the file on the Windows host, and I do not get that warning that goes "Swap file blah.swp already exists!" (The ...
0
votes
1answer
11 views
How to assign Vim's showbreak a value locally to a buffer?
How can I assign showbreak a value locally to a buffer? The following makes it +++ for all buffers.
let &showbreak="+++"
I can set Vim options locally to a buffer by using setlocal instead of ...
2
votes
2answers
44 views
vim: using a for-loop-iterator-variable in a search pattern
I am trying to use a for loop iterator variable in a vim search pattern to determine for a range of words how man times they occur in a file. What I do so far is:
for i in range(1,40) | %s/SiTg//gn | ...
0
votes
1answer
19 views
Why these two vim autocmd overlap each other?
I got these two autocmd config in my .vimrc
autocmd FileType python highlight OverLength ctermbg=red ctermfg=white guibg=red
autocmd FileType python match OverLength /\%80v.\+/
autocmd FileType ...
0
votes
2answers
19 views
How to use variables in substitution with vim regular expressions
I have a big file that contains among others serveral lines of the following form:
USet07-1
USet07-2
USet08-1
USet08-2
.
.
.
USet22-2
.
.
.
I want to remove the hyphen/dash - from these strings in ...
0
votes
1answer
29 views
How can I get vim to return to normal tab display?
In an effort to get vim to show vertical indentation lines I ran the following command:
:set list lcs=tab:\|\
Now my tabs look like this:
How can I reset vim to default behaviour of not ...
1
vote
1answer
13 views
Is it able to only allow yanked content went to clipboard, meanwhile deleted content doesn't? [vim]
I got set clipboard=unnamed in my vimrc.
Thus I can move vim's content to clipboard easily.
But recently, I found I don't need the deleted content(with d, x, etc.) went to sys-clipboard,
since it ...
2
votes
1answer
32 views
Using inotifywait along with vim
I have simple script that monitors file for changes and rsyncs it with remote copy:
#!/bin/bash
while inotifywait -e close_write somefile
do
rsync somefile [email protected]:./somefile
done
It ...
0
votes
0answers
47 views
How to stop vim from inserting a new line when entering insert mode
Vim inserts a new line when entering insert mode. Obviously I find this frustrating. It happens in remote servers and locally on OSX in iTerm2.
Here's my .vimrc:
" Use the monokai theme
set ...
0
votes
1answer
35 views
editing very long line, many columns in vim
I need to edit a file having columns and need help
1 0 0 0 1 1 0 0 1 1 1 1
1 1 0 1 0 0 0 ...
-1
votes
0answers
33 views
Pattern Match using vim script
I am trying to execute the following pattern match using the vim script.
execute "?".add[0]
Here add[0] is the pattern. But I have to press an enter after pressing the function key which is ...
0
votes
1answer
20 views
How to find the name of the buffer files in vim?
How do I find out the name of the files in the buffers in vim.Is there any command that returns the name of the file?
2
votes
2answers
20 views
Why in vim is the first operand in move (m) 1-based and the last operand 0-based?
Given the following file
1
2
3
4
5
When I say :1m3
the file looks like this
2
3
1
4
5
But when I say :3m1 it looks like this
1
3
2
4
5
I thought the 3 should be before 1. Why is it like ...
1
vote
1answer
19 views
Installing vim locally on a cluster: can't find syntax
Unfortunately, the school I currently work at has one of the wonkiest, worst-configured clusters I've ever used. And the IT department is totally incompetent and blames the users for basic issues. ...
1
vote
0answers
24 views
Neocomplete conflict with auto line-breaking in vim
I've found a conflict between automatic line breaks in vim and the neocomplete Vundle plugin. When neocomplete is off, then my set textwidth=80 option works correctly in that the a line break is ...
2
votes
3answers
107 views
How to select text with mouse scrolling in vim?
Sometimes I want to copy some content on remote host in vim, which will last for more than 1 page. But when clicked with left-click-button of mouse, and scrolling down, I find I was stuck at the first ...
1
vote
1answer
42 views
Vim auto line-breaking not working as expected (update: problem with neocomplete)
I'm trying to configure vim so that the text breaks automatically at 80 characters. I know the way to do this is with
set textwidth=80
However, the lines don't automatically break when I typed ...
0
votes
0answers
18 views
Syntastic, Vim & Android: get them play well together
I've got a problem configuring my development environment for android.
I'm migrating away from Android Studio due to continious issues that I have no desire to solve anymore.
I'm a long-time VIM ...
0
votes
2answers
26 views
Is there a sudoedit equivalent for vimdiff?
I'm trying to get into the habit of editing root-owned files with sudoedit, instead of sudo vim. This has a few advantages, one of which is that it uses my user's ~/.vimrc.
Is there an equivalent, ...
0
votes
1answer
47 views
Unable to install vim plugins
I am unable to install any vim plugins on nixOS
running the command:
nix-env -i vimplugin-Syntastic
gives these as the last 3 lines of output:
output path ...
0
votes
2answers
44 views
How to weave the words of a string into a block of strings in vim?
Given a string and a block of strings e.g.
String:
Use three words.
Block:
This is the first string of another block of strings.
This is the second string of another block of strings.
This is the ...
1
vote
1answer
38 views
How can I have my .vimrc detect what OS I'm using?
Since I upgraded my Ubuntu to version 14 I've had a lot of problems with sharing my .vimrc file between Ubuntu and OSX.
The following commands no longer work and in fact gives errors:
set filetype ...
1
vote
0answers
29 views
visual mode/highlighting/selecting text on uzbl?
Is there a way to do a vim-like visual mode to select text with uzbl? Or any way to select text in uzbl with the keyboard? I installed arch-linux recently, and I haven't gotten my touchpad working. ...
1
vote
2answers
39 views
`Delete` key doesn't work on vim insert mode for deleting previously typed content
I opened vim in my iterm2. Firstly, I typed something on insert mode, like
Hello
At this stage, if I didn't exit from insert mode, delete key works and can delete the whole word if I want.
If I ...
0
votes
1answer
21 views
vim: found /var/log or similar
On vim for search an exact word i type
/\<port\>
in this case it return every occurence of port
,how to found /var/adm or /var/log entries?
I have tried
/\<\/var/\adm/>
but no ...
0
votes
0answers
31 views
How to generete allegro5 tags for vim with ctags?
I was recently working on project with GTK2 in vim (with OmniCppComplete plugin). so I generated tags with
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --sort=yes /usr/include/gkt-2.0/
I did so ...
2
votes
2answers
47 views
Set default permissions by file type (at least in Vim) [duplicate]
When I create a new script, I always have to manually add executable permissions with chmod +x foo.sh. My default permissions are set to 644, and but I'd like any file with extensions like .sh .py to ...
2
votes
1answer
33 views
Yank all function declarations
Something I often have to do is make sure I have prototypes for all my functions in my C code at the top of file. What would be a way to quickly select all the function declarations in a .c file using ...
0
votes
1answer
58 views
Run a Vim command from a bash script
This is related to a question I asked earlier but I would like to keep it separate in case anyone else can find use in it.
I have a command that I am running on a file called dummy.out from the ...
2
votes
2answers
63 views
Bash Scripting VIM commands
I have a few files that I have an annoyingly repetitive group of VIM commands to apply to.
They are basic VIM commands just to delete some lines which are not supported by the process I need the files ...
1
vote
1answer
35 views
What does >… mean in vim and how to substitute a single whitespace for it?
I know that when :set list is used whitespace is shown as .. But what does it mean when a whitespace symbol is preceded by >, e.g. >., >.., or >...?
And how do I remove it and leave only ...
0
votes
1answer
16 views
vim color changing between | |
I'm editing some rst files. In the math section, the color changes between | |. Why is this so? How can I change my rst.vim file to not change color between | |?
Thank you in advance.