All Questions

Filter by
Sorted by
Tagged with
4
votes
1answer
123 views

Is it possible to put vim comments in lines that include `iabbrev`

Is it possible to put vim comments in lines that include iabbrev, as in: iabbrev hte the " common typo
10
votes
3answers
299 views

Alternative to escape slashes in search and replace for long strings

Is there any alternative in vim search and replace for strings, than having to escape every special character in string. For example, If I want to match following string and replace with something [...
29
votes
2answers
3k views

Why is Y a synonym for yy instead of y$?

Is there a specific historical reason for this? Background — (you can skip this part if you already understand the question.) As intermediate/advanced vi users will know, y is the "yank" command—it ...
2
votes
1answer
842 views

Vim's dbext with postgres

Has anyone successfully configured a postgres database in vim's dbext ? I see only configurations for mysql or sqllite. I included the following code in .vimrc: let g:dbext_default_profile_mydb='...
4
votes
1answer
928 views

How to insert a file path with tab- or autocompletion relative to the current file's dir?

I am in vim in the .gitignore file. I now want to add a file path that already exists on the current dir, e.g. ./app/poit/narf/auth.json I don't want to type it though, I want to navigate to that ...
3
votes
1answer
794 views

How to make auto-indentation work correctly after macros ending with semicolons

I'm using cindent with C++ sources, and when I put some macro, which already ends with a semicolon, like Qt's Q_OBJECT, cindent doesn't understand it and makes an extra indentation on the next line. ...
2
votes
3answers
90 views

Why aren't :g/X/d changes saved in Ex?

I've the following file (which is a simplification of the hosts file): 126.0.0.1 127.0.0.1 128.0.0.1 and I'm trying to invoke the following command: ex +g/127/d -cwq file which is supposed to ...
6
votes
0answers
36 views

Expand strings into multiline strings on line wrap [duplicate]

This is a feature in Eclipse that I would love to find a solution for in Vim. I have Vim set up with tw=80 so that the lines wrap at 80 columns. When I'm in the middle of a string, and the line ...
3
votes
1answer
575 views

Special characters in iskeywords

I wonder how one can add characters such as (yes, space!), ' (single quote), " (double quote), etc., to iskeyword. This is not a theoretical exercise. The purpose is iabbrev for these. I noticed that ...
2
votes
2answers
819 views

How to test if Vim supports <C-g>U?

I would like to make some modification to the code of this plugin. It adds / changes some default keybindings. Among them are <C-b> and <C-f> which move the cursor one character to the ...
17
votes
3answers
2k views

How can I use Readline shortcuts in the vim command line?

When I'm editing a Vim command, I would like to use the same shortcuts as in Bash and every other REPL: M-b to go back a word, M-Backspace to delete a previous word, M-u to convert the word to ...
3
votes
1answer
375 views

How can I remove the argslist files from the buffer list?

When using the args list, Vim adds those arglist files to the buffer list. Once I'm finished with the argslist, I then have many unwanted argslist files in the bufferlist. They don't have a contiguous ...
4
votes
1answer
734 views

How to save previous cursor position inside a function which has received a range?

I have the following code in a file: function! s:TrimWhitespace() abort range " Save cursor position, because the following substitution will move it let save_cursor = getpos('.') " ...
6
votes
1answer
3k views

How do I convert a String to a Number, catching invalid strings?

I am trying to convert a String '1' to a Number (int) 1 in a vimL script. I have used the built-in command str2nr() so far, however I was not able to write this in an elegant and effective way. ...
3
votes
1answer
129 views

Make vim respect custom, defined paragraph when formatting text?

Let's say I have that text in my file: At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias ...
5
votes
2answers
504 views

How do I make Vim respect Markdown headers when formating text?

I want to use the combination gggqG to go to the top of the file and format the whole file from there, so that it fits into my 80 col textwidth border. But when I do, vim ignores my markdown headers. ...
6
votes
2answers
2k views

How to wait for user input in the middle of a mapping?

I want to make a mapping that does the following: nnoremap <F1> oHello, (user inputs their name. Ex. Jason). You have a very nice name.<ESC> This mapping should make a non-recursive map ...
12
votes
1answer
827 views

Where do custom highlighting rules belong?

Occasionally I want to override the default syntax highlighting colours and styles with my own preferences. I imagine the most appropriate way to do this would be to create my own colorscheme. ...
5
votes
2answers
644 views

how to perform multiple grep passes by using piping in external shell?

When I want to recursively search files for a text pattern I use :grep -R 'color:' . Vim then lists the results in a quicklist window for easy access. But now I need to perform another grep pass to ...
4
votes
1answer
444 views

Understanding :help set-termcap

I would like to define some mappings involving key combinations like <S-F1> or <A-d>. For example something like this: nnoremap <A-d> :echo "hello world!"<cr> However, on my ...
6
votes
4answers
1k views

Is it possible to populate the quickfix list with the errors of vimscript functions?

I often write functions in my ~/.vimrc or in ~/.vim/autoload/myfunctions.vim, which when executed result in an error such as: Error detected while processing function SomeFunction: line xx: ...
5
votes
2answers
3k views

Do a forward slash search but don't have vim immediately jump to the string?

When I do a /someStringtoFind in vim it immediately jumps to the closest matched string. Almost always this is what I want it to do. Sometimes though, I want to be able to enter a string to find and ...
4
votes
1answer
102 views

Can my mapping/function detect when count/range 1 is given instead of none?

I have a key mapped to a command which runs a function, and I would like to detect whether it has been passed a range (prefixed with a count) or not. The difficultly is that I need to be able to ...
2
votes
1answer
1k views

How to insert the square number symbol (small 2) in vim? [duplicate]

I need in vim input the following Numbers: 23²,66²,38³ How to insert this number?
2
votes
1answer
281 views

Minimal to effort to have a JS beautifier on vim

My research hints that there is no way to have a JS file properly formatted without going through installations. I wonder whether there is a minimal effort way of doing it in vim. What are your ...
12
votes
2answers
5k views

How to join all lines together which matching pattern?

I would like to join lines together only for lines which have certain pattern (such as ;), however when using g/;/j it doesn't work as expected unless called couple of times. For example the ...
2
votes
1answer
329 views

Scroll without changing the cursor position

Frequently when using vim I will hit a case where I am looking at a function that is half off the bottom of the screen, and I would like to see the whole thing. ctrl-D will generally solve the problem ...
5
votes
1answer
150 views

Text formatting CVS-friendly

I have seen this very interesting article: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/ --- basically it is a suggestion for hard-breaking lines of text (for example, in ...
1
vote
0answers
444 views

Location list, preview window, autocompletion

I have the following problem. If the location list is open (e.g., by Syntastic) and some other plugin opens a preview window (e.g., YCM or jedi-vim), the cursor goes in the location list. Example: ...
11
votes
2answers
2k views

Is Vim's default 'path' option redundant?

From Vim's help document (see: :help 'path'): 'path' String(default on Unix: ".,/usr/include,,") -To search relative to the directory of the current file, use: :set path=. -To search in ...
5
votes
2answers
203 views

How to set incremental marks?

I'm used to set marks with m<char> where <char> is any character I choose and then reaching the marks with ]` or [`. I'm wondering if it is possible to use a command to set a mark with an ...
5
votes
1answer
588 views

vimrc tab behavior when noexpandtab and softtabstop is less than tabstop

Questions In the following example: Why in the first line, a \t is inserted but only 4-col blank is displayed? Shouldn't it be 8 according to tabstop? Why the two <TAB> hits in the first line ...
20
votes
5answers
9k views

Is it possible to pipe vim commands to vim?

I want to run the following shell. wea-this is the end of the second word | vim j exit 0 Which I had hoped would pipe the key strokes w (move forward a word) then e (end of the word) then a (append) ...
4
votes
1answer
102 views

Mapping { with Vimscript

I have been trying to map { in insert mode to the following if the line contains any character other than blank or tabs: <CR>{<CR> and to {<CR> if the line is blank (contains at most ...
7
votes
3answers
159 views

mapping to enclose symbol under cursor with an expression that contains the symbol

Have been reading vim scripting posts for an hour, but I'm afraid I don't have the skills to apply these posts to my problem. Editing math in latex documents, I'm frequently wanting to replace math ...
3
votes
1answer
244 views

How to run a function without getting prompted to continue?

In order to keep my tags file up to date I wrote this function which runs ctags -R . whenever I save a file. function! UpdateCtags() " assume if a tags file exists - then current dir is ok if ...
7
votes
1answer
3k views

I can't move around the document while editing

I am working on a ChromeOS computer with both Vi and Vim. When I open up the editor to an existing document, I type A to begin editing. When I try to move around with my arrow keys, the following ...
1
vote
1answer
156 views

Why does the source code of Vim have a folder named farsi in the root directory?

While looking through Vim's source code, I notice that it contained a folder named farsi in the top directory, created 9 years ago. The commit message seems to be just updated for version 7.1a. Why ...
8
votes
1answer
305 views

How to escape significant keywords from syntax files?

I came accross this line in a syntax file.. it does not work: syntax keyword Type Transparent I guess this has something to see with the fact that transparent is a significant keyword for Vim. What ...
0
votes
1answer
57 views

can't find syntax highlighting for offlineimaprc

i can't find any syntax highlighting for offlineimaprc files. Because of vim has normally for everything syntax highlighting (even for esoteric programming languages!), this makes me wondering. Did ...
8
votes
1answer
1k views

Exuberant Ctags - Duplicate tags problem

Here is a file -- ChipBooter.cpp -- in my project(Omit some details that are not related to this question): class ChipBooter { public: void Boot() { this->DpDetect(); } void ...
7
votes
2answers
840 views

How to jump back to the cursor position before I entered insert mode?

I'm trying to set up normal mode mappings to make it easy to add white space around the cursor: <C-h> will add one space to the right of the cursor; <C-j> will add a newline below; <C-...
3
votes
1answer
463 views

Neovim Python script hangs

I'm thinking of migrating from Vim to NeoVim. I decided to begin with a bit of Python code in my .vimrc that sets the backup directory. Using the documentation, I wrote the following script: "-------...
2
votes
0answers
44 views

How do i move all lines from curser and below up one [closed]

Instead of pressing backspace multiple times to move lines up one, is there a vim shortcut/command that can do this? I know you can move a single line up or down with :m - or +, so I figure it there ...
2
votes
0answers
609 views

what is the correct codepage to use with vim airline?

Ok so I have setup my .vimrc as followed but I'm still experiencing a few problems with it: let $VIM=/usr/share/vim/vim74 let $VIMRUNTIME=/usr/share/vim/vim74 execute pathogen#infect() " air-line" ...
6
votes
1answer
93 views

Automatic name for new files

For new files, Sublime Text changes the file name to the first line of the file: Is it possible to achieve this on Vim?
3
votes
0answers
107 views

Strange characters appear after leaving insert mode on Windows

I use Vim v7.4 on a Windows laptop. Recently, I copied my .vimrc from a Mac, only to find that every time I leave insert mode, a sequence of strange characters will appear: These characters (right ...
12
votes
3answers
7k views

Substitute with pure vimscript (without `:s`)

I have the following in my vimrc: func! AddSpaceBeforeEqual() s/\([a-z)_0-9"'\[\]]\)=/\1 =/ge endfunc I'm using vint to lint my vimrc, and got the following warning : ...
4
votes
1answer
434 views

Swap command line and status-line?

Is it possible to swap the order of the command line and status line, such that the status line is flush with the bottom? Or better yet, completely disable the command line - but I understand that ...
2
votes
1answer
880 views

Still force new line at end, but show it too?

Some people prefer not to end a file with a new line. I'm not one of them. In fact, I want to see that it's there! How can I keep this 'force new line at end' behaviour, but show it in the editor? I ...

15 30 50 per page
1
153 154
155
156 157
190