All Questions

Filter by
Sorted by
Tagged with
12
votes
5answers
15k views

How to copy across terminals?

I'm using Linux system. Two vims are opened in two terminals. Now I'd like to copy text from A to B. One way to do so is to select text in A, use mouse to copy, then switch to B, in the insert mode, ...
5
votes
1answer
332 views

Emacs switch-window for vim

There is an emacs plugin called switch-window which indexes all open windows and allows the user to switch a window based on it's number. This is really convenient when you have a large number of ...
4
votes
1answer
201 views

Prevent C incomplete string matching from highlighting the rest of the code with the string color?

Not sure I said it right, it's kinda hard to explain with words, so: I don't know if syntax highlighting trying to be helpful here or what, it's definitely annoying and distracting. I simply don't ...
3
votes
1answer
374 views

Stray characters when scrolling in gvim

When scrolling with the mouse wheel, characters will often duplicate themselves on subsequent lines. For instance, if I'm scrolling down, I can sometimes see an open brace on its line and on the ...
10
votes
1answer
1k views

How to substitute in multiple lines?

I'd like to insert a word in multiple lines, is there any command like :[2,3,5,7,11]s/^/word\ /g which would insert word at the beginning of line 2, line 3, line 5, line 7 and line 11? Here, ...
25
votes
3answers
6k views

How to create my own autocomplete function?

How do I create my own list of auto-completion for certain filetypes? For example I would like css and html to autocomplete from the list of css classes in FontAwesome.
7
votes
3answers
651 views

How to specify the content of a new buffer from command line?

Is there a way to call Vim in such a way that it opens a buffer with some content specified on the terminal, i.e. not saved in a file? For example, I would like to run vim and have it open a buffer ...
15
votes
2answers
7k views

What is the reverse of the 'go to next' command

If I want to go to the next , on the line then I type t,. If I wanted to go to the previous , I could use /n, enter, N but this is a bit of a fiddle. What is the best way to go to reverse the t ...
17
votes
4answers
1k views

Merge blocks by interleaving lines

Is there a dedicated way to merge two blocks of text by interleaving lines, like passing from this: a1 a2 a3 a4 b1 b2 b3 b4 to that: a1 b1 a2 b2 a3 b3 a4 b4 in a few commands? ...
18
votes
3answers
1k views

Tabs for indentation, spaces for alignment

I am trying to make vim auto indent with tabs, and align with whitespaces, but actually, vim indent with tabs and fill the alignment with tabs + white spaces. Vim does it : (each block is a tab) { &...
2
votes
1answer
434 views

Trouble with vim line completion?

Completion seems to work ok overall (so <C-X> + <C-]> complete for tags and <C-X> + <C-N>/<C-P> complete in context), but the line completion (<C-X> + <C-L>) ...
4
votes
2answers
2k views

Is there a way to search files with netrw similar to find command in linux?

Is there a way to search files with netrw similar to find command in linux? So in command line I can do find . -name "pattern" Is there something similar in netrw?
3
votes
2answers
2k views

Paste buffer/clipboard into brand new file?

I am breaking apart some files, and I'd like to paste what I cut into a brand new file, which I specify the name of. Something like: :c file-that-doesnt-exist.txt Where c is a key command. Edit I'...
24
votes
3answers
9k views

Undo in insert mode

Is there a command to undo the last operation performed while in insert mode? I just pasted text from the wrong register using <C-r>, and I have two options: Delete by hand what I just pasted ...
4
votes
1answer
509 views

Search for the next line that does not match a pattern

The / command moves to the next occurrence of a pattern. But how do I move to the next line in which a pattern does not appear?
0
votes
1answer
1k views

how can I keep `<C-f>` literal in map definition?

I've write myself a function, which receive a motion and perform it in other window. However, a problem raises when I need to map a real motion to a key sequence: nnoremap <c-p> :call Motion('\&...
4
votes
2answers
757 views

How can I move netrw's default keybindings to other keys?

Let's say I'm a terrible person and I'm thinking about remapping <CR> to do what : normally does (start command-line mode). Vim's built-in netrw plugin also remaps <CR> to open the ...
1
vote
1answer
447 views

Vim reseting to foldmethod=manual once navigating buffers

I have created a ftplugin/html.vim file with a custom fold expression. On my .vimrc file I have the following: set foldmethod=syntax "all files use syntax fold method autocmd Syntax html set ...
1
vote
1answer
98 views

Elvis 2.2.0 : Input vs Insert mode

We can start elvis in input mode using -i option. Also we can start input mode with various commands that specified in help :help. But users call insert mode too which can also determined from h ...
7
votes
1answer
585 views

What is an abandoned buffer in vim?

I've been using vim for more than 5 years now, and I was surprised when I didn't know what an abandoned buffer was. The closest answer I found was in this SO answer. So is an abandoned buffer one ...
10
votes
2answers
6k views

vundle “filetype plugin indent on” messes with tabwidth

I installed vundle yesterday and since I did, the tabwidth I configured in my vimrc is ignored and set back to 4 instead of 2. I found out that the following line after the vundle paragraph is ...
3
votes
1answer
100 views

Event SourcePost doesn't exist

While searching for autocommands event I noticed that there are no SourcePost event. This is strange, because nearly all of other event have a Post version of it (e.g. FileAppendPost, BufWritePost, ......
1
vote
2answers
839 views

Setting foldmethod=expr when re-sourcing vimrc?

I have the following on my vimrc file to handle custom folding: " ++ Folding set foldenable " enable folding ...
8
votes
1answer
376 views

Numbered register doesn't record most deleted text within a line?

I am using gVim and it seems the deleted text within 1 line (except d following some operations, like () doesn't go to "1 then shift the "1-"9 registers, it only goes to "-, one example is diw command....
3
votes
1answer
257 views

Moving over conceal

Is there a setting that allows you to move over concealed strings as if they were one (or even better: zero) characters? (This answer seems to suggest there's not.) As it is, any movement can land on ...
2
votes
2answers
527 views

is there a way to define the syntax highlighting keyword programatically?

I followed the link creating-a-simple-vim-syntax-highlighting, for doing the syntax highlighting for my purpose. This is really nice., but it's static. So, keywords are to be predefined. In a ...
0
votes
1answer
323 views

Is there any proper autocomplete and/or syntax checker for CoffeeScript in vim?

Is there any proper autocomplete and/or syntax checker for CoffeeScript in vim? This is not a very complex question but i cant seem to find anything. I am currently using YCM.
11
votes
2answers
1k views

How to configure spell to ignore some environments in LaTeX

Is there a way to tell vim not to spell-check part of a latex document? For instance, code block using the minted environment or URLs in \url{}? (I'm not sure it's relevant for spell checking but I'm ...
7
votes
1answer
766 views

When exactly does <afile> differ from <amatch>?

The documentation says: <afile> When executing autocommands, is replaced with the file name for a file read or write. <abuf> When executing autocommands, is replaced ...
3
votes
1answer
448 views

How to use arrow keys mappings in vim-submode plugin on linux terminal?

Following this answer I've been using vim-submode for some months on a windows gVim. Now that I'm trying to apply the same configuration on a terminal vim on linux I have some problems: With the ...
0
votes
1answer
363 views

Nicer way to not mach a pattern in autocmd [duplicate]

I want to to run run an autocmd for all but tex files, i figured out this solution: autocmd BufWritePre *.[^t][^e][^x] :Autoformat but is kind of ugly, because of this repeated [^..] pattern. Is ...
11
votes
2answers
522 views

Scrolling issues when the `wrap` option is set

I find myself dealing with this issue every time the wrap option is active (in my particular case whenever I'm working with markdown files). What happens is that, while scrolling up and down the ...
5
votes
1answer
879 views

Why does Vim highlight every dot in my code?

I program with Python and I installed python-mode with pathogen. Everything was fine but then suddenly Vim started highlighting all the dots in the files. And it's kind of frustrating. I thought it ...
3
votes
1answer
337 views

Determining makefile based on source file name

For current source file with the following name pattern: xxx_test.cpp how do you execute make file with the following patter xxx.makefile. I tried using set makeprg=make\ -f\ fnameescape(substitute(...
2
votes
1answer
794 views

jinja2 indentation with gg=G

I develop django templates, and I need to indent them with gg=G, but jinja2 tags seem to be immune to it. Here is an example of poorly indented, hard to read if-else tags: {% extends "base.html" %} {%...
6
votes
0answers
1k views

Constantly updated community best practice website? [closed]

Is there an up-to-date community-driven1 website which lists best practices regarding settings in .vimrc, plugins and/or tips to use vim? What is the best way to get to know up-to-date community-...
4
votes
0answers
299 views

Encoding issue with filename in MacVim

Question In MacVim I type :tabe jäderberg.txt to open a buffer for that file. The file does not yet exist. My status line displays the file name jäderberg.txt. I do i<C-r>% to put the file name ...
20
votes
2answers
5k views

What is the order of WinEnter, BufEnter, BufRead, Syntax, FileType events?

I've gone through the autocmd.txt help, but the information about this is scattered and not always present (eg. with BufRead). Could someone who understands this well list the order of these events -...
9
votes
3answers
20k views

How to add space on multiple lines when pressing spacebar (without extra configuration)?

I tried visual block, but visual block only allow to highlight or delete characters on multiple lines. Is there any function that allows to add space before the first character of multiple lines when ...
8
votes
4answers
2k views

How do I define an autocommand to work on all files excepted a certain filetype?

For example, I have the following autocommand definition: augroup cursorline autocmd! autocmd WinLeave,BufLeave * set nocursorline autocmd WinEnter,BufEnter * set cursorline augroup end ...
17
votes
2answers
2k views

Expand f and t motion to next lines

Is there a way that t{char} and f{char} will continue to work in the next lines if {char} is not present in a given line? I would like to avoid using /{char}<CR> to save 1 keystroke and to not ...
10
votes
2answers
5k views

How to open a file with all folds opened?

I've got the following line in my _vimrc file which enables folding for my PHP (and other) files: set foldmethod=indent However, whenever I open a file it starts with every fold closed, but I would ...
0
votes
2answers
379 views

a problem with a mapping ( map enter and tab key)

I have this mapping in my vimrc: imap <expr> <silent> <cr> neocomplete#mappings#close_popup() . \ "<Plug>(neosnippet_jump_or_expand)" and it's working great. When I press ...
0
votes
1answer
64 views

Using registers in different terminals

I sometimes have multiple xterm windows open and run vim in both of them. Is there any way to copy text from one window to the other using registers if I don't have '+clipboard' enabled? Steps to ...
0
votes
1answer
1k views

Creating C:\Users\MyUserNameHere\_vimrc on Windows seems to override some other vimrc file

I'm running Windows 7 with gvim 7.4 installed in the default location. I have created a file C:\Users\MyUserNameHere\_vimrc with just a few lines as simple as: set nowrap set tabstop=2 set shiftwidth=...
1
vote
2answers
708 views

Using :TOhtml with solarized colorscheme

I am using altercation's vim-solarized plugin to set my default colorscheme and have set my xterm to use solarized colors as well. When I try to run :TOhtml on a buffer, say on $MYVIMRC, the ...
23
votes
4answers
4k views

How can I make Vim open help in a vertical split?

I usually work in a drop-down terminal, running about 25 characters high. Since I prefer tabs to windows1, usually a lot of horizontal space is wasted - around half of the terminal width. On top of ...
4
votes
1answer
882 views

How to prevent vim from creating (and leaving) temporary files over webdav?

When I'm writing over webdavfs vim temporary doesn't handle temporary files properly: ll -a ls: cannot access .htaccess.swp: No such file or directory ls: cannot access .htaccess.swx: No such file or ...
3
votes
1answer
143 views

Is it safe to do other stuff on a system while a macro runs?

If I'm running a complex macro on a large file that I expect to take a few minutes, is it OK to do other stuff on the system (e.g. opening another application, typing in a different text editor, etc?) ...
0
votes
1answer
46 views

Linking the vsplit views of two different buffers? [duplicate]

How can I link the vsplit views of two buffers so that the lines from both files are always in sync?

15 30 50 per page
1
177 178
179
180 181
202