All Questions

Filter by
Sorted by
Tagged with
5
votes
3answers
5k views

Can I load different tags per project?

I'm interested in using exuberant-tags (ctags) in vim, but I use Vim for all sorts of projects so I need multiple tag files and I need vim to use the correct tag file on a per project basis. Is there ...
21
votes
3answers
9k views

Can the split separator in vim be less than a full column wide?

I use a tiling window manager (awesome) + a terminal multiplexer (tmux) + splits inside of vim. I have no window decorations at all, so you there is no visual split between them at all if the content ...
9
votes
3answers
423 views

How to output highlighted source code into a file to use outside vim

At my workplace, I want to do a presentation of a custom language I've developed for solving some problems we had. For easier development, I created my own vim syntax file for this particular language....
4
votes
1answer
183 views

What's the point of :promptfind after all

Not sure if it's an appropriate question. But I just can't help wondering, why would any Vim user find it necessary to invoke a GUI search prompt instead of search using / or ?, why would the designer ...
1
vote
1answer
2k views

How to split window directly from command line? [duplicate]

I'm using Ubuntu system. I have files: A.txt, B.txt, C.txt I can split window in the following way: vim A.txt :vs B.txt // after entering into vim :vs C.txt Is there any way to achieve the same ...
1
vote
2answers
978 views

How to execute a command in an inactive window

I was playing around with the MiniBufExplorer plugin, and I thought it would be nice if the MBE window could stick to the bottom of my ViM screen, even if I specifically open a new window with e.g. :...
15
votes
2answers
492 views

Don't touch file upon write if the file was not changed

Occasionally I absentmindedly type :w when I'm reading something. This causes the modification time of the file to change and sometimes causes my build system to unnecessarily rebuild a substantial ...
5
votes
2answers
2k views

How to programmatically visually select a text block?

Is there a way to select a text block (e.g. a first word "TODO:") programmatically (with some commands or functions from a script)? Not simply highlight, like with a search, but visually select like ...
10
votes
2answers
2k views

How to further increase cmdline history size?

I have already put the following setting in my .vimrc file: set history=1000 It's been there for a while, I work in vim on a daily basis, so there have been many commands executed by now. I know ...
5
votes
1answer
7k views

Modify vimdiff highlighting

For readability I try to modify my ~/.vimrc to get some proper highlighting. I found here to use e.g. this: highlight DiffChange cterm=none ctermfg=fg ctermbg=Red gui=none guifg=fg guibg=Red Like ...
13
votes
1answer
644 views

Why is MacVim starting differently every other invocation?

I noticed when I sat down to do some work on my MacBook today that at some point recently something had gotten screwed up with respect to my .gvimrc settings: when I launched MacVim, everything seemed ...
10
votes
3answers
286 views

Like Ctrl-A and Ctrl-X but modify only the first digit

Is there a way to increase/decrease first digit after/under cursor, not the whole number. I know it's not how vim works, but is there a plugin that does that? I was unable to find it. It is very ...
5
votes
2answers
2k views

How can I fix the auto indentation in LaTeX?

Vim has some fancy pants indentation stuff. When it works right it's a pleasure to have, but sometimes it just drives me nuts. One that I've never been able to solve has to do with LaTeX syntax. Lets ...
17
votes
4answers
5k views

How to show search results for all open buffers

One thing I often do (but rely on the command line to do) is searching/grepping in multiple files. Is there a way to display search results for all the open buffers? Ideally, I'd like to have a new ...
1
vote
1answer
94 views

netrw: have the cursor placed on previous cwd name when going up dir

In a netrw listing, when I press - key to go up a directory, I would like the cursor placed on the line corresponding to the dir I have just left (exactly how happens on some file managers, e.g. Nemo)....
3
votes
1answer
228 views

“x” overwrites clipboard, I am not able to finish the copy-pase action [duplicate]

I decided that I have to get rid of a couple of annoying things which decrease my productivity in Vim. I know they must have a simple solution. So, my first question: If I copy a word in clipboard ...
2
votes
1answer
85 views

How to jump to the location which [I points to?

I've installed node plugin, which give possibility to display all lines that contain the keyword under the cursor using [I hotkey. It looks like this: Is there possibility to jump to them?
5
votes
1answer
545 views

What is wrong with this mapping expression in my .vimrc?

I'm trying to make Vim play nice with wrapped lines and I'm running into some problems. The following line xnoremap <expr> k ((v:count == 0) || (mode() !=# "V") ? 'gk' : 'k') gives me the ...
4
votes
1answer
471 views

User-defined sorting precedence

Is there a way to define a sorting precedence regarding the line's pattern and then use it with :sort? For example, if I have these lines: 1 some text (foo) some other text 2 some text (bar) some ...
37
votes
3answers
2k views

How to disable horizontal scrolling?

I have some concealed characters in the buffer and horizontal scrolling kills the alignment big time. Is there any way how to disable it? I could not find any relevant options. Edit: Demo added. You ...
2
votes
1answer
425 views

spf13-vim - Error with neosnippet plugin when editing a file

I installed spf13-vim on OS X and when I started do edit a file I get the following errors: Error detected while processing function neosnippet#init#_initialize Cannot create directory: /Users/.../....
4
votes
2answers
465 views

How to jump to the end of quoted string, considering escaped delimiters

Assuming the following situation $someVar = "Some String with \"escaped\" inner delimiters"; with the cursor somewhere in the double-quote delimited string. What is the quickest way to jump to the ...
11
votes
4answers
6k views

How can I run javascript directly and show the output?

I'm just doing some testing with JavaScript language feature with no DOM manipulation. So I'm editing a js file and I'm wondering how to simply run it and show the console output? I installed the moll/...
11
votes
3answers
4k views

Vim slows down over time with syntax on

Is there anything I can do to keep syntax on when using Vim? As soon as I open anything substantial it becomes nearly impossible to edit after a while. Every keypress causes a delay. If I turn syntax ...
32
votes
3answers
6k views

How do you “chomp” a string in Vim?

Suppose you run the following piece of vimscript: let @z = system("date") This will put a string version of the current date into the z register, but the string will end with a newline that I don’t ...
5
votes
1answer
691 views

Indentation of preprocessor directives

In my vimrc I have the following line, which figures all the indentation of my files. filetype plugin indent on When writing C programs sometimes I use preprocessor directives like #ifdef foo and #...
1
vote
2answers
1k views

Prevent CtrlP from indexing parent directories

I'm sure this will have been asked before, but I can't seem to find a solution. I tend to open Vim from the root of my project, let's say: ~/dev/project/ Which looks something like: project/ | - ...
9
votes
2answers
699 views

Navigating code projects without using external commands

I am trying to gather a toolbox of Vim commands/queries, in command or search mode, for navigating a code-base without using Ctags or other external tools. Ctags are great but support can vary ...
1
vote
1answer
658 views

Vim keep last line at bottom of buffer

I need to configure Vim in such a way that it has a normal scrolloff of 3 or 5. But in such a way that it keeps the last line at the bottom of the screen. I don't want that as I scroll, the last lines ...
4
votes
2answers
743 views

Highlight XML errors based on this XML file's XML Schema

I have an XML file that must conform to a particular XML Schema: <?xml version="1.0" encoding="UTF-8"?> <myroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
4
votes
1answer
498 views

How to set the opening file as the tags in vim?

I have lots of files named by file.tags, ncl.tags, flod.tags, ... , fortran.tags. when opening file.tags, I want to set tags=file.tags.And when opening ncl.tags, I want to set tags=ncl.tags,and so ...
2
votes
2answers
322 views

Tips for quickly formatting a single line of XML?

I have a log file with lots of web service XML data (example follows). Ideally I would like to just go to a line and type ,x to create pretty formatted XML for readability. Response XML: <...
4
votes
3answers
4k views

Where is my viminfo file on Windows?

I have gVim 7.4.608 installed on Windows 7 at work. I've looked in C:\ , C:\Users\<username>\AppData , C:\Program Files\vim , C:\Temp but there's no sign of it. It must exist somewhere, command ...
17
votes
4answers
2k views

How to set up Vim to work with one sentence per line?

I'm currently writing a lot of plain text (and LaTeX with minimal formatting in paragraphs), and it would be nice if I could set up vim to keep each sentence (for simplicity, text terminated by a '. ',...
3
votes
2answers
642 views

How to display file size in netrw in a human readable way?

When using netrw, (by :Vex or :Sex), the files can be displayed in different ways by pressing "i". And there is a view that the sizes of the files are displayed. However, the sizes are in bytes. Is ...
4
votes
1answer
1k views

How to automatically set wrapping for quickfix window?

I'm using Dispatch.vim, and often when there's a test error, some lines in the quickfix list are really long. I don't use soft wrapping for my code, so quickfix also isn't wrapped. Is it possible to ...
1
vote
1answer
2k views

How to find every occurrence of a word and append some text to it?

I have to find a word and append some other text to in in Vim: for instance I have to append to every occurrence of the word "public_html" the text "/Text-Analysis-Tool" to obtain "public_html/Text-...
2
votes
1answer
403 views

CtrlP searches entire machine

I use CtrlP with vim, installed it with Plug and have it set up mostly to default settings. Whenever I use the plugin though, it seems to search through all my files on my entire machine. So instead ...
3
votes
1answer
5k views

searching duplicate words

This page says that I can find duplicate words using a regular expression. The suggested command is \(\<\w\+\>\)\_s*\<\1\> What does "\w" mean here? Suppose the target pattern is "123\...
3
votes
2answers
315 views

Highlight longest common subsequence between two files? line by line

I'm asking about some sort of specialized diff highlighting mode. I need to diff, line by line, files A and B, which look similar to this in vimdiff: A B repo/manipulate_1....
4
votes
2answers
709 views

MacVim Text rendering problem when scroll up and down

This could be a rare issue related to individual environment. But it's so annoying that can't help me asking for help. Please have a look at following captured photos which is fine before scrolling ...
6
votes
2answers
1k views

Vim is displaying some info and “Press ENTER …” when I open a file

From time to time I see something like in the status bar when I open a file: "Gemfile" 112L, 2941C "Gemfile" 112 lines --62%-- Press ENTER or type command to continue Where is it coming from? How to ...
5
votes
1answer
791 views

How to substitute text across line breaks?

I would like to reformat code in an entire file from this brace style: if (condition) { body; } … into this brace style1: if (condition) { body; } The bulk of the task should be ...
1
vote
1answer
123 views

How can I clear normal mode command count in mappings?

I have a mapping like this: noremap <expr> zj FindNext() FindNext will calculate which line to go, and return something like 10G. This works without a count, but with a count the line number ...
2
votes
2answers
610 views

Pipe shell command into buffer in real-time

I wrote this little function to update my plugins from within vim: function! UpdatePlugins() call system('for f in ~/.vim/bundle/*; do cd $f; git pull; done') endfunction command! UpdatePlugins ...
4
votes
1answer
782 views

How to make a movement function work with delete, yank, etc

In hope of answering Using the % command on a line without a bracket I tried to write my first Vim script. My thought was to check if there was a { on the current line. If there was one I wanted % ...
3
votes
1answer
80 views

Using the % command in c++

The % command is quite nice, and I use it to copy/delete whole loops, functions and classes. In c++ though, you need to add a ; after your class declaration, so trying to motion over a whole class ...
2
votes
2answers
186 views

Using the % command on a line without a bracket

I like formating code this way: class A { } unlike another common way: class B { } The thing is, when using the % command to go to the enclosing bracket, which is very useful for copying/deleting ...
5
votes
2answers
633 views

How to prevent Vim from scrolling buffers when I open split

When I open a new split Vim is scrolling both buffers up despite having enough space. Here is an asciicast This behaviour comes out-of-the box in vim -u NONE. It is really annoying. My guess it ...
0
votes
2answers
114 views

y<C-G> not yanking commit SHA in fugitive?

I'm having some trouble getting the yC-G command in normal mode to yank the current commit SHA. Currently it only yanks the file name. From :h fugitive: ["x]y<C-G>     Yank ...

15 30 50 per page