All Questions

Filter by
Sorted by
Tagged with
9
votes
1answer
4k views

HTML syntax folding in VIM?

I was wondering which is the best way to use syntax folding for HTML files. Specially if it can recognize javascript code within <script> tags. I typed set foldmethod=syntax but it does not ...
5
votes
1answer
483 views

How does the “d3fg” command work?

I would like to know how a "d3fg" command works in vi. I have done some research on Google and found that d is delete and fg means foreground. Suppose, if we want to stop the session of vi and resume ...
7
votes
1answer
2k views

How to translate Unicode escape sequences to the Unicode character?

I have a file with a lot of characters represented like this: \u05E2. (These are the actual characters in the file: backslash, lowercase u, and four hexadecimal digits.) Due to that, the file is ...
4
votes
2answers
3k views

I can't get 256 colours to work with Vim in iTerm2 on MacOS X

I am having a rough time getting the colors right with my vim setup and the color scheme I want to use. Using: OSX 10.10.2 Vim 7.4 iTerm2 (Set to report terminal type as "xterm-256color") gruvbox ...
1
vote
1answer
53 views

Transfer file-related settings over to a new, derived file? [closed]

Let's say we handle a file that needs various speciffic settings: We have a file type, syntax, colorscheme, highlights, tab widths and more. Also, we have multiple plugins with Now, we want to ...
24
votes
3answers
6k views

What does `<Bar>` mean?

In answering a question just now, I mentioned using a normal mode key mapping that can be found at vim.wikia.com. In the middle of explaining the key mapping, I realized that I had no idea what <...
5
votes
2answers
571 views

Entering search pattern with syntax highlighting?

A search pattern used with /, entered on the vim command line, can be very complex. But even for a normal regular expression pattern, syntax highlight of the expression syntax would be helpful. ...
38
votes
7answers
25k views

Show only matching lines?

In a long file, I would like to search for a pattern that will match roughly 200 lines or so. The matched lines are in random places in the file. When a line matches, only the line itself is relevant, ...
22
votes
3answers
2k views

How to write vertically?

Lets say I want to produce the following text in my document: % % Not Important % O -------------------------> % | % S | % o | % m | % e | % | % M | % s | % g | % | % ...
19
votes
2answers
3k views

What does :open do in vim?

Vim's documentation has this to say about the :open command: This command is in Vi, but Vim only simulates it: *:o* *:op* *:open* :[range]o[...
0
votes
1answer
175 views

Are there any platforms whose native `vi` is not vim, nvi, or original vi? [closed]

Just like in the title. I know most Linux distributions ship with vim and most BSDs use nvi, but I was wondering if there are any "obscure" versions of vi on some commercial UNIX or other platform, ...
3
votes
2answers
607 views

Why are ^ and $ still magic in nomagic mode?

In 'nomagic' mode, ^ and $ have a special meaning and no others do. Why were these selected, rather than making people type \^ and \$ just as they do for \. and \*? EDIT: I have been able to confirm ...
17
votes
1answer
2k views

Are Vim's regex magics compatible with well-known regex classes?

Many Unix tools' regular expression syntaxes are often the POSIX-codified Basic and Extended Regular Expressions (BRE and ERE, respectively), and, in some modern implementations, Perl-style (PCRE ...
21
votes
1answer
3k views

How can I get both splits to scroll left or right at the same time?

I want to open up two different parts of a document in horizontal splits (using :sp) and scroll both of them left and right together. For vertical scrolling, you would use scrollbind. However, I'm not ...
4
votes
1answer
192 views

Duplicating line content by substitution

I'm trying to vimify a task of editing bulk file move commands. I'm using Fossil-SCM to manage a bunch of files and have some changes in directory structure. To get SCM to grasp the move, I have to ...
4
votes
2answers
1k views

Can I get vim to fold comments when using foldmethod=indent

When editing Python files at work I have to include 20+ lines of boilerplate legalese at the start of the file. "start of the file" is not that strict: I'm allowed to include the Python docstring, and ...
9
votes
2answers
511 views

How can I create a pseudo insert mode with a different keymap?

I am in the slightly unusual position of using two different keyboard layouts on a regular basis (Programmers-Dvorak and Turkish-F). These layouts are quite different from each-other and I am only ...
29
votes
5answers
9k views

What is the easiest way to insert Unicode characters into a document?

When writing documents occasionally I want to insert Unicode characters into the text. Sometimes I know the character code and sometimes I look it up on the web. Currently I go to insert mode and ...
5
votes
4answers
892 views

How do I make dictionary completion look in a different file if triggered after the @ sign?

I have been using Vim as a research database, and I use tags in the form of @tag for each note, written in the second line after the title. I might have more than one tag. How can I make dictionary ...
6
votes
2answers
514 views

How to create syntax folding for pascal

I mostly want it to automatically create folds for between a begin and an end, although if there's anything more advanced that would be welcome too. I've looked in the help for the pascal syntax and ...
0
votes
1answer
260 views

Strange behaviour of abbreviations triggered with shift+enter in gvim+vim-latex

Playing with abbreviation in insert mode i noticed the following unexpected behaviour, when using gvim with vim-latex plugin: Defining an abbreviation such as :iab m <m> or any similar "...
19
votes
3answers
1k views

How can I make Vim position the cursor at the start of a tab character instead of the end?

Open an empty buffer and insert a tab character then exit to normal mode. When you place the cursor (normal mode) on the tab it will be at the right side of the whitespace. I'm looking for a way so ...
9
votes
2answers
2k views

How do I move to the last character in a sentence?

In normal mode ( and ) move to the previous or next first character in the sentence, respectively. How do I move to the very last character. If all of my sentences end with a period I can use )T. (...
105
votes
2answers
198k views

How can I use Vim as a hex editor? [duplicate]

Is there a neat way I can view binary files as hex in Vim, and save it back to binary from the hex?
0
votes
1answer
458 views

Quickest navigation within a buffer [closed]

Okay, here's the thing: let's say you have a buffer, 1000 lines long (a source code for example). And you want a super-fast navigation, jumping to the right place. Example: You are on a line 42, on ...
16
votes
2answers
5k views

How to tell vim not to try to unzip a file

I'm trying to open an .xlsx file in Vim, but got an error saying: ***error*** (zip#Browse) unzip not available on your system I know it's a binary file, but I want to do some checksums and ...
13
votes
2answers
982 views

Auto Highlighting identical lines text

I saw a skilled vim ninja do this a while back but I have no idea were to start. A) Is there a way to set up vims background colour so that consecutive lines with identical content get highlighted. ...
12
votes
2answers
293 views

Search all versions of a file in the undo tree

Is there an easier way to find a particular change in Vim's undo tree than just looking at random old versions of the file one at a time (either using vanilla VIM commands, Gundo, or another plugin)? ...
5
votes
2answers
639 views

Vim `cpp` Syntax highlighter prematurely ends macros mid-word

NOTE: This question is a "manual migration" from here: https://superuser.com/q/875751/199803 My Vim syntax highlighter for ft=cpp is prematurely ending some macros mid-line. For example: (The ...
12
votes
1answer
1k views

What bad things can happen if I use :bwipeout?

I have just discovered the :bwipeout command, for which the :help states: Like :bdelete, but really delete the buffer. Everything related to the buffer is lost. All marks in this buffer ...
26
votes
3answers
9k views

In Vimdiff, how do I switch the left and right panes?

When I do vimdiff file2 file1, file2 naturally goes on the left and file1 on the right. Sometimes I find that I put them the wrong way round, so I'd like to be able to switch them round without ...
37
votes
7answers
8k views

What is the easiest way to insert en dash in Vim?

To insert an en dash, I use ^v u 2014 which is seven keypresses. Is there an easier way? (I was looking at digraphs and didn't find en dash there.)
4
votes
1answer
538 views

Following a tag in a VimScript

I am working on an omni-completion script where I use taglist() to search for the existence of a certain word. After obtaining that tag I now need to quickly jump to where the tag is defined and ...
6
votes
1answer
580 views

Why don't I get syntax highlighting when I open a file in an autocmd?

While trying to devise a solution to How do I make vim look in a set of directories for a file, if it doesn't exist in the current directory?, I have got so far using Python: function LookupFiles ...
9
votes
3answers
1k views

Automatically close oldest buffers?

I needed to edit a lot of files recently for a small change in each file. To get to each file, I browsed through NERDtree and opened one file after another. As I opened more and more files, I ...
5
votes
2answers
214 views

Translating Keymaps to Ex Commands

Say that I have some semi-complex keymaps like the following: nnoremap <Leader>s :%s/\s\+$//e nnoremap <Leader>u mz:r!uuidgen<CR>dW"_dd`zp" nnoremap <Leader>d g/\v"([^"]|\n)*"\...
2
votes
1answer
145 views

inspect filter output in minibuffer or a new buffer

Would like to send a line to an external programme and inspect output in the minibuffer or a new buffer. Don't want the output to replace original text. How to do this? In gnu emacs there's M-| (...
2
votes
1answer
354 views

Why doesn't `nmap <tab> v>` work?

In my vimrc file, nmap <tab> v> doesn't work. But other key binding, such as nmap <s-tab> v< vmap <tab> >gv vmap <s-tab> <gv Do work. I tried to search for <...
10
votes
3answers
4k views

How to write a fold-expr?

I have read the help page about fold-expr (:h fold-expr) but it didn't explain what's the syntax used in the expression. There were there four examples: :set foldexpr=getline(v:lnum)[0]==\"\\t\&...
5
votes
1answer
676 views

Why I am losing syntax highlighting when folding code within a <script> tag?

I am working with an HTML file and within a <script> tag specifically. I usually fold my code using the marker method. However an annoying behavior sometimes happens with my syntax highlighting ...
3
votes
3answers
580 views

Command to create \begin{} \end{} environment in LaTeX

How can I make a command that allows me to insert LaTeX environments in the current text? The idea is to press Ctrl+E or type :texenv and then enter the environment name in the bottom line, e.g. :...
13
votes
1answer
1k views

Folding by regex search pattern

I got a plain text file with whitespace separated columns of values. Like this: AU 3030 .... ... .... AU 3031 .... ... .... AU 3032 .... ... .... AU 3033 .... ... .... IT 48100 ... .. ..... IT ...
176
votes
4answers
133k views

Why doesn't the backspace key work in insert mode?

Trying to delete characters in insert mode with the backspace key sometimes doesn't seem to work. I can backspace sometimes, but at other times it does nothing; the cursor doesn't go to the left, and ...
14
votes
2answers
2k views

Collapse vim folds to a single line, similar to Atom or Sublime Text

I'm a fan of the way that Atom and Sublime Text handle line folding, where the first line of each fold is visible (complete with syntax highlighting), and a marker is appended to the end of the line ...
8
votes
4answers
1k views

Put a process started with ! in the background

If I do this from the shell: $ sleep 100 I can make it go to the background by doing: ^Z $ bg And then continue using my shell. You can get the same effect by adding a & to the end of the ...
10
votes
1answer
6k views

How do I open a file to view in a new tab?

How do I open a file to view in a new tab? Specifically, I want the read-only equivalent of :tabe[dit] <filename>. I have tried :tab :view <filename> but that does not create a new tab ...
9
votes
1answer
381 views

Is there a way to write out the results of “:ls” to a file?

I have a bunch of splits up right now, and it took me a while to find these files (basically I'm chasing down a bug through 50 interconnected files). Is there a command like :ls > /tmp/filelist ...
104
votes
2answers
7k views

How do I navigate to topics in Vim's documentation?

In Vim's built-in help system, how do I… search for topics that I want help on? follow hyperlinks? browse around for related material?
13
votes
1answer
675 views

Can I add an end-of-line string when Vim wraps a line due to textwidth? [duplicate]

When I have automatic wrapping enabled, I can write some text like This line is starting to get fairly long so it has been wrapped If I start writing a comment, I get fairly sensible behaviour: # ...
5
votes
1answer
865 views

Perl folding with perl_fold_blocks

I have the below settings in my .vimrc relating to Perl code folding. When I type za to toggle folding, it works on any sub { } by just folding up the sub. However, if I za a non-sub block (e.g. ...

15 30 50 per page
1
178 179
180
181 182
187