All Questions

Filter by
Sorted by
Tagged with
0
votes
1answer
5 views

How do I map multiple replace commands in visual mode

I'm trying to edit my init.vim to allow quick, custom retabbing with one key. My current attempt is as follows (the replace text in the last command is a tab character inputted in insert mode): ...
0
votes
0answers
7 views

Format / Indent c++ as you type inside expressions

In visual studio, that code : for(int x=0;x<10;x++) {} becomes that code : for (int x = 0; x < 10; x++) { } as soon as you hit enter. I was wondering, is it possible, and if so, how can I ...
1
vote
2answers
12 views

NERDTree maximize on enter

I'd like to maximize NERDTree when I enter the NERDTree buffer. The command I have so far is: autocmd BufEnter NERD_tree_* <A> ...but the <A> part is wrong. I get the error: E21: Cannot ...
2
votes
1answer
27 views

How to make two windows equally high?

It seems that there is an issue with window-resize with Quickfix list window. In case of regular window and quickfix list window, how to make them equal in high? The CTRL-W- (and the CTRL-W+) works,...
1
vote
1answer
20 views

How to use the result of a function in a Vim keymap?

I have a function in Vim script that returns a string. " Return first directory with ".git" folder, if none is found " return the current directory function! s:project_root() for vcs in ['.git']...
2
votes
2answers
21 views

Add buffer space on line wraps

Is there a way to add some buffer space between the vertical separator and the content of a file in vertical split mode? Another way to say this: How do I force vim to not let a line touch a vertical ...
1
vote
1answer
23 views

Cancel command line completion insert

I notice a different behavior in command line completion from the regular completion in a buffer. Usually even if I select and item from the completion menu, CTRL-E cancels the completion and reverts ...
0
votes
1answer
20 views

Reload vim autocmd Filetype

I tried searching for this on the internet but I get bombarded with answers saying to :so $MYVIMRCwhich does not work if I add lines of the type autocmd FileType foo bar. What's a more efficient way ...
1
vote
1answer
36 views

Find project root relative to the active buffer

I can use the finddir function to find a parent folder that contains a .git folder (project root), like this: let dir = finddir('.git/..', ';') However, this only finds project roots that are parent ...
0
votes
0answers
23 views

How to recover file overwritten by vim

I used the command :Texplore to rename a file in vim's file explorer. I closed the buffer that read the old file name into memory, then opened the new file name using a new instance of vim only to ...
0
votes
1answer
18 views

When openning netrw in split view, the opened buffer I'm still editing clears when I click a line number

Wondering why this happens, if it is a bug or supposed to happen? [explaination] open vim, then proceed to split two windows, one with netrw and another with few lines of text (line numbers enabled). ...
2
votes
1answer
27 views

Syntax highlighting region messed up by matching parintheses

For a new filetype, I was trying to make block comments in the syntax highlighting but they kept disappearing while I was moving around. I have managed to reduce it to the following. First, in the ...
1
vote
0answers
28 views

Is there a keybinding that allows to scroll through the status line?

I was wondering if it was possible to scroll (left or right) along the status line so that the content (which could not be displayed due to the size of the window) could be seen. Perhaps there is a ...
2
votes
1answer
30 views

Update external file based on VIM mode

Currently I have my vim set up to update the statuslline based on what mode the editor is in. Like if I'm in insert mode then the statusline turns red. Magenta in replace mode. Green in command ...
1
vote
1answer
23 views

Adjusting pdflatex settings [on hold]

Ubuntu is my OS, and I have the Latex-Suite plugin installed. I'm trying to get pdflatex to output a .pdf file instead of a .dvi file, but it continues to output only a .dvi file (along with .log and ...
0
votes
0answers
29 views

My vim can't print Chinese right on my mac?

only the vim app can't show the Chinese right. I have checked the encoding, fileencoding and fileencodings configs, all of them are utf-8 at the first.
0
votes
0answers
29 views

Temporary normal mode doesn't wait for the command

When I press C-o in insert mode, the expected behaviour is that vim will wait for me to execute a single command and then returns to insert mode. Usually, after pressing C-o I have all the time in the ...
2
votes
1answer
52 views

! is required but not allowed for custom command

I'm using Neovim 0.3.7. I have a default session file that loads up a number of files I'm working on at the moment. To save and load the sessions I have the following custom commands defined: let ...
1
vote
0answers
24 views

Save :Man window in session

TL;DR: I want to persist :Man windows in sessions I am obsessed with sessions, and use tpope's vim-obsession for managing them. Coupled with a scripted tmux, sessions make for a perfect "quit, go ...
1
vote
0answers
25 views

send <cr> to ipython in :term

When I am developing some python script, I regularly find myself running part of the code to see if it does what I want it to do. Currently I do this by copying the code that I want to run to the ...
4
votes
1answer
46 views

Pressing Shift-Backspace in insert mode types '^?' instead of backspacing

When I mess up typing an uppercase letter, I usually hold Shift while pressing the Backspace. Instead of backspacing, it types ^? (to my frustration). Google tells me that ^? is the "delete" ...
1
vote
2answers
58 views

How to go halfway into a line? Percentage navigation within a line

I know that e.g. 50% is a normal mode command to go halfway down a file, but [count]% is line-wise. How can I get to the halfway point of the line that my cursor is on?
1
vote
0answers
26 views

Pasting non-text data (image) from system clipboard [closed]

I would like to write a plugin which will be triggered at paste from system clipboard if it contains image data. Is it feasible to do this with scripting? My preference is to write in Python, using ...
1
vote
2answers
57 views

Linking a filetype to a syntax file of a different name

I’ve created a new filetype, “usenet,” for Usenet messages. I would like files with this filetype to be highlighted exactly as if they had the “mail” filetype. Is it possible to tell Vim that I want ...
2
votes
0answers
14 views

How can I trigger the autocmd FileType commands for all buffers? [duplicate]

I have a key binding to reload my ~/.vimrc. However, some of my options set via autocmd FileType are not active after reloading the config. Those are to set the text width, creating highlights, etc. I ...
3
votes
1answer
36 views

How to treat underscores as whitespace when skipping to the next word? [duplicate]

Let's consider an example where the cursor is at the beginning of the text one_two three. Underscores are treated as part of the word, so w moves right to the first letter of three. With set ...
2
votes
1answer
36 views

Why does vim still auto-indent LaTeX after I set noai noci nosi?

I want to disable autoindent and smartindent for LaTeX so I did :set noai noci nosi When I open a brand new mwe.tex, filetype=plaintex and there is no auto indent magic. When I then enter some code,...
1
vote
2answers
44 views

Number column in Tlist window

I want to hide the number column set nonumber norealtivenumber in Tlist window! Every time I call :Tlist the number column appears in the window. How can I disable the number column for that window.
3
votes
0answers
33 views

Vimtex conceal doesn't recognize new command math environment

I recently added the vimtex plugin which includes a conceal feature which I really like; however, I found it doesn't work in custom math environments such as \newcommand{\beq}{\begin{equation}} \...
1
vote
1answer
101 views

Backspace functionality in normal mode

I'm trying to allow using backspace in normal mode. My best attempt is adding the following to my vimrc: nnoremap <BS> i<BS><ESC>l. This works great except for two situations: I'm ...
1
vote
1answer
24 views

vim and enhancedcommentify weird behavior for C

I am trying to use EnhancedCommentify plugin for vim and mostly using C. However I can't figure out the issue but when I comment/uncomment it uses (* ---- *) instead of /* ----- */. I tried to change ...
2
votes
0answers
22 views

Allow pasting into all modes, not just insert [duplicate]

I use command-line vim in xterms (actually TERM=rxvt-unicode) and have long been used to allowing X to manage all mouse interactions, with vim remaining blissfully unaware of the difference between ...
1
vote
1answer
38 views

How to send messages from terminal to Vim using the JSON API?

Vim 8 built-in terminal allows communication to and from a running job. The manual describes a terminal API :h terminal-api that lets a running job to Vim. An example message is provided to open a ...
3
votes
1answer
86 views

Replace from the current position to the end of the line

Is there a way to search and replace replace from a specific position in the line to the end of this line? I am here and you are there ^ I tried to show cursor position with ^. For instance,...
2
votes
0answers
44 views

Vim has started adding commas unnecessary places [duplicate]

When I use :w to save my JSON file, vim automatically adds some commas at syntactically significant (?) places.  It does not happen when I use :x or ZZ.  This started today.  I did not change anything ...
0
votes
2answers
57 views

Review: git branch in statusline

I am learning vimscript, and below the part of my .vimrc used to display the current git branch in the statusline. I am aware that there are ready-made options out there, but this is more of an ...
2
votes
0answers
35 views

How do I delete a block a text using the mouse cursor?

Yes, I know this is unconventional, but I just want to know. When I right click on a chunk of higlighted text, the dropdown doesn't show any option for deleting - just copy, copy as html...show ...
2
votes
1answer
18 views

How to prevent vim from highlighting random words and types

I've been trying to disable vim from highlighting random words and types for a few hours now. I've noticed vim will highlight specific types when I write python and golang programmes. Even my .vimrc ...
0
votes
1answer
25 views

Option doesn't happen when opening vimrc?

I added this line to my .vimrc: set formatoptions-=ro. When I open any file it works as intended, except if it is .vimrc. In that case it doesn't work. Why does this happen and how to fix it?
1
vote
2answers
53 views

How to move a cursor to the last line with auto indent?

Assume autoindent is set, and you have the buffer below. Note the cursor is represented as I. for i in range(1, 6): print(i)I When you hit Enter key, you get this. for i in range(1, 6): ...
2
votes
0answers
40 views

Cycle between modes in fzf.vim

I'm using fzf.vim instead of ctrlp.vim for quite some time now but there is one functionality that a miss quite a lot. In ctrlp.vim once you have the extension opened you can cycle between modes using ...
0
votes
0answers
18 views

Vim what the :c command do? [duplicate]

On vim I enter for a mistake the :c And I can exit only with ctrl+c What the command :c do?
3
votes
1answer
22 views

Float YCM completion candidate list to make more of entry previews visible?

Using plugin YouCompleteMe, I get useful previews of entries. However, if the cursor is near the end of the line, the list gets out of sight. Screenshots below; the latter with pumwidth=75. (First ...
3
votes
1answer
26 views

How do I get the text that is chosen by some motion?

I'm wanting to write a simple plugin that allows using a motion to choose some text and then processes that text. I'm trying to find out how to get the text that a motion results in. So far I haven't ...
2
votes
1answer
29 views

copy or yank from line x until line y

I know about :yN for example , :y10 , yank 10 lines from current line. I need to yank from line 73 until line 81, How can I do it?
2
votes
2answers
32 views

abbrev for multiwords

How to add abbrevs made of more than one word? I've been trying: iabbrev a aquilo àquilo iabbrev a aquele àquele iabbrev a aquela àquela What I want to do is have the two words "a aquilo" expand to ...
1
vote
1answer
21 views

Is it possible to do consecutive vimgrep searches to refine and filter results?

If I do a grep search within vim, I'll get a list of results that I can browse using :lopen. Is there a way to do a subsequent search on only these resulting files? Basically I want to do refined ...
0
votes
1answer
28 views

Add a line after 1 line after match in Ex mode

I need to search for a string in a file, then I need to some text after one line following the first match. I need to perform this for a number of files in a script. I am trying to use vim ex mode ...
0
votes
0answers
30 views

unable to copy to system clipboard with +clipboard and +xterm_clipboard in vimx

The system is Centos7.2. I have installed vim-enhanced and vim-X11, used vimx command. It shows that vimx supports clipboard and xterm_clipboard. But in vimx, there is no reg + and reg *. I can't ...
1
vote
1answer
20 views

Switch pyflakes linter from python2 to python3 in ALE

pyflakes (with ALE) automatically defaults to python2 instead of python3 and gives me false errors and there are no variables in ALE documentation letting me change python versions. Thanks for any ...

15 30 50 per page