28,156
questions
-1
votes
0
answers
13
views
Strange keyboard layout on ubuntu core vim [closed]
I have a strange behavior with ubuntu core, via the ssh shell the keyboard is perfect and the layout is ok, but when I have to edit some file with vi it is unusable, the layout is all messed up, I ...
-4
votes
1
answer
126
views
Quickest way to add " at the end of a word in editors (vim, notepad++, etc.) [closed]
Let's assume we have a text file with the following format:
x,
xxx,
xx,
xxxxx,
xxx,
x,
xx,
and so on.
When importing data in python's panda, words need to be surrounded by " or '. Using either ...
-2
votes
0
answers
30
views
vim supertab is loaded but does not map <tab> [closed]
I installed supertab via Vundle.
I am using Ubuntu 22.04, and my ~/.vim/bundle/supertab folder is the most recent commit of the corresponding github repo.
In my .vimrc I have the line Plugin 'ervandew/...
1
vote
1
answer
56
views
To restrict vim the search to a specific part of the text
How do we restrict the search to a specific part of the text referred in basic row-coiumn positioning mainly (and visual selection, an extra way, if one would give) on (neo)vim just like substitution
:...
1
vote
1
answer
44
views
Is it possible to have a modal popup_menu in vim?
I have written a function that will, given a directory and a title, display a popup with all the files contained in that folder:
function! ListFiles(dir, title)
let l:dir = a:dir
let l:title = a:...
2
votes
1
answer
41
views
How do I change vim's syntax highlighting for multiline comment in *.py files?
How do I change syntax color of multiline comment in python source codes?
Line
hi def link pythonComment Comment
in /usr/share/vim/vim82/syntax/python.vim seems to cover only singleline ...
1
vote
2
answers
29
views
How to change the "Pattern not found" message colors in Vim?
When I perform a search for something in vim, if it's not found, the "Pattern not found" message is a light/white color on a light blue background, which is very difficult to read.
How can ...
0
votes
1
answer
52
views
Neovim command/codes to select visually the pasted text [closed]
How is neovim command/setting to select visually selection of the pasted data that has just been pasted as gv can't do so?
2
votes
2
answers
56
views
How to remove first 3 characters of a visual-line block selection?
So I'm using a language where adding -- to the beginning of a line will comment the line.
To comment a block of code that I have selected using visual-line, I do this:
map <F2> <C-v>0<S-...
-2
votes
0
answers
74
views
location of TODOs in recent git commits
Within a specific commit range (for example commits belonging to the current branch I'm working on), is it possible to find all the commits, filenames and line numbers where a pattern was added/...
1
vote
1
answer
53
views
Why does neovim not see my python script in Command-Line mode?
For my goals I wrote two simple scripts - 1 bash script and 1 python script. Below I attached them.
Bash:
#!/bin/bash
cat $1 | xclip -selection clipboard
Python:
#!/usr/bin/python3
import sys
...
-1
votes
0
answers
23
views
How to add a completely empty line in vim rendering logic?
This question is related to my previous one Highlighting the cursor line in Vim?.
I would like to have an ability to "highlight" a TUI line which may be useful while using Vim. The ...
2
votes
3
answers
77
views
How to perform a variable number of positional substitutions
Given a file:
ab abc a abc def
fgh fg hg gg ddd
I can surround each word with an apostrophe by doing (in Vim at least):
:%s/\w\+/'&'/g
But if my file is:
abc 1 ab abc a abc def
x 2 fgh fg hg gg ...
0
votes
1
answer
41
views
Vim cursor doesn't move in the align indent
Im a newbie Vim user.
Whenever I press 'Enter' to get to the next line, the cursor jump back to the start of the line.
I want it to stay at the indent of the previous line. How can i config it.
<&...
0
votes
0
answers
25
views
How to remap keys such that they are recorded in a macro as the rhs of the map
So I have a bit of weird situation. I use a plugin for yanking/pasting and have a clipboard manager on my laptop. These are linked up so I can copy/paste inside and outside of vim all as one. The ...
0
votes
0
answers
74
views
Highlighting the cursor line in Vim?
I would like to have the line with the cursor in it, known as cursor line to be highlighted as heavily as possible. The 15-years-old topic was informative for me: How to correctly highlight cursor ...
0
votes
2
answers
84
views
How to automatically add -E flag to sudo when starting Vim from Bash
I'm looking for a way to always start Vim as a sudo using -E "preserve environment" flag. Running sudo with this flag allows Vim to load .vimrc file and all themes/shortcuts.
I tried to ...
-1
votes
1
answer
57
views
vim group and substitute [closed]
I have a csv file that contains 3 sets of ids. I want to use Vim to substitute the appropriate id into the appropriate places, e.g.
A | B | C |
1| 1 | 2 | 3 |
2|33 |11 | 31|
How i can to replace ...
-1
votes
1
answer
34
views
Vim swap files not being created, when there is a $MYVIMRC file
I am using Vim 9.1
After installing Vim, swap files are created normally.
But if I create a $MYVIMRC file, Vim stops creating swap files.
If I put the line :set swapfile in the $MYVIMRC file, Vim ...
0
votes
1
answer
43
views
How can I get the vertical line for cursorcolumn in Vim editor?
I have currently set cursorline and cursorcolumn in /etc/vimrc. I am unable to set the cursorcolum to show as vertical line. By default it is block and I was able to change it to underline, but ...
0
votes
0
answers
74
views
How to configure vim-lsp and pylsp in .vimrc?
The following is my .vimrc configuration:
call plug#begin()
" color scheme
Plug 'morhetz/gruvbox'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
call plug#end()
if executable('...
-1
votes
2
answers
44
views
VIM autocommand on executable files
I want to run a VIM command only on loading of executable files (specifically, what I want, is to add a button to the menu bar, that will run the script, aka call :!%)
The question, of course is for ...
-1
votes
1
answer
38
views
How do I tell xmllint to ignore 'entity' errors
I'm using xmllint as part of the linter settings in ALE (Asynchronous Lint Engine, plugin for Vim). The codebase I'm working on has a lot of HTML entities in XML. Not good, I know, but they're not ...
-1
votes
2
answers
50
views
How to repeat a previously typed word in vim after inserting another character
Say I type foo in insert mode and want to insert (foo with a brace in another place.
The dot command . doesn't repeat foo in that case, but (.
How can I repeat the typing of foo?
0
votes
0
answers
34
views
EasyMotion plugin doesn't load automatically on Vim startup in WSL Ubuntu
I am using Windows with WSL (Windows Subsystem for Linux) running Ubuntu. In my Vim setup, I have the EasyMotion plugin installed. However, the plugin does not load automatically when I start Vim. I ...
-2
votes
2
answers
97
views
Vim stdpath function invalid
I was trying to get the configure file's location using echo stdpath("config") and the console showed E117: unknown function: stdpath
Reinstall tried (isn't thorough enough because vimrc ...
0
votes
1
answer
51
views
How to do this specific search & replace in vim
I would like to change the text below
[One]
,[Two]
,[Three]
(there are tab characters at the start of each line)
into
[One] = @One
,[Two] = @Two
,[Three] = @Three
Where for each ...
1
vote
1
answer
37
views
VIM: digraph for padding character breaks macro in register
If I do q e CTRL+W Right Arrow q, it binds the command "move one window to the right in the split" to the e key.
The macro for this as found by "ep is ^W<80>kr.
If I want to type ...
1
vote
0
answers
36
views
Syntax highlight exclusively within a region
I'm trying to add syntax highlighting for arguments with patterns similar to this:
if(GetKey(KEY_SPACE) == KEY_PRESSED)
where a KEY_ match should be highlighted, but only when inside GetKey.
I've ...
0
votes
0
answers
40
views
How do I install the tagalong plugin with vim-plug?
I am unsure if I followed the steps correctly when trying to install the plugin tagalong.
The problem is its functionality is not working after I installed it. Here are the steps I took.
Per https://...
0
votes
1
answer
29
views
How do I use keyboard shortcuts starting wtih <C-c> in Vim?
I'm trying to use python-mode with Vim and a lot of the commands are by default bound to things like '<C-c>rm'. What does this mean? Ctrl+c just exits the current mode, so in normal mode it does ...
0
votes
1
answer
32
views
Automation - Execute VIM macro a dynamic number of times
Is it possible to set up a macro in vim such that it executes a number of times equal to the number of results it finds earlier in execution?
I am trying to take a list of names, find all blocks in a ...
0
votes
0
answers
50
views
Generate aliased namespaced tags with Ctags
I'm trying to configure Universal Ctags to recognize functions imported from different namespaces with an alias. The language I'm using is Clojure (I also give an example in Javascript), so every ...
0
votes
0
answers
71
views
How to Map “Termdebug” Shortcuts in Vim
I want to use F2 to enter Termdebug immediately.
It's convenient to put file's name after the command like: Termdebug xxx (which has complied with -g option)
My host is Windows 11 and use VMware, ...
-2
votes
1
answer
39
views
is there a way to make a vnoremap act as a toggle?
In my .vimrc, I have the following visual noremap to remove semicolons from lines:
vnoremap ; :s/\([^;]\)$/\1;/g<CR>
I was wanting to change this so that, if a line does NOT have a semicolon, it ...
1
vote
1
answer
90
views
Vim function for substitution of a regex
I want substitute some pitches in a lilypond file. I would like to change for example the line
c cis d2. disis4 d8 beses16 fes64 gis aes16
to
c' cis' d'2. disis'4 d'8 beses'16 fes'64 gis' aes'16
I ...
2
votes
2
answers
69
views
How does one add a mathematical bar over a character in Vim?
I'd like to be able to type characters "a bar," "e bar," and so on - as variable names for vectors, let's say - but I can't find them in :digraphs. I've tried searching digraphs....
0
votes
1
answer
43
views
How can I change default clipboard register in Vim?
To paste text from the clipboard in Vim, currently I need to type "+p. How can I change or create an alias for register +, for example, to a? So that Vim would paste text from the clipboard when ...
0
votes
1
answer
36
views
Select contents of next { } when already in another function using Vim
Let's say I'm working in the following file:
int main() {
foo() {
// do thing
}
}
If my cursor is currently sitting anywhere in the text foo, and I want to enter Visual mode, select ...
-1
votes
1
answer
46
views
VIM Grep recursive search
├───Home
│ ├───Shared Library
│ └───Src
│ ├───module 1
│ ├───module 2
Above is my folder structure. If I call vimgrep from the home folder, all the directories below are included in ...
-2
votes
1
answer
81
views
How to add incremental number between every few lines in VIM
I have a text file
a, b
c, d
e, f
g, h
i, j
etc
I need the following file using VIM at every N line. Here, I use N=2
a, b
c, d
1
e, f
g, h
2
i, j
etc
Is there any way in VIM?
0
votes
2
answers
67
views
Alternative to bang (!) and system()
I'm hoping someone with real Vim insight can help me with this. I am using the MSWin32-64 build of Gvim on a Windows 10 laptop. I have Cygwin installed. I can start Gvim from a Cygwin bash shell and ...
0
votes
2
answers
367
views
"Pyright reportMissingImports" error message is wrong. Why did I get this message and how can I prevent it from reappearing?
General Background:
I'm learning Python and chose to make Vim my IDE (PyCharm was recommended, but there's no regret in my choice with Vim. It's awesome!). I'm currently building a cheap flight finder ...
0
votes
0
answers
42
views
Function signatures in vim/nvim for MSGraph module not showing despite various LSP plugins
I'm breaking my head trying to get function signatures/ parameter info showing up using Vim for the MSGraph pip module. This SDK is difficult to work with as the documentation is only generated for ...
0
votes
0
answers
38
views
vim + dos fileformat + Reading or writing extended attribute error
Trying to edit a file using vim (VIM - Vi IMproved 9.1) from gitbash utility
I do have the following settings for fileformat (ff) to unix
$ cat ~/.vimrc
set t_vb=
set ts=4
set fileformat=unix
Despite ...
0
votes
1
answer
38
views
Copying from Neovim to System Clipboard causes a newline character at the end of line [duplicate]
I want to copy the line from neovim to the system clipboard (using "+yy command) but it adds a newline character to the end (two lines are seen in gedit).
Operating System: Ubuntu 22.04
3
votes
1
answer
79
views
Vim mapping to underline a markdown title
I am trying to do something I expect to be simple, but I don't get why it does not work.
For the next lines in a markdown file, I want to define a mapping to underline a line, for instance :
line 0
# ...
2
votes
1
answer
57
views
How to execute a Plug in .vimrc conditionally on Vim version?
I have this .vimrc config file
$ cat ~/.vimrc
call plug#begin('~/.vim/plugged')
Plug 'alvan/vim-closetag'
" below only work with vim9
Plug 'yegappan/lsp'
call plug#end()
$
This .vimrc is ...
1
vote
3
answers
58
views
Deleting noncontiguous lines in vim with a single command
Is there a way to delete multiple noncontiguous lines in vim using a single command?
Here is an example:
3 numeral_dict = {
4 'M': 1000,
5 'CM': 900,
6 'D': 500,
...
0
votes
0
answers
55
views
Weird Vim Python auto-indent issue
When editing Python files, I am running into a weird auto-indent issue. No matter what I do, when I open a new line, the cursor always ends up in the middle of the terminal. I expect it be aligned ...