All Questions

Filter by
Sorted by
Tagged with
5
votes
4answers
1k views

How to generate patterns for comments?

As a way of organizing my codes, I like to include some titles as comments with specific patterns (I wish I can add ASCII art!). Consider for example, putting the following to mark a specific block of ...
1
vote
1answer
90 views

How to make mappings that yank text without overwriting the global registers

Many useful mappings need to temporarily save text. Some practical examples are: " Move line up/down nnoremap <c-j> ddp nnoremap <c-k> ddkP " Substitute word under cursor (use `cc` ...
7
votes
1answer
2k views

What's the difference between the “clipboard” and “xterm_clipboard” features?

What is the difference between the clipboard and xterm_clipboard features? When do I need to enable one or the other at compilation time? As an aside, how do these features relate to the mouse ...
2
votes
1answer
341 views

Motion key for next highlighted item?

Using the normal spell-check mechanism in vim one can jump from one misspelling to the next using ]s. Sadly vim's spell-check is completely useless for Turkish. Using the vimchant plugin that hooks ...
0
votes
1answer
148 views

NetRW bug? : vim scp://host1/filepath scp://host2/otherfilepath only opens first file

There is some strange behavior to observe in the current version of NetRW shipped with Debian Jessie (current as of Mid-2015) on my installation. Searching online doesn't immediately reveal other ...
5
votes
3answers
183 views

How can I quickly convert a Vim help tag to a vimhelp.appspot.com link?

One thing I often do here is to add links to documentation when writing :he foo, and I usually link to http://vimhelp.appspot.com. The problem is, that site's search is about slightly worse than the ...
6
votes
1answer
223 views

Can I detect whether current vim instance is launched by git?

My .vimrc does a lot of extra things I don't want to do if it's launched by git(for example, during commit), since the purpose of that Vim instance is very specific so it makes no sense to launch many ...
3
votes
1answer
385 views

How to skip over indentation whitespace with horizontal motion?

I have a file that uses 4-space indentation. By default, when I move horizontally, Vim moves over those spaces one by one. How can I configure Vim so that it moves 4 spaces horizontally when moving ...
0
votes
1answer
362 views

Why can't I tab complete after open?

I have set wildmenu and set wildmode=list,full in my .vimrc. If I go to enter a command such as buf or tabe, follow it with a space, and then hit tab, my wildmenu options take effect as I'd expect, ...
2
votes
1answer
2k views

“set hidden” leaves many *empty* buffers. Can I automatically get rid of them?

I recently added set hidden to my vimrc script because I didn't always want to :write a file before :editing another file. (With set nohidden, which is the default, this resulted in a E37: No write ...
6
votes
1answer
1k views

How to check with Vimscript whether python support is enabled?

I think it would be very nice if I can check whether current vim was compiled with python support, instead of having error message popping out every time vim is launched. Can this check be done in ...
15
votes
3answers
9k views

Multiple cursors at desired location

I'm using vim-multiple-cursors plugin. I would like to put cursors exactly where I want. For example ([x] are the cursor positions): Lorem ipsum dolor sit amet[1], consectetur adipiscing elit, sed ...
16
votes
1answer
2k views

Is it possible to get the matched string after calling :search()

In a vimscript-function, I need to assign a matched string to a variable l:matched after calling search() and I am wondering if there is a shorter way than what I am currently doing: let l:pattern =...
14
votes
2answers
9k views

Show listchars tab as spaces

I use list and listchars to show my whitespace, but the code style I adhere to uses tabs. Seeing > or ^I for all of my tabs is nauseating. How would I keep all of my existing list characters but ...
13
votes
1answer
2k views

Improve macro replay speed?

I recorded a simple macro and replayed it on following lines, but it seems replay speed is very slow (handle a very few lines per second). Is this expected and is there a way to improve such speed?
9
votes
2answers
2k views

Change vimtutor language

My vimtutor is in portuguese. I don't know why, because my Windows OS is in english, so as everything else. I don't remember to have chosen "portuguese" anywhere in the vim installing process. How do ...
2
votes
0answers
100 views

how to map # to , when , is my leader [closed]

My leader is ,: let mapleader = ',' Now, I want to map # to find previous match (when using f, F, t, T), I try this: nnoremap # , But nothing happens when I use #, obviously something is wrong. ...
2
votes
1answer
224 views

What does Special Comment refer to in reference to a colorscheme?

I've recently delved into taking an existing colorscheme and customizing it to my liking. While doing this however, I found there was a highlight option for special comments and I'm not sure exactly ...
5
votes
1answer
1k views

Why `NERDTree` doesn't trigger the autocommand `BufEnter`?

I am writing a vimscript function which should keep in a consistent state a "home made buffer manager". The idea is that I want to keep a trace of my buffers in the tabs they were open in. This "...
21
votes
1answer
4k views

Can I map a Ctrl + upper-case letter separately from Ctrl + lower-case letter?

I am trying to figure out how to navigate windows little quicker, so I would like to map the following: :nmap <silent> <C-F> :wincmd f<CR> The problem is this remaps the ^f (lower-...
5
votes
2answers
459 views

Show only every n relative line number

Is it possible to show every n relative line numbers? So for example, I can see a a (+/-) 10, 20, 30... instead of a value on every line. If there's no current way to do it, is it possible to create?...
2
votes
1answer
1k views

How to replace two-line match with its first backreference pattern?

Given the following example: aa aa bb bb cc dd I'm trying to replace two-line match (bb\nbb) with its first matching line (bb). What works: these two-lines can be matched by: /bb\_.\{-}bb (as per: ...
4
votes
1answer
759 views

How can I map Alt-< or Alt->

I try to create a mapping for Alt < and Alt >: inoremap <M-<> foo-bar-baz inoremap <M->> baz-bar-foo This doesn't work, most probably because < and > are themselves ...
3
votes
1answer
4k views

How can I run a function once after the buffer has been completely loaded?

I am writing a filetype plugin that will (among other things) fold LaTeX documents by use of a custom foldlevel function. In order to make the folding efficient, I use foldmethod=manual during editing ...
2
votes
1answer
1k views

How can I prevent the default loading of ftplugin/text.vim for certain *.txt files

I have to edit a bunch of *.txt files for which I want to define a specific filetype. So, in my vimrc, I add a autocmd! BufReadPost bunchOfFiles/*.txt :set ft=bunchOfFilesFT This reads ftplugin/...
4
votes
1answer
324 views

Delete text after match in Ex?

I've sample file like: aa bb cc dd ee ff and I'd like to remove everything till the matched line dd. Normally in Vim I type: d/dd then Enter and it works. When using in ex, it doesn't work as ...
2
votes
1answer
237 views

What does it mean to buflist netrw buffer?

I find there is one line let g:netrw_bufsettings = 'noma nomod nu nobl nowrap ro' in my _vimrc file. Google says it could make netrw buffers buflisted What does it mean to make "netrw buffers ...
5
votes
2answers
3k views

Calling function to insert text with inoremap

I have a function that is called via a mapping when I am in insert mode: inoremap <buffer> <M-i> <ESC>:call TheFunc()<CR> The function is supposed to "calculate" a string (l:...
3
votes
2answers
424 views

Triggering UltiSnips in command-line mode

Is there a way to expand a UltiSnips snippet while in vim command-line mode? I can only expand a snippet in insert mode. I am using UltiSnips to help inserting unicode characters. And I need to ...
5
votes
2answers
896 views

Opening built-in cheat sheet [duplicate]

Every now and then when I try to quit vim, I incidentally open window with command cheat sheet as in attached picture. How do I do this and how is it called?
3
votes
3answers
1k views

How do I prevent Vim from loading plugins on older configurations?

I have a couple of plugins that don't work correctly on some machines running earlier versions of Vim. Is there a way to supress the Error detected while processing... errors when I start up vim in ...
1
vote
1answer
169 views

How to open multiple files except some files

Suppose we have several files f11.txt f21.txt f31.txt f01.txt f02.txt f03.txt Is there any vim option such that I can open all files except for f0*.txt? Something like gvim -O * --exclude=*0*? (-O ...
6
votes
1answer
131 views

What determines if a key stroke is waited indefinitely or if it times out?

I have a very customized vim configuration, but I don't think it has anything to do with this, because nothing has changed the key binding system. When I press g I can leave the window there and make ...
1
vote
0answers
107 views

How do I prevent resizing of particular buffer?

I have these mappings in my .vimrc: nnoremap <s-j> <C-w>- nnoremap <s-k> <C-w>+ In a single buffer, Shiftj results in resizing my (pic1) buffer. Im not sure about that, but i ...
3
votes
1answer
386 views

Vim “gq” command doesn't recognize Haskell-style comments

I have a Haskell file on VIM with a Haskell-style comment block: When I select that comment block on visual mode... And press gq, I expected VIM to format my comment to something like: But instead, ...
13
votes
2answers
8k views

What is the difference between j, CTRL-J, <NL> and CTRL-N in normal mode?

I saw somewhere on the web someone using Ctrl-J and as I didn't know this mapping I looked up in the relevant doc and found the following: j or <Down> or CTRL-J or <NL>...
5
votes
2answers
1k views

How to specify a vim flag in the vimrc

I know that you can pass several flags to vim at startup. For example: the -w flags enables to records every keystrokes on the file output. vi -w output But I wonder if there is a way of doing ...
25
votes
4answers
25k views

What is `softtabstop` used for?

I've been aware of these tab related settings in Vim: ts sw expandtab smarttab sts My normal setting is set ts=4 sw=4 expandtab smarttab. But according to sts documentation, if expandtab is not ...
2
votes
1answer
429 views

Original column number in a mapped function called with a count

Here's an example: function! TestCursorPosWithCount() range echo virtcol('.') endfunction nmap <leader>c :call TestCursorPosWithCount()<CR> If I press <leader>c, the column ...
12
votes
2answers
2k views

How to detect whether swp files contain unsaved changes?

When editing source code using gvim (v.7.4.488), I want to commit some changes the vcs (I'm using git 2.1.4 from the command line in Ubuntu linux). git --status shows which files I changed. However,...
3
votes
0answers
522 views

Highlight python raw strings as regular expression

I heard someone had set up their editor to highlight python raw strings as regular expressions, e.g. for Django: urls(r'^site1/(\d)*/new$'', ...) Unfortunately my googleing doesn't get me anything. ...
5
votes
3answers
6k views

Why does my colorscheme look different when I run vim with sudo?

I installed colorscheme "jellybeans" for vim. Why does the colors look differently when i run vim with and without sudo? Example on the screen below - the left one is without sudo, the right is with ...
1
vote
0answers
190 views

Use ISO Level3/5 as modifier in vim keymap?

I've been using the pseudo keymap solution from my previous question to great effect for 6 months now. The short version is that it allows me to keep the computer keyboard map in my usual Programmer's ...
7
votes
1answer
929 views

Is it possible to add inline comments in a multiline statement?

I have a function that looks like fu! MultiLineTest(u, v) if a:u != 2 && \ a:v != 2 return 'yes' else return 'no' end endfu Of course, the actual ...
1
vote
1answer
434 views

Using digraph mode to insert special key codes

I've always thought about digraph mode as a way to quickly insert unicode special or unusual chars into the buffer without copy-pasting things around or changing keyboard layout system-wide. So to ...
1
vote
2answers
162 views

How to express “There is a specified symbol in the following unknown numbers of characters” in regex?

I have many python code examples in my markdown files, which should be prepended with >>> symbols. So I write a vim function to do this job: function AddShellPrompt() range let lnum = a:...
1
vote
3answers
515 views

Is it possible to get the height of the buffer *including* word wrap?

I can grab the number of lines of a buffer with line("$"), but this does not take into account if my terminal is small and I have set wrap and some lines wrap. I wonder if it is possible to query ...
4
votes
2answers
540 views

Breaks line without leaving insert mode

With the textwidth option set the text written can be wrapped when we leave insert mode. If I type a line longer than my textwidth value then it will go on a new line. e.g. with set textwidth=5 and ...
6
votes
1answer
700 views

Why can't I execute write command on all buffers with :bufdo?

I have multiple buffers open, some currently visible, some not. I know I can write all of them with :wa. However, I am curious, why :bufdo w does not work. When I try it in a buffer with unsaved ...
6
votes
2answers
648 views

Relative Numbers sidepanel with wrapped lines

I love the relative numbers side-column in vim but when I have wrapped lines it becomes inaccurate (or less usable since I can't use that number directly in a j/k command). I have nnoremap j gj in my ...

15 30 50 per page
1
179 180
181
182 183
202