Questions tagged [vim]
Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor.
3,696
questions
0
votes
0
answers
11
views
How to collect all occurrences of a pattern into a register?
how can I collect all occurrences of a pattern into one of Vim registers? So, if my file reads as
ABC123DEF
ABC1A3DEF
ABC1x3GHI
I want to collect into a register 123\r1A3\r1x3 (The "\r" is ...
0
votes
3
answers
51
views
Disable settings for files without extensions
I want to disable certain settings (like line numbers) when vim opens files that don't have an extension.
I have set number in my .vimrc, and I know that I could disable this for example for markdown ...
0
votes
2
answers
93
views
Copying a filename on the same line to the end of the line
I have the following lines in VIM:
<img src="file01.jpg" / >
<img src="file02.jpg" / >
<img src="file03.jpg" / >
And I would like to add the filename ...
0
votes
1
answer
32
views
Why neo vim is displaying $ at the very end of line and > at the beginnings of line
Why neovim is displaying these special characters at the beginning and at the end of line?
I have uninstalled and reinstall neovim but this didn't fixed the issue.
How can I fix it?
0
votes
0
answers
10
views
Is there a package or common set of shortcuts for Neovim/Vim in "insert" or "i" mode [migrated]
Coming from bunch of years of using the VS Code environment in windows I'm used to ctrl + some keys to manage the interface. In Vim/Neovim I always have to exit insert mode to do most operations.
Are ...
1
vote
2
answers
187
views
In [Neo]Vim, how do I display error messages from an external command used as a filter on the visual selection?
Summary
In [Neo]Vim, if I call an external command on the current visual selection (expecting that command to transform the selected text, which Vim then updates in the buffer), and the command fails ...
1
vote
1
answer
31
views
How do I override a syntax's comment character in a modeline, in vim?
I have a weird assembler which uses \ as a comment character. The standard vim asm syntax uses # as a comment character instead, which is bad because it's both wrong and # is an instruction delimiter ...
1
vote
0
answers
99
views
Neovim Slow Cursor Blinking
I'm trying to switch from Macvim to Neovim, but running into an issue that I can't figure out. I can't get guicursor to fully work. I say fully work because some of it does, e.g. setting ver25 or ...
0
votes
0
answers
172
views
How can I make the cursor in VS Code use the arrow keys in the same way as vim?
Specifically, I want it in VS Code so that when I move the arrow key to the right at the end of a line of text it just stops in place instead of jumping to the beginning of the next line. I find this ...
1
vote
0
answers
187
views
Easiest way to switch NeoVim Control key shortcuts to command key
tl;dr
Searching for a way to replace all shortcuts in neovim that use the control key with the command key on Mac
--
I just got started in using neovim as my main code editor
However I find hitting ...
0
votes
0
answers
38
views
vim colorscheme issue on redhat
I have set my colorscheme to desert in my redhat 6 .vimrc. In redhat 6, when I open vi any file, it is displayed using the colorscheme.
There is a redhat 8 machine that I can ssh to and when I do, my ...
0
votes
0
answers
104
views
How to copy across terminals using text editor vim without clipboard support?
options in my version of vim :
vim --version | grep clip
-clipboard +jumplist +popupwin +user_commands
+ex_extra -mouse_jsbterm -sun_workshop -...
0
votes
1
answer
189
views
Why can't I edit the sudoers.d files with vim but I can with nano
I tried editing a file in the sudoers.d directory using vi in a vagrant box (Ubuntu Trusty64) but it just opens the file in readonly mode but when I use the nano editor it works.
The command sudo vi /...
0
votes
1
answer
40
views
vim is ignoring configurations
Vim is just not applying some configuration statements. This behaivior started after I installed a plugin to it, and updated MacOS (that shouldn't be related to each other !?).
One example is ...
0
votes
0
answers
68
views
Why does not PRIMARY buffer work in VIM sometimes?
I edited /var/log/cups/error_log with VIM and, as I usually do when I have to copy from VIM and paste at some place else, I used the PRIMARY buffer. So far it never failed; but this time it did not ...
1
vote
1
answer
244
views
Pattern not found message on found and highlighted pattern
I have a fair number of PHP classes source files that I can list using the command grep -r "class " * with each file containing the class <MyClass> pattern.
For example, one such file ...
0
votes
0
answers
53
views
YCM on windows vim can't find python
I would like to be able to use YouCompleteMe plugin on vim (on windows).
I have installed vundle, and followed the installation guide for YCM on Windows. When I run :PluginInstall I see:
Traceback (...
0
votes
0
answers
87
views
Install vim plugin python-syntax on macOS without third party package manager
I would like to install the vim package python-syntax. The README says to use a package manager but it must be possible using vim's builtin package capability. I cloned the package using
git clone ...
0
votes
0
answers
144
views
How do I detect nul (0x00) characters in a vim string or register?
I have a vim register that contains a string. I need to step through each character in the string, and process each one individually.
My problem is that given a character pulled from the string, I am ...
1
vote
1
answer
39
views
How do I correctly execute 'vim $(grep -rli pattern | sed 's/\(.*\)/"&"/')' in bash?
I am trying to edit files that contain text matching a regular expression with vim and use the following command in bash to do that:
vim $(grep -rli pattern | sed 's/\(.*\)/"&"/')
I ...
1
vote
0
answers
123
views
Running WSL On Windows 11, Trying to Preview Latex Document in Windows Adobe Reader from VIM in WSL
I'm using the WSL Subsystem on Windows and running vim on my WSL.
Currently I'm trying to start a Live Latex Preview with the Adobe Reader in Windows. I'm using the Live Latex Preview Plugin from the ...
0
votes
1
answer
1k
views
Spawning language server with cmd: `lua-language-server`
I've recently transferred from Packer plugin manager to Lazy.
Utilizing LSP, LspConfig, Mason, MasonLspConfig with several language servers for programming.
The problem is that Neovim is having ...
0
votes
2
answers
67
views
How to copy output from a zsh terminal using vi movements(or if that's not possible any other way)?
Currently I am using vi motions in zsh and it is incredible. I work on terminal a lot and it is annoying to switch back to move to copy an output. Is there a way to use vi motions or anything else to ...
0
votes
1
answer
42
views
vim split next file on command line
I often run vim on multiple files eg vim *.cc
sometimes I'm halfway through the list and I'd like to keep editing the current file and then split the window (sometimes vert and sometimes horiz) to the ...
0
votes
0
answers
14
views
How to perform a command based on the contents of the fold annotations
When I have lines that are folded is it possible to search over the folded text annotations (i.e. the fold comments that indicate how many lines are folded) and perform an operation on the folds based ...
0
votes
1
answer
12
views
cannot type registers with shift (specially + and *) on vim
I'm using vim 9.0.1182-1 (the -1 is for arch packages, not sure about patches, reading up on them still), both on kde (both X11 and wayland) and the native TTY.
On all those environments, i cannot ...
1
vote
1
answer
54
views
Vim - create numbered backup files?
I find myself wanting Vim to create numbered backup files, so every time I save there's some ordinal number in the back-file name. My current impetus is that I make changes in C code that have un-...
1
vote
1
answer
135
views
How can I make neovim display the "search hit BOTTOM, continuing at TOP" message like vim?
Unlike vim, neovim does not display the search hit BOTTOM message when searching repeatedly for a string. Tested with neovim 0.6.1 on ubuntu, no init.vim and no pluins, and editing /etc/ssh/ssh_config ...
0
votes
0
answers
41
views
macOS terminal corruption with larger font in Vim (the line I am editing is not the line being displayed!)
I'm experiencing terminal corruption on macOS in vim, but only with larger fonts. (FWIW, this also appears to happen on macOS when using vim ssh'ed into another machine.)
This occurs as the text being ...
0
votes
1
answer
294
views
Cannot find source of PATH variable in zsh
I wanted to change $PATH and I did not pay attention to shell, so I changed $PATH in .bashrc instead and not in the dotfile for zsh. Now when I wanted to find it and change it, I cannot find any file ...
0
votes
0
answers
42
views
How to setup fonts in order to display icons correctly?
I'm currently using iterms2 and am using Cascadia Code for both regular font & Non-ASCII Font. Things are working great as I'm able to see icons render correctly on iterm as shown below
However, ...
1
vote
1
answer
1k
views
Change default shell to powershell in Neovim
Currently the default shell nvim uses is cmd.exe I tried changing it by setting shell to powershell in my nvim config but that didn't work, so I tried this command in the nvim command line:
:let &...
0
votes
1
answer
205
views
Neovim suggestion selection menu
Some menus in the neovim autocomplete suggestion can not be selected and I have no idea how to select them. I tried several keyboard shortcuts, such as Ctrl +P, Ctrl + N, Alt + F, Ctrl + Space + F..., ...
0
votes
1
answer
25
views
vim create a binding so that pressing "Shift I I" writes python import statements
I want to create a binding so that pressing "Shift I I" writes python import statements.
I think it should be a map, like this:
:map <S-i><S-i> ...
I'm not sure how to map my ...
0
votes
0
answers
31
views
Vim: How can I synchronise NERDtree with terminal pane
My Vim session currently resembles this:
+-----------------------+
| NT | Open file |
| | |
| |-----------------+
| | Terminal |
| | |
+---...
0
votes
0
answers
244
views
How to delete selected text in neovim?
I have xnoremap <BS> "_di this keymap in my neovim config. But when I select a text in visual mode and press backspace to delete the text, the text deletes and gets copied to my clipboard.
...
0
votes
1
answer
26
views
gVim updates the title text field when the window is made narrower - can I stop this handy behavior?
Depending on the width of the GUI window, gVim 9.0 on Windows 10 (maybe Win 11 as well) would decide to be creative with the title text of the window, and show any of the following when I review my ...
0
votes
0
answers
100
views
How do I get vim to not join lines with `gq` if the line ends with two spaces
I have a markdown file, and if I want a new line, I can add two spaces to the end of the line, and it will render a line.
The problem is, when I use gq{motion}, it will still join the lines.
For ...
0
votes
0
answers
53
views
Recovering a file in vim
I was working on a file in vim and I press :wq, I closed, but when I opened it again, I loaded stuff form some swap file (from 6 hours ago) so I lost all of my data. I tried vim recover, but still, ...
4
votes
1
answer
368
views
Vim NERDTree increases the command line size and doesn't shrink it back
I am using MacVim 9.0 with NERDTree. Some commands in the NERDTree cause the command line to increase in height to display the full command description. (For example, pressing m in the NERDTree window,...
1
vote
1
answer
20
views
Save file with a generated name from vim command mode
I am trying to save file with a generated name from vim command mode. I am using the command:
:w !tee"/tmp/vim/$(date +'%s').tmp"
But it throws me an error that filename cannot be empty. Am ...
0
votes
0
answers
34
views
Accidentally triggering a keyboard action in byobu?
I have a byobu session with several tabs. I can switch between tabs with <F3>/<F4>. In one of tabs I'm editing a file in vim. Some of the editing is quite repetitive and I find myself ...
0
votes
1
answer
617
views
How to pipe vim clipboard through tmux?
I noticed when using VIM through the terminal, I can easily copy a line of text to my system clipboard using the clipboard register like V"+y (that is, then paste that text to some other window ...
0
votes
0
answers
206
views
nvim: Too many swap files found
Every time I open neovim and start typing in insert mode, I get this message and it hangs for a couple of seconds:
E326: Too many swap files found
E303: Unable to open swap file for "[No Name]&...
0
votes
1
answer
135
views
bash: XY: command not found; when XY is an existing alias
I've just noticed that when I call fc, I got the following error message:
zoltan@adrian ~ $ fc
bash: vi: command not found
The which command returns a similar result:
zoltan@adrian ~ $ which vi
which:...
0
votes
1
answer
52
views
How to type in ASCII ESC in vim/Linux using remote terminal tool
ENV = Centos7, bash version 4.2.46
Main Goal -
I want ANSI color codes to display colors instead of actual codes when using cat or tail.
Current Status -
If sample.txt contains codes as below
\e[32m ...
0
votes
1
answer
20
views
How to permanently remap petadactyl keys
Using pentadactyl extension for firefox, how can I persistently change a key mapping. For example, how could I change shift+j to go to the next tab next time I open the browser? The command map J gt ...
2
votes
1
answer
6k
views
Coc nvim suggestion selection
I have installed the plugin and also I can see the suggestions. But I am unable to select it I have tried enter, tab, space but still I can’t select it. I have to complete it myself and it is really ...
3
votes
0
answers
87
views
tmux send-keys to vim has no effect if used along with swap-pane
I have a tmux window with 2 panes (pane-ids: 0 and 1). In the pane 0 there is vim launched. I want to fire a combination of two commands from tmux command-prompt:
:send-keys -t 0 "iabc" ; ...
2
votes
1
answer
246
views
How to expand tabs to spaces, but only for visual aid only
I am starting with a new project with a lot of legacy code in C and Golang
The developers there are adamant on using tab :P and enforce 80 column limit
I am not a fan of tabs and am having hard time ...