All Questions

Filter by
Sorted by
Tagged with
4
votes
2answers
116 views

Can the path include negative entries (exceptions to a wildcard)?

Is there a way to exclude specific files and directories from Vim's path? I was hoping a syntax like this would work: set path+=./**,!./ignoredirectory,!./ignoredirectory2,!./ignorefile.txt I would ...
1
vote
0answers
18 views

do a command without altering the register [duplicate]

Sometimes I delete a line and when I want to yank it somewhere else I found out that I need to delete another line. How can I delete the new line without overriding the the content of the line that I ...
2
votes
1answer
673 views

How can I have (g)vim start in insert mode by default (when opening a .txt file)? [duplicate]

I often just need to create a notes.txt file in Windows to just quickly paste some text from some other place, save it from the gvim UI, and close the file. I want to be able to perform this operation ...
5
votes
2answers
310 views

How to dump output from external command into editor?

In example, I would like to paste the current time or date into editor by using external commands (such as date) without leaving vim. How this can be achieved?
4
votes
2answers
4k views

How to select and copy lines to clipboard which are selected by mouse without linenumbers and gutter?

In my default Vim settings I've enabled a gutter and line numbers. Sometimes I copy some lines to clipboard in order to paste somewhere else. Currently I need to disable line numbers and the gutter. ...
23
votes
1answer
1k views

After pressing qq, the status line says “recording”. How do I get out of this mode?

I accidentally pressed qq, and now the status line says recording. What does that mean? How do I get out of this "recording" mode? Pressing Esc doesn't work.
10
votes
3answers
3k views

How to replace more than one character without entering insert mode

I have a file with a line that looks like this: foofoo.xy.barbar I want to change the xy to gh. I tried to do 2r -> gh, but obviously that didn't work, as it replaced the xy with gg and then moved ...
6
votes
1answer
456 views

Can I pass a custom string to the 'gx' command?

I have a file like this: vi.stackexchange.com example.com duckduckgo.com I want to be able to open these sites with gx; this doesn't work because there's no protocol (http://) in front of these ...
6
votes
2answers
163 views

Deleting groups of autoindents in Insert mode

In my .vimrc I have set backspace=eol,start, which allows me to backspace over line breaks and the start of what I wrote since I entered Insert mode. This does not allow me to backspace over ...
6
votes
1answer
562 views

diffoff on all buffers

Occasionally I have a stray forgotten buffer in which I ran :diffthis. Later when I run :diffthis on some unrelated buffer that second buffer is immediately and unintentionally highlighted with the ...
4
votes
2answers
109 views

Can I paste a yanked line even if I delete a line? [duplicate]

When I yank a line with y and paste it with p, it's okay. But when I need to delete a line with dd before pasting my yank buffer changes. Can I still paste my yanked line? Is there a way to do that? ...
3
votes
1answer
1k views

How to make auto-indent XML in vim?

I am thinking on a similar solution, which Eclipse also does: during the editing, the editor tries to always hold in a "well-indented" format of the edited textual data. Ideally, it would happen very ...
10
votes
2answers
1k views

Zsh-like tab completion of partial paths

Related to Bash-like partial tab-complete for filenames in Vim One of the truly fantastic features of zsh is that you can type, for example, ls /u/s/m/m/who.1, press Tab and have it complete to ls /...
20
votes
5answers
1k views

GitHub for .vimrc and plugins

I know many people store their .vimrc on GitHub to make it easier to get right to work on new machines, and that makes complete sense to me. Including plugins, however, is problematic, because the ...
5
votes
1answer
79 views

Programming-oriented word swap using transwrd.vim

The plugin transwrd.vim allows to to easily swap two words by pressing <A-t> while having cursor on the latter word. For example: two words becomes words two. I think the pattern which ...
16
votes
1answer
944 views

Bash-like partial tab-complete for filenames in Vim

In Bash, when there are several files with the same prefix and I type part of the prefix and hit Tab, it completes the common prefix and allows me to continue typing to differentiate among the ...
5
votes
1answer
76 views

How do I get rid of <filename>.project.vim files?

It seems like any time I edit a file with gvim it creates a litany of files I don't want or seem to need. I understand the <filename>.~ files are backups of the file before I started editing and ...
9
votes
1answer
116 views

Can I force parentheses matching to show up across multiple windows?

I have a source file containing a long list of deeply nested heterogenous structures. Since the structures are long, I would like to: Use the :split command to split the screen into two. Scroll down ...
8
votes
1answer
346 views

Run shell commands on current file based on file extension

I'm currently doing a lot of work with both Ruby and JavaScript. I know that I can run my Ruby files with :! ruby % and likewise my JavaScript with :! node %, and that I can bind either of those to, ...
4
votes
1answer
270 views

Why does Vim force programming indentation when in “gitcommit” filetype?

I found that when I am using Vim to compose git commit messages (which I have been doing for a very long time now) that there are occasionally some quirks. For example today I wrote a commit message ...
4
votes
1answer
2k views

Set an option dependent on the filetype [duplicate]

How to configure on the .vimrc file to use a particular set options for a particular filetype, but others for a different filetype? For example, I want to enable expand tab (set tabs to be spaces) ...
10
votes
2answers
2k views

Cut vim load time

I'm using https://github.com/carlhuda/janus vim distribution and clearly not satisfied with load time. What would be the best way to profile and speed-up vim load time? Also would be interesting to ...
6
votes
1answer
295 views

equalprg to use for Python

Python is whitespace dependent, and it can't be totally autoindented for that reason, but there are a lot of extra stuff that should be possible to do automatically to comply with PEP8. Things like ...
6
votes
2answers
2k views

How do I search for a line that contains a pattern at column n

In writing some Vimscript to try to answer this question, I was exploring ways to "search for a line with pattern P in position X" (P is a search pattern, X is a number). One way to do this would be ...
4
votes
1answer
94 views

Custom syntax file for FIX data doesn't work

I tried to create a custom syntax file to read FIX messages. Note: I am certain my custom files are being loaded by Vim. The file format is sequences of NUMBER=VALUE pairs separated by the ...
11
votes
1answer
792 views

What is a Vim plugin?

I understand that we can extend the power of Vim in order to add new features or modify existing ones and enhance our editing experience. Although being myself a Vim user for quite a long time, I am ...
4
votes
1answer
533 views

How can I specify a command-line command with options as an equalprg?

I am trying to set up the Node.js version of js-beautify as an equalprg command when I am editing a JavaScript file, so that the Vim = indent commands reflow my JavaScript at the same time. Initially,...
8
votes
1answer
179 views

Running cleanup commands only for edited lines possible?

Referring to clean-up tasks like (but not limited to) the ones detailed in these questions: Re-indenting badly indented code What's the simplest way to strip trailing whitespace from all lines in ...
6
votes
1answer
1k views

Altering HTML templates in vimwiki

The vimwiki plugin offers a great feature of converting whole Wiki to HTML: :VimwikiAll2HTML. But it bothers me that there are no back links to the main page, and the only way to navigate back to the ...
2
votes
1answer
153 views

Does vim have a learning mode to help me get used to more advanced operations? [duplicate]

I have been using vim for over 5 years and I only ever use basic cursor movements and character/line replacements. I'm not using multiple windows or buffers or registers or splits. When I want to ...
5
votes
4answers
234 views

Move vertically to a specific character on a different line

It is easy to move to a specific character on the same line with t or f. However often it is useful to move to the specific character that is positioned on a different line. Consider this example: ...
6
votes
1answer
530 views

Sharing vimrc options in different computers [closed]

Can I easily keep my vimrc files consistent across multiple computers? I have different computers (laptop, desktop home and desktop work) and I want to keep my Vim configuration consistent, ...
3
votes
1answer
177 views

How can I make the “gn” motion wrap to the beginning of the file?

gn is a very useful command that selects the next search result. For example, if I insert foo bar baz into a file, move to the beginning, type /[aeiou]., and press gn, it would select oo in a visual ...
7
votes
2answers
1k views

Creating & maintaining flowcharts in Vim

Here is a simple text-based flowchart I made in Vim for a weblog post: [DNS request] | | [Adsuck] | ...
10
votes
4answers
194 views

Restricting operations to a section of code

There is many times in my day to day work life that I need to operate on a specific function, things like highlighting or searching for a variable, but I have never managed to limit the scope of the ...
9
votes
2answers
2k views

Folding fails: vim can't find any fold

I'm trying to fold some PHP code, and I have included a cut-down version of some of the code I'm trying to fold at the end of the post. I've tried the following vim commands, but only the ex commands ...
3
votes
2answers
165 views

ex mode choice of shell for external commands

When I'm shelling out some external command using ! :r !pbpaste or :!./path/to_my_script What environment will be used and how to manually configure it? I'm a big fan of ZSH. Can I have some ...
4
votes
1answer
69 views

Can the command-line window be entered without interrupting macro recording?

I'm having a problem using the command-line window (help cmdwin), which is extremely useful, but it doesn't play well with macros. cmdwin is invoked with q:, so if there is a macro being recorded, ...
38
votes
4answers
32k views

How can I rename the file I'm editing?

Is it possible to rename the file I'm editing from within Vim? Currently what I do is exit Vim, rename the file and open from Vim again.
5
votes
1answer
57 views

Is there any way to add to the help system without developing a plugin

I have somewhat customised vim to my needs what I would like to do would be to add a cheatsheet, documenting these customisations and other things I often forget to the vim help system. I know that ...
11
votes
2answers
217 views

Is it possible to use vim's clientserver functionality to keep settings synchronized?

I usually have multiple instances of vim running on the same machine. When I make a change to my vimrc I can just :source ~/.vimrc (with an easy mapping or an autocmd). But in order to have all ...
6
votes
3answers
5k views

How do I break a file into two?

I am writing some documentation (a user guide), in markdown in Vim. I now realise what I though should be one page, really should be 2. But I've already written alot of of both halves How can I ...
12
votes
2answers
4k views

Prevent Vim from clearing the terminal after exit

If I do: $ less file And press q to exit less, I stil see the same text as I had on the screen when less was still running. However, if I do $ vim file And :q, my terminal is blanked... ...
4
votes
0answers
89 views

Return to previous buffer without going through every jumplist entry [duplicate]

When I've jumped from a buffer to another buffer I use C-o to return and after that I use C-i if I want to jump to that same buffer again. I think this is the common approach. The problem is that this ...
12
votes
1answer
881 views

How to underline titles? (reStructuredText, Markdown, asciidoc style)

Various plain-text markup languages: reStructuredText, Markdown, asciidoc (others too), use an underline to denote titles. Chapter 1 Title =============== Section 1.1 Title ----------------- ...
17
votes
2answers
7k views

How can I reload all buffers at once?

When working on a feature branch in git, I frequently need to stash my changes to commit a bug fix to the main branch. When I'm done working on the changes, I git stash pop, which updates the ...
6
votes
1answer
348 views

Correct all spelling mistakes in the document

I've turned on spellcheck with :set spell spelllang=en_us. Now there's a bunch of words highlighted in red, and I just want to correct them all to their closest matches. How can I correct all ...
38
votes
1answer
18k views

Why do I need both a vimrc and a gvimrc?

There seems to be two ways to store preferences specific to gvim: Keep an .vimrc file for vim and a .gvimrc file for gvim specific additions. Keep all settings in .vimrc and wrap gvim specific ...
8
votes
7answers
2k views

Does Vim have any hidden “easter eggs” or jokes? If so, which? [closed]

I've heard rumours about Vim having some hidden "easter eggs" and jokes. Is this true? What are they?
3
votes
1answer
98 views

Can I open a group of buffers at once? [duplicate]

When I need to reopen vim for some reason (vim updated, reboot, etc), I need to manually open a bunch of buffers when I start up. Is there some way I can save the current set of buffers open in some ...

15 30 50 per page