All Questions

Filter by
Sorted by
Tagged with
3
votes
1answer
957 views

How to define a custom user defined command to filter a range?

I want to select some lines in visual mode, and enter a custom command :Ex<CR> so that: '<,'>!expand -t4 is run to expand all tabs in selected range. How to define the Ex command? I ...
7
votes
3answers
153 views

Reusing search pattern in ex mode

Sometimes I want to try a pattern with / before doing :%s/ …; can I reuse it without having to type it all over? (or use the mouse.)
1
vote
2answers
89 views

How to create a mapping to replace all non word characters at the beginning of a line?

I'd like to quickly replace all non word characters up to first word \w character with a space. ----So that this line becomes So that this line becomes ----------------And this line looks like ...
7
votes
1answer
2k views

How do I get back to the previous line after moving?

I am new to Vim. My code file has 300 lines. Suppose currently the cursor is on line 254, and I used gg command the cursor turn to line 1. I want to go back to line 254 but I forget that line number. ...
2
votes
1answer
2k views

vim indentation setup - Ruby [closed]

I have a problem with indentation using vim. Lets say I have a file: class My end // <-- cursor is here When I press O vim will create new line in between class and end and it will be indented. ...
8
votes
2answers
236 views

How can I make vim stop splitting my words into chunks?

English language users probably don't have this trouble, but vim is pretty dumb when it comes to regular expressions. In my case most letters in the Turkish alphabet outside the EN alphabet don't seem ...
10
votes
3answers
2k views

Is it possible to create mappings with parameters?

I have created a few mappings like so: :nnoremap <buffer> <leader>xyzABC :call SomeFunc('ABC')<CR> :nnoremap <buffer> <leader>xyzDE :call SomeFunc('DE')<CR> :...
3
votes
1answer
150 views

How to convert code to html **with** arbitrary html page breaks?

Thanks to @BobHyam's question and to @BenjiFischer's answer on the list vim_use@googlegroups.com, I found out how to print to hardcopy while integrating form feeds: in ~/.vimrc " ^L by analogy, ...
3
votes
1answer
244 views

Insert subsequent numbers in a substitution pattern

I want to insert subsequent numbers whenever there a regex matches. I do this in terminal using for command and either perl or sed. Is there a way to do this in vim? Basically I want this: This ...
2
votes
1answer
89 views

How do I combine system() and “start” in a Windows environment

I am currently using gvim in an MS-Windows environment. As part of a vim script function, I need to open a pdf file. So I call system like so: call system(l:pdf_file) This opens and displays the ...
1
vote
0answers
31 views

VIMRC changing Search Highlighting [duplicate]

My current VIMRC contains the below. I am using the correct colorscheme but it is not accepting my changes for the terminal search highlighting. If I input the :hi command by hand it works. Do I need ...
4
votes
1answer
133 views

Alert for repeated word in spell checking

According to :h spell Vim only checks words for spelling, there is no grammar check. It does however alert with a green wobbly line if a sentence begins with a small letter. Is there a way to have ...
2
votes
1answer
1k views

Undo diffget in vimdiff

Say I have a merge conflict in Git, and try to resolve it with vimdiff using diff3 view. Here is a screenshot: Now while resolving, I want to diffget once from LO see how it looks like, undo, and ...
8
votes
2answers
465 views

How do I execute “ctags -R” on saving *.h and *.cpp files without a confirmation prompt?

This is a noob question, so basically in vim I want to run ctags -R when I am writing to my source or header files (*.h or *.cpp) so I tried the following: autocmd BufWritePost *.cpp :!ctags -R ...
3
votes
1answer
149 views

What are these `E88` shortcuts in the manual?

I'm using gvim version 7.4.205 for Windows, if that matters. If I type :help :bp, it shows the help for :bN and :bp: :[N]bN[ext][!] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88* :[N]bp[...
4
votes
1answer
1k views

How to load plugins from my vimrc and from another file?

I have my dotfiles synchronized on github which is a current practice. As I use several machines I want to be able to have some part of my configuration not synched on my github repo. To do so I ...
0
votes
1answer
1k views

Why does vim create a new file when opening an existing file?

First and foremost, I'm using Arch Linux. I have a file dir/data.tex. I execute this command in terminal (when in the dir directory) $ vim data.tex I get the following output: "indent" [New File] ...
1
vote
0answers
163 views

Is it possible to start python thread from inside Vim under HP-UX?

I've compiled Python 2.7.10 and Vim 7.4 with Python support (HP-UX 11.31 ia64). Everything seems to be working well except for threads. Here's simple example. from threading import Thread from time ...
4
votes
1answer
537 views

How to change the color of the modes names (--INSERT--, --REPLACE--, --VISUAL--, etc)

What is the color scheme property for the mode indicator (that says --INSERT--, --REPLACE--, --VISUAL--, etc) that appears at the bottom of the screen? I would like to change this because the color ...
2
votes
1answer
149 views

gvim cmd line offset issue when doing horizontal splits?

Not sure how to explain this but basically I'm using an external plugin/dll to enable fullscreen in gvim (which is very lame since this should be a built-in feature...). The problem in when I open a ...
2
votes
1answer
275 views

Vertical motion within one column

How can one move vertically, staying in the same column (implicitly adding spaces), regardless of line lengths? (If the next line is shorter than the current, j will move the cursor to the last ...
1
vote
1answer
510 views

How do I use input() to get the name of a new composer project from the user?

I often start new projects in the same way. I guess it exists a way to be fast a starting a project. For example: I am trying to start new composer project with the following function. I perfectly ...
4
votes
1answer
760 views

Call function from string name

I am trying to achieve the following : Having a set of predefined functions in my script Having a map of relation between the functions and their argument Calling the functions with their argument ...
0
votes
1answer
397 views

Why is Vim echoing “Already only one window” when starting from terminal?

I am using Ubuntu 14.04. Recently I installed the solarized colorscheme for vim and the gnome terminal. After the installation I have noticed when I try to launch vim from the terminal, instead of ...
2
votes
0answers
163 views

How to match patern inside a syntax region start pattern?

Python group regexp has this syntax (?P<idGroup> ... ), where: (?P<idGroup> is the beginning of a region. ... is the content of the region. ) is the end of region. I highlight start ...
2
votes
2answers
63 views

Deleting a Latex command multiple times

Indexing a Latex document, I added a lot of \index[]{} commands in \footcite prenotes. It's stupid! Anyway, in my code I have a lot of : \footcite[blabla blabla\index[n]{something} blabla.][postnote]{...
4
votes
1answer
120 views

Workflow for editing file in same (deeply nested) directory

I currently use Vim for Java development. I use maven and for a small project I typically begin by running vim . or vim pom.xml from terminal at project root and :argadd **/*.java to add all the ...
2
votes
0answers
690 views

Gvim rendering artifacts?

I'm running Gvim 704 on Windows 7 Ultimate x64. Sometimes for some unapparent reason I get these blue dot artifacts: I'm very minimalist when it comes to plugins, I only use pathogen, ctrlp, ...
3
votes
0answers
2k views

How to Make gVim Transparent

I am using Vim on Arch Linux. One thing I like to do is using my transparent terminal I can be editing a latex file and have it automatically compiling and showing behind what I am writing. Is there a ...
1
vote
1answer
443 views

Search for %, $ using :Ag

How can I search for queries including %, $ and the likes? I tried to prefix then with '\', enclosing in quotes, but it only makes it worse: :Ag "$r" || ERR: Error: No query. What do you want to ...
17
votes
1answer
16k views

Why am I getting a “E488: Trailing characters” error on this custom command?

I have a ~/.vimrc that contains just this: function! NewFile() let filename = input("Filename:") endfunction command NewFile :call NewFile()<cr> (of course my real .vimrc is more ...
2
votes
1answer
1k views

How do I access variables in if statements?

Following on from Put variable to line above current line VIm I added some logic to only run if the begin and end tags in the list are present, snippet .... let findStart='<'.taglist[s1].'>' ...
0
votes
1answer
856 views

How to Write File Name Specific Snippets Using UltiSnips or Otherwise

I have been using the plugin called Ultisnips and it is great. But I am looking for the following feature. Suppose I have two files history.tex and geography.tex which I edit regularly. I want to ...
14
votes
4answers
2k views

How can I convert words to camelCase in a macro?

I have a list of words, like this: these are some words that I want to convert to camel case I need a way to turn, for example, camel case into camelCase within a macro (or a way to turn every line ...
1
vote
2answers
602 views

Open Gstatus in new tab

I am using the vim-fugitive plugin and I encounter a strange behaviour. I don't know if it's really related to the plugin or not. I am trying to open the Gstatus page in a new tab. So I am creating a ...
4
votes
1answer
1k views

How to abbreviate(ca) normal command with “Esc” and “Enter” key?

Yesterday I'm trying to make a doc command abbreviation for python. The original command is normal 0i"""^M""", which works in command-line mode. But failed when using alias doc defined by ca doc ...
1
vote
1answer
170 views

How to let the cursor push the screen instead of the the screen drag the cursor when scrolling with the mouse?

How to let the cursor push the screen instead of the the screen drag the cursor when scrolling with the mouse? I switched to iterm 2 on osx, but in the regular osx terminal when i scroll the ...
2
votes
1answer
1k views

Language-Specific Configuration: ColorColumn [duplicate]

I used set colorcolumn=80 and set the color to red in the python.vim file. Works like a champ - even for all other files. I'd also like to set colorcolumn=110 for C files though; this one has been ...
0
votes
1answer
647 views

How to put each Word in a varying space delimited file on a new line?

Basically I'm transposing my one record with many columns to many records in one column. A non-whitespace character begins a Word. I'm using gVim on Win7 so I need to use CTRL-Q<CR> as my new ...
22
votes
3answers
39k views

How do I stop recording while in command line?

When I am recording a macro with q and I am done, I can type: q to stop recording if I am in normal or visual mode. <c-o>q to stop recording if I am in insert mode. .. How do I stop recording ...
3
votes
1answer
176 views

Use motion when putting

A very common use case I'm having is to copy something (let's say a word) and I want to paste it in another context (let's say a word with quotes). The way I do it is: const char *foobar(void) { ...
16
votes
3answers
2k views

Why does vim allow integer division by zero?

I just discovered that vim obviously allows division by zero: :let a=42/0 :echo a prints 2147483647 (which is the value of a). Is this documented somewhere and why does vim allow division by zero?
3
votes
2answers
2k views

Vim Still Flashing When It Shouldn't Be

I have the following lines in my .vimrc: " No annoying sound on errors set noerrorbells set novisualbell set t_vb= set tm=500 Which I believe should disable all visual/audio bells and flashes. ...
3
votes
1answer
94 views

Syntax highlighting for StackExchange markdown

I often "pre-compose" and save my longer questions for StackExchange usign Vim / GVim. Does a syntax highlighting file for the StackExchange markdown already exist? If yes, where can I obtain it? ...
12
votes
1answer
1k views

How to record my keyboard input to do statistics on it?

I would like to find out what are the most common patterns i'm using during coding. So I'm looking for a way to record all my keyboard input while i'm in vim, preferably with timestamps. Then I could ...
2
votes
1answer
399 views

Run following command even if previous command fails to run?

I have shortcut map in gVim like nmap <a-k> SomeKeySequence:SomeCommand, it seems the last command will not be run if the previous key sequence aborted (like no valid operating target then bell ...
0
votes
1answer
136 views

Why is division of a negative number by 0 not the minimum number? [duplicate]

Related to Why does vim allow to divide by zero, what's going on here? :let a=-42/0 :echo a -2147483647 :let b=a - 1 :echo b -2147483648
2
votes
2answers
548 views

Toggle bold highlighting for comments in term/GUI

Currently, I use this: map <F7> <Esc>:if has("gui_running")<Bar>hi comment gui=bold<Bar>else<Bar>hi comment cterm=bold<Bar>endif<LF> It turns comments bold ...
7
votes
2answers
919 views

How to easily search in the list of existing mappings?

From time to time I want to search on the list of my currents mappings. I search either for mapped keys (what /<Space>a does?) or for a command (What keys are mapped on /MyFunction()<CR>?) ...
2
votes
2answers
554 views

How to convert series of commands into a Vim Function?

I currently run a series of commands on any file I am working on to compress the lines. That series is - G:a PRESS ENTER KEY . :g/^./ .,/^$/-1 join So I press S-g, S-:, a, enter, ., then run that ...

15 30 50 per page
1 149 150 151 152 153 167