All Questions

Filter by
Sorted by
Tagged with
20
votes
5answers
9k views

How do I prevent vim from hiding symbols in markdown and json?

This drives me crazy, I do :set ft=text To see something, otherwise all the links disappear in markdown and quotes in JSON. How do disable this once and for all?
5
votes
1answer
122 views

How do I jump back to the next-to-last insert position?

I can't find an easy solution to the following problem. Consider I'm in insert mode and I need to modify something in another point of the text. I exit insert mode and then move to the point I need ...
0
votes
2answers
898 views

Gvim cursor jumps all over the place

I have a problem with my cursor in gVim, this happens in both Normal and insert(Whenever I type fast) modes. When I move my cursor it seems that the cursor goes to a random position for a very short ...
0
votes
1answer
2k views

Executing a function on buffer enter and on buffer leave events?

I would like to execute a certain function every time I leave a buffer associated with C++, and another function every time I enter a C++ buffer. I came up with this so far: " Buffer Leave augroup ...
4
votes
1answer
4k views

Using vim-addon-manager

I just downloaded and installed vim-addon-manager using sudo apt-get install. I'm not sure what to do next, I entered vim-addon-manager at the bash prompt (Ubuntu 14.04). Here is the output: ~$ vim-...
1
vote
1answer
207 views

navigating multiple files - arguments and buffers

I've been learning vi (as an autodidact) for some weeks. Actually I'm not yet sure about if I'm using vi or vim (does the command vi open vim if vim is installed?). Now I'm trying to edite multiple ...
3
votes
1answer
262 views

Vimrc tries to execute command defined on leader

I'm trying to have something like this in my .vimrc: nnoremap <leader>has :w | ! reset; runhaskell % <cr> How ever, now it prompts an error when loading .vimrc and tells me: :! reset; ...
1
vote
1answer
202 views

Send one-liners from vim to R

As the title said, I would like to select and send to execute lines from my vim script to the statistical software package R (say an instance of it open in a different terminal). While there is a ...
1
vote
0answers
123 views

How to compare two positions in a buffer?

Suppose i've got two different positions in a buffer returned by getpos() function: p1 = getpos("v") p2 = getpos(".") Is there a simple or elegant way to find out which one is before the other in ...
1
vote
1answer
49 views

How to write the output of `:au` in a file

I am debugging a plugin, and to do so saving the output of au into either a file or a temporary buffer would help immensely. Is there a way?
8
votes
1answer
4k views

How to go to the next grep result?

I'm using grep to find function occurrences in a project. :grep "set_val" * Goes out of vim and outputs: code.py:68: self._device.set_val('Level', new_level) code.py:84: self._device....
3
votes
1answer
134 views

How to make :wa overwrite externally-changed files?

I've noticed that when I have several files open in Vim, and one of the files has been changed by an external program, :wa doesn't actually try to write into that file. OTOH, going to that file and ...
4
votes
1answer
86 views

Deleting to the begin of the line with d _

In Vim, v_ selects text from the current position to the actual begin of the line. Example: Test test Test te|st Now pressing v_ we get the selection: Test test [Test te]st From this I would ...
9
votes
1answer
1k views

Visual select current search result

I have hlsearch set, but it sometimes lulls me into thinking t hat I have the search term visually selected, and can just hit c to change it. The term searched for may not be an easy number of ...
5
votes
2answers
1k views

Where to map the Backspace key to better match touch-typing?

I'm VIM user for a few months now (life changing) but I have a small issue with the backspace key which is quite far from everything else (I already use CapsLock for the Esc key). Which mapping is ...
1
vote
1answer
309 views

Vim 7.4 hybrid number mode not working

I recently discovered that Vim 7.4 enables a hybrid number mode, such that if you do set nu and set rnu, you'll see the absolute line number of the current line and relative line numbers everywhere ...
1
vote
1answer
61 views

Embracing and debracing Greek passages

I need two commands: one to find all occurences of \gr{...} and remove the \gr{ and }, leaving the contents ..., which should work accross lines; and another to find all strings consisting of Greek ...
4
votes
2answers
345 views

How can I cancel reading a file into a buffer on BufReadPre?

In order to open PDFs using an external application, one can use the following script: augroup nonvim au! au BufRead *.pdf sil exe "!open " . shellescape(expand("<afile>")) | bd augroup ...
7
votes
1answer
245 views

What is a ^@ in vim?

I'm running a Vimscript that retrieves the result of a message and redirects it to a vimscript variable. When the contents of the vimscript variable are displayed, it has a ^@ in it. What does that ...
0
votes
2answers
812 views

How can I change/delete comments easily?

For commenting and uncommenting I now use the vim-commentary plugin, also the NERD commenter can be used as mentioned in: How to comment out a set of lines which are selected in visual mode? I would ...
5
votes
2answers
645 views

How to repeat the last command in Ex?

I've the file, like: name = foo # unknown number of lines ... features_exclude[rules_config][] = rule1 features_exclude[rules_config][] = rule2 features_exclude[rules_config][] = rule3 ...
3
votes
1answer
1k views

How to substitute the first occurrence across the whole file?

I've file in which there are some repeated parts and I want to get rid of the first occurrence. Normally I'd do %s/_exclude// to perform substitute for all lines, however I want to replace only the ...
5
votes
1answer
361 views

Make autoformating insert a line break instead of two spaces after full stop

I noticed that vi's auto format adds two spaces after a full stop. I wonder how this can be changed, i.e., insert just one space after a full stop, or even a line break. The application is in using a ...
2
votes
1answer
670 views

CTRL-A with visual mode not working

According to the Vim help, using g CTRL-A with visual mode should change several lines in A to that in B: A: 1. 1. 1. 1. B: 1. 2. 3. 4. In my Vim, the CTRL-A is working in ...
2
votes
1answer
455 views

Adjust syntax highlighting for region included with syn-include?

I have a terminal color scheme that makes the default highlighting settings for diffs relatively hard to read. To address this, I’ve added my own custom settings inside of ~/.vim/after/syntax/diff.vim:...
3
votes
1answer
996 views

How to use <Alt-Space> to open the window menu on Windows?

When I have to work on Windows I have the habit to reduce my windows with the key combo Alt-Space+u (Alt-Space will pop the window menu and u is the shortcut to minimize the window and may change ...
5
votes
2answers
238 views

Preventing ex commands from altering the screen

Sometimes ex commands have the useless side effect of jumping, probably to the last place they affected. Can this be prevented? I would prefer it if ex commands left my screen exactly the same as ...
5
votes
1answer
1k views

Why is `:highlight Cursor …` ignored?

My color scheme has: hi Cursor ctermfg=black ctermbg=red cterm=NONE This is confirmed using hi Curosr: Cursor xxx ctermfg=0 ctermbg=1 guifg=black guibg=orange However, I'm not ...
3
votes
1answer
1k views

Why is bash not interactive after setting &shell='/bin/bash -i'?

My vimrc sets the shell option: let &shell='/bin/bash -i' which I confirm using echo &shell The -i makes the shell interactive. I want to do this so that it runs ~/.bashrc, which contains ...
3
votes
0answers
83 views

Why did MacVim try to connect to Vimium server?

So, I have installed Vimium today, and when I first relaunched MacVim, my Little Snitch showed that it tried to connect to vimium.github.io, which it never did before. Why did it do that and how has ...
1
vote
2answers
451 views

How do I get matchit to work with '/>' (self-closed tags)?

I really like to jump from one <el> to the end of </el> with matchit. I am using it for jsx, but it does not seem to work if I have an element that is declared with />, does anybody ...
1
vote
1answer
114 views

ctrl+i loads older documents loaded in vim

I read that in order to navigate backwards in a jumplist. I could use ctrl+i. However I noticed that if i press that key combination extra times vim opens up files that were loaded in vim before. I am ...
1
vote
1answer
212 views

Some “local to window” settings are being reset in Vim [duplicate]

I added :set numberwidth=2 in my vimrc, but this value is always returned to 4 inside my windows. It seems I need to use some autocommand to always force this value back to 2. In fact, even more ...
2
votes
3answers
4k views

How do I turn Vi colors off in Ubuntu Linux 14.04

How do I turn vi colors off? I was using vim-tiny on on Ubuntu 14.04. Installed vim-nox. Version is version 7.4.52. Once I installed that, I got all these syntax colors by default. I have my Terminal ...
1
vote
1answer
135 views

Mapping C-O and C-S-O [duplicate]

I'm trying to remap C-o to be 'make new line below' (without going to insert mode, as opposed to o) and C-S-o 'make new line above' (without going to insert mode). I do this a lot when reformatting ...
4
votes
2answers
965 views

How to make an autocommand run for closing a window?

There is a (moderately complicated) way to make an autocommand that only runs when windows are created, but I want to have one for when they are removed as well. The reason is that whenever a window ...
10
votes
1answer
3k views

Mapping a command in Visual Mode results in error E481: No range alllowed

I'm trying to make a keyboard binding in Neovim that would send a selected block to the opened Neovim terminal. I've used these answers as guidelines https://vi.stackexchange.com/a/3390/3405 https://...
1
vote
2answers
189 views

How can I delete a quotation mark and comma at the end of every line?

Suppose I have the following text, how can I delete single quotation marks and comma in each line end? I know I can use x command and delete ' and , line by line. But are there any more clever way to ...
4
votes
1answer
129 views

What are the rules for “w” word motion when characters are not in iskeyword?

If I have a shell script with code like ... chars+=('5') chars+=('6') ... chars+=('%') chars+=('&') ... and iskeyword is defined as iskeyword=@,48-57,_,192-255,- This definition indicates to ...
0
votes
1answer
250 views

Vim remotely over SSH channel and see the MATLAB figures

I want to ssh into a Linux server from my macbook, and code Matlab, execute my Matlab code and see the figures that are produced by Matlab all through the one single SSH channel. I note that, I don't ...
7
votes
2answers
4k views

Can I use Vim with Visual Studio?

Is there any way I can use Vim with or Neovim to edit my project, and still be able to build it using Visual Studio? Note I am not talking about limited Vim emulators for Visual Studio but proper ...
2
votes
1answer
168 views

How can I print out the iskeyword characters?

When I use :set iskeyword? to view keyword characters, result for shell scripts is: iskeyword=@,48-57,_,192-255,- :h iskeyword says @ expands to any alpha character that the isalpha() functions ...
6
votes
1answer
1k views

How do I use a variable with an ex command?

I wrote a moderately complex routine for Vim and I need to programmatically set the height of windows. The way to do this is with :resize [N] as the help says. But my invocation didn't work until ...
3
votes
1answer
99 views

How to display the counts of lines in a git patch / hunk?

In git when patching you have to count: The "leave alone" lines The "remove" lines The "add" lines The "leave alone" + "add" lines I've found ways to count all of these... %s/^ / /n "leave alone" %...
2
votes
0answers
45 views

:mksession session file includes nonprintable characters

I have been having some problems using UltiSnips with vim. It seems that :mksession is adding a bunch of nonprintable characters to my session file(s). When this is sourced to restore my session, ...
12
votes
5answers
10k views

How do I get Vim to compile my .tex file when executing :w?

My writing routine is like this: I edit a .tex file using vim I go to the command line and I compile it using pdflatex. I find myself always saving the file with :w and immediately having to switch ...
27
votes
6answers
5k views

How can I really have some fun in Vim? [closed]

I love Vim. I spend my whole life using it: At work I develop code with Vim, I edit config files with it, I write my emails with it. At home I write my todo lists and my buckets lists with it. On my ...
0
votes
1answer
247 views

Goto First line of page

I know to go to the last line of the page i use L. How do I get to the first line of the page ? or what is the opposite of L
5
votes
2answers
227 views

How can I filter a buffer to an external command on save without causing any side effects?

Since importing a package and not using it in Go is a compilation error, fixing the import manually can be a bit of a pain while debugging, so I'm currently using this to fix it up automatically ...
11
votes
2answers
386 views

How to make sure no changes are made to a file

Is there anyway I could make sure a file is locked so that I cant make any changes to it. Is there a command for locking / unlocking a file in vim. Some times i would like a file to be in readonly ...

15 30 50 per page
1
152 153
154
155 156
199