All Questions
12,271
questions
0
votes
2
answers
24
views
Why is my colorscheme showing weird colors?
I recently (few days...) updated Vim on arch (via the package manager), and I've noticed something about colorschemes has changed. However, I don't understand why I should see color changing if I don'...
0
votes
0
answers
5
views
Is there a way to restore a previous version of file in vim
I had a swp file with old content, to which I restored and wasted much cleaning it. So I would like much such feature.
4
votes
1
answer
246
views
Is it possible to break out of nested loops?
Say I have a nested loop, is there a way to break out of the outer loop from the inner one? For example this code:
for i in range(3)
for j in range(5)
echo i j
if i == 1 && ...
1
vote
1
answer
16
views
Check if VimPlug is installed in .vimrc
I'm trying to have a .vimrc that is portable between machines. Some computers I use have VimPlugin installed, while others don't. On the ones with VimPlug, I'd like to do some setup using call plug#...
0
votes
1
answer
16
views
vim - why is the cursor different in different terminals
I have vim 8.2 installed on my Debian machine and when I open it in a gnome-terminal it has a solid non-blinking box as a cursor.
But when I open a "pure" terminal with ctrl+alt+F3 and open ...
1
vote
1
answer
76
views
A multiple movement of the cursor
For example the code below,
1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
The arrow key moves the cursor from one character to the left, ...
1
vote
0
answers
9
views
Why zc fold all the sections at the first time?
I have just the following two lines in ~/vimrc to set vim's foldmethod to marker. I do not want all sections are collapsed when the document is opened. So I use nofoldenable to open all marked ...
1
vote
0
answers
27
views
How to Make Macros Stop with Custom Motion?
I am writing a custom Vim motion. The problem is that when used in a macro (especially at the end of a macro), the macro does not automatically stop when the motion no longer applies.
For example, if ...
0
votes
0
answers
11
views
zf add fold marker comments with preceding spaces
Setting foldmethod=marker, I can highlight a few lines, press zf to fold them. By default vi will add {{{ and }}} at the ends of the beginning and ending lines. I am working on shell scripts with ...
0
votes
1
answer
18
views
!v command UNIX - relation to Vi or vim
Whenever I type !v command in the UNIX terminal, in a particular directory, my vim editor opens with the file "hello.txt" which I have never created in that same directory or anywhere.
What ...
1
vote
1
answer
13
views
How to have netrw ignore executables?
When I use netrw with the :Explore command I see that binary/executable files are highlighted in orange and have a little * start next to them, so I guess it can recognize them without having to rely ...
0
votes
0
answers
34
views
What is the significance of duplicating syntax-group name references?
According to :syn-define,
several syntax ITEMs can be put into one syntax GROUP.
Am I correct to infer that, regardless of the number of ITEM
instances, e.g.,
syn keyword alphaBeta alpha beta
syn ...
0
votes
1
answer
35
views
How can I get netrw to not move the cursor when I return to it
When I open a directory in netrw by opening vim like vim ., it will show me a list of files in the current directory. If I find a file then press t it will open that file in a new tab, when I'm done, ...
1
vote
2
answers
25
views
How to find/highlight a word in the current line only
As title. The current problem is that my window is scrolled to the first/next(?) global occurrence. But I just want it to move my cursor to the local one, i.e. the current line, if any.
0
votes
0
answers
20
views
How to use command to insert a space in insert mode?
As title. Given that I'm already in insert mode and there is some insert mode function. Inside the function, I want to insert a space by command, how?
0
votes
0
answers
23
views
How can I align chained methods in Ruby files?
I often use = to indent lines but my configuration doesn't fit my needs.
Is there an option that indent lines like this:
'vim rocks'.capitalize
.concat(' !')
Instead of this:
'vim rocks'....
1
vote
1
answer
55
views
What factors control the color scheme in a terminal?
I am trying to use VIM through new "Windows Terminal" app on a Windows 10 operating system. The VIM app is installed inside a debian WSL app.
I can't wrap my head around how the entire color ...
0
votes
0
answers
18
views
How to switch to normal mode after expand emmet in vscode?
I am using vim in vscode.
And after expand emmet abbreviation, cursor goes to insert mode, and autocomplete don't work.
It work just if go to normal and back to insert mode.
I think is better to go to ...
0
votes
2
answers
37
views
How to "enter" the selected folder in the vertical wildmenu?
When using the vertical file/folder wild menu (ex: pressing Tab after :e or :cd ) and focused on a folder, is there a way to map a key to "move" inside that folder, and pick one of it's ...
0
votes
1
answer
27
views
How to map a sequence of vim commands to a shortcut?
I have the following sequence of vim commands I use to copy a function va{Vy, how can I map this to a shortcut key like F1? I'd also like to persist this.
0
votes
0
answers
13
views
HTML Lsp missing format shortcut
I'm having a problem in Neovim with Lsp formatting in Html files.
:checkhealth is Ok
:LspInfo is Ok, html is attached
I have a shortcut for formatting,
buf_set_keymap("n", '<space>fo', ...
0
votes
1
answer
14
views
Upgraded my mac OS and now the vim colors are different. Is there an easy way for me to change the default syntax?
I upgraded my mac to Catalina and now the vim syntax looks all off to me. I am sure that strings used to be red, and I think that def used to be turquoise and import was pink. Is there a simple way ...
2
votes
1
answer
26
views
vim-workspace does not save set options
I want to have a persisting vim setting in my workspace. The vim plugin vim-workspace seems to be the obvious solution for this. Yet it does not save some options.
For instance I want to have my spell ...
0
votes
1
answer
18
views
Configure the statusbar to show rows
I want to configure the statusbar in vim to show which row I'm on. I have it currently set as
statusline=%l/%L\ (%3p%%)
I want however to do something like the following
statusline=%3l/%3L\ (%3p%%)
...
0
votes
2
answers
22
views
How can I strip footnotes using :global?
I have a very large table covering many pages in a document. The same footnote appears under the table on every page and I want to strip the entire document of these lines so I'm left only with the ...
0
votes
0
answers
6
views
Build errors when installing neovim from source in Debian ModuleNotFoundError: No module named 'ninja'
I am facing some build errors in building Neovim from source in Debian (MxLinux). I tried the package installer and was able to install Neovim, but it is an older version. So, I installed all ...
0
votes
0
answers
20
views
How to use tzachar/cmp-tabnine in NvChad?
This are the installation instructions for tzachar/cmp-tabnine using Packer:
return require("packer").startup(
function(use)
use "hrsh7th/nvim-cmp" --completion
use {'...
0
votes
1
answer
17
views
How can i use Enter to select item from popup menu?
I am using UltiSnippets
let g:UltiSnipsExpandTrigger='<None>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<S-b>'
let g:coc_snippet_next = '<...
3
votes
2
answers
28
views
search for sentences that contains a few keywords (that is not in proper order)
Is there script or function for vim to do search of words that is not in proper location (sorry, i don't know how to put it in question) ?
Example:
This is a vim user who like the functionality which ...
0
votes
1
answer
45
views
Executing Python scripts in Vim such that Vim remembers previously run code
Supposing I have the following python script open in Vim:
a=1
b=2
c=a+b
I know that I can type
:! python3
in normal mode either for the whole script or by selecting the rows that I want to run in ...
2
votes
0
answers
25
views
How to remap deleting a word in insert mode?
My terminal emulator in which I use vim is alacritty, and I want the key combination control + backspace to do the same that control + w does when in insert mode (i.e. delete the entire last word). So ...
0
votes
0
answers
33
views
Explanation of elvis' block system, specifically the block cache
From my browsing of the elvis editor source code, it appears that the block cache is a cache of recently accessed blocks, in the form of a linked list. However, I cannot figure out if this cache is ...
0
votes
0
answers
11
views
Zathura only opens a preview when launched from terminal [closed]
I am trying to set up an interface to do work using MacVim + Vimtex + Zathura. When I go to my terminal and run
vim ~/documents/latex/understanding_analysis.tex, and then enter \ll when in the vim ...
1
vote
1
answer
21
views
How to jump to the first error when using ALE?
I've installed dense-analysis/ale from this repo: https://github.com/dense-analysis/ale
I'm trying to use it to detect errors automatically in my Elm projects.
Errors are detected since they are ...
1
vote
1
answer
19
views
Only highlight trailing whitespace in normal mode
I have some code in my ~/.vimrc to highlight trailing whitespace.
" Highlight trailing whitespace
hi TrailingWhitespace ctermbg=red guibg=red
matchadd("TrailingWhitespace", '\v\s+$')
I ...
0
votes
0
answers
24
views
vim-ternimal normal mode splits wrapped lines to 2 lines
Is there a way to make vim treat it as a single line?
This blocks some functionality for example navigating to that line and hitting gf to open the file.
Because it is read-only I can't even join the ...
2
votes
1
answer
44
views
Is there a way to run an ex command without hitting colon first?
I am doing some scripting related to tmux and Vim. In my tmux window, I have Vim in one tmux pane and a Tcl command line in another tmux pane.
I want to create a Tcl proc which will dump a string to ...
0
votes
0
answers
6
views
netrw's Explore can't do both filepat AND content matching?
help Explore:
one of the following four patterns Explore generates a list of files which satisfy the
request for the local file system.
*/filepat files in current directory which satisfy filepat
**...
3
votes
1
answer
404
views
Installing Neovim 0.7 on Ubuntu?
I just moved from Mac to Ubuntu.
I have set everything up but my lua keybindings are following the 0.7 configurations.
When I install neovim on Ubuntu it gives me 0.6.
I tried this:
sudo add-apt-...
0
votes
0
answers
17
views
gVim HiDPI Problems on Icons (not font). Properties:Scaling Override : SYstem(enhanced) doesn't work
New PC with high DPI monitor.
Entire VIM window came out very tiny.
I was able to fix the tiny fonts via set guifont command in _gvimrc
However the icons are still microscopic.
I tried gvim.exe -> ...
1
vote
1
answer
30
views
How to delete all lines in a command script without provoking error?
I'm trying to write a Vim command script (a file containing Ex commands) that removes all existing lines in a file (and then read in some new text, and do some further editing operations). I use the ...
0
votes
1
answer
18
views
Can the default filename for :mksession be changed?
If :mksession or vim -S is used without a filename parameter a default file Session.vim is used. This can be very convenient.
I wonder if there is a way to change this default filename to something ...
0
votes
2
answers
57
views
How to create a lua function that gets called for a vim (neovim) motion
Vim has the concept of actions, which can act on text objects via motions.
For example diw will delete (the action) the inner word (the motion).
I want to create a function that can be applied/...
1
vote
1
answer
182
views
Is it possible to execute Ex Commands (colon commands) in VimScript (vimrc/init.vim)?
First off, just an FYI: I am not that experienced with writing VimScript
I have a plugin that I want to have enabled using its custom Ex command (:RainbowParentheses). Putting that inside my init.vim:
...
0
votes
1
answer
18
views
Wrap lines only after a space [duplicate]
So, I like that (n)vim has line wrapping support, but what I dislike about it is that it does things like this:
1 | Instead of wrapping text--|
2 | like this, Vim does it lik|
3 | e this. ...
1
vote
1
answer
36
views
Error detected while processing BufRead Autocommands
I'm a new user and I have just installed GVim on my linux. I just have ~/.vimrc file and no .vim folder may be because I did not install any plugins.
When I try to refresh (by :e) or reopen the ...
1
vote
1
answer
20
views
How can I exit insert mode from a script?
I'm using the answer to this question to create a timeout to insert mode: Alarm for inactivity
Once this timeout has been reached, I want the script to make vim leave insert mode, but I'm not sure ...
0
votes
0
answers
22
views
Review: Vim9script plugin for easy window navigation
Some time ago, I wrote a plugin for easy window navigation, using which one can enter a "custom mode" via <leader>w, where Ctrl-w is prepended to any keys pressed, except for Escape ...
2
votes
1
answer
78
views
delete from current position to end of paragraph when using hard wrap
i use hard wrap (in my vimrc: setl fo+=atw).
I often want to delete from the middle of some row to the end of the paragraph. I do this as follows: d$, j (down one line), 5dd (if there are 5 subsequent ...
0
votes
1
answer
16
views
Indentation is messed up when pasting code
I find that the default indentation support for pasting is lacking.
For example ,
If I use ]p for the following(copied using V) :
try:
l=None
if 1:
df = ...