All Questions

Filter by
Sorted by
Tagged with
4
votes
3answers
42 views

Recover whole search pattern for substitute command

Sometimes I type a long substitute command /%s/foo/bar.../ and while I am typing it or only after hiting enter I notice that I have mistakenly used a the search key (/) instead of the ex-command key (...
1
vote
1answer
14 views

sass folding syntax

i have foldmethod=indent on a .sass file. it auto-folds most blocks fine, except for #id selectors, which it folds into the block above it. for example: :root // folds 3 lines below --base-bg: #...
1
vote
2answers
51 views

Regular expression for searching IP addresses

I opened up a document in vim and I want to search the document for IP addresses. So I used this command /[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3} But this pattern doesn't seem to return any of ...
0
votes
1answer
17 views

Is there a `:browse oldfiles` for vim sessions?

It seems to me it would make more sense to have a :browse oldfiles for the last n sessions you opened up / saved in vim. Is there such a thing?
2
votes
1answer
37 views

Commentary with a Single Block

With Commentary I've set the commentstring for markdown: autocmd FileType markdown setlocal commentstring=<!--\ %s\ --> When I visually select the lines and gc a b c I get <!-- a --> <...
0
votes
0answers
24 views

Q: Calling Termdebug as fzf sink does not enable Termdebugs commands

I am trying to set up a shortcut that allows me to start gdb from within neovim while selecting the executable that I want to debug via fzf. Using the following command com! -bar -bang Debugger call ...
0
votes
2answers
53 views

Bind a specific search to a map in normal mode

Specifically, I'm looking to bind the search /\(<<<<\|====\|>>>>\)/ (i.e. "find the next git merge boundary"). Ideally to <C-/> or <A-/>, but that part I'...
1
vote
0answers
59 views

Command already typed in when I open vim

When I open up vim, it starts off with :2R already entered into the command line. I tried commenting out my entire .vimrc, and then it opens up starting in replace mode, with the 2 key pre-pressed (in ...
1
vote
0answers
24 views

Truncate line numbers when they are too large

So I'm using Vim's line numbering with set number set numberwidth=4 But I find that if line numbers exceed 999, then the gutter is automatically expanded to accommodate them. I actually don't want ...
2
votes
1answer
17 views

text object for current indentation level? [duplicate]

Say I have an indented block like so int main(int argc, char **argv){ printf ("odd numbers between 1 and 10:\n"); // level 1 for (int i = 1; i <= 10 ; i ++) { // ...
1
vote
1answer
51 views

How to get indentation lines for spaces without loosing chars like quotes in json files

rephrased my question based on Matt's answer and Christian's comment: I really like the indentLine plugin that shows vertical lines to visualize indentation levels. However, when using it, it does not ...
0
votes
1answer
22 views

Is there a configuration in VIM that can prevent VIM from opening an encrypted file?

Is it possible to configure VIM so that when an attempt is made to edit a file encrypted by VIM, or to encrypt a file, VIM would warn or refuse such action?
1
vote
2answers
51 views

How do I make my own function to insert text in vim?

I have a folder of third party libraries called add-libraries and the location for this specific library is /home/yapjiahong/projects/cpp/add-libraries/plog/include. I want to write a function called ...
0
votes
1answer
19 views

When hitting Enter keyboard on a file path, open a new tab with the file content

I'm new to vim language and I'd like to see a new tab opening when I hit the enter keyboard on a line containing only a path of a file. When I create a map like this nnoremap <buffer> <cr> ...
2
votes
1answer
36 views

Syntax highlighting rule doesn't work when a another highlight (# comment) exists

I'm trying to create a highlight that changes the text color of a strikethrough syntax, like ~~hello~~ should turn the whole thing gray. Here's what I've put in my vimrc: au BufRead,BufNewFile *.n ...
2
votes
0answers
48 views

Why does Vim create ~ files? [duplicate]

Whenever I create a file, Vim also creates a .extension~ file. For example, when I create a main.cpp file, another one appears with main.cpp~. Is the .cpp~ file an older version of my .cpp file? Is ...
2
votes
3answers
1k views

Competitive Programming Vimrc is too long

I am preparing for the Egyptian Olympiad in Informatics and I prefer vim to be my code editor, but my problem is my vimrc, I think it is a bit long to type at the beginning of an onsite competition, ...
0
votes
2answers
24 views

append things to the end of a pattern

I have several instances of variables in a file and I need to modify the variable and append "new" to each of the names. var Modelfrfr = .... var Modeldede = ... var Modelenen = ... ...
3
votes
1answer
34 views

check if plugin is loaded in .vimrc and set option accordingly?

I apologise if this seems very basic but I wasn't able to find a satisfactory answer. In my vimrc I want to check if the lightline status bar is loaded and set options accordingly. call plug#begin('~/....
1
vote
1answer
37 views

why doesn't regex work in vimscript (while it does in normal search)?

I have simple regex to search for lines that only contain alphabetic characters: ^\(\a\)\{1,}$ which works in normal search /^\(\a\)\{1,}$ but not when invoked from my script: "in .vimrc file: ...
0
votes
1answer
17 views

Disable highlighting in location list in vim

I've found many questions about disabling search highlighting in vim, but couldn't find the way to disable highlighting in location list. As you can see, yellow highlighting is shown on the first ...
0
votes
1answer
17 views

append strings with order

The original text: line1 lline2 line I want to add strings into the below format: line1 lline2 x y z line Move cursor at the 2th line,and ctrl+;,enter into ex mode: for s in ['x','y','z'] call ...
0
votes
1answer
59 views

When would I use append and when would I use insert?

I already know that a and i makes the cursor one space to the right and left respectively, but when would I use i to edit a file? Is there some special circumstance that makes insertion mode more ...
0
votes
1answer
31 views

How to set the document to move up and down while sliding the mouse wheel, while the mouse position does not change?

When I use the mouse wheel to slide the document, the document does not move at first, but the mouse cursor moves. How can I set the mouse cursor not to move while the document moves, so I don’t have ...
0
votes
1answer
23 views

How do I change the place where my vim files are stored?

Right now, all my vim files that I create are stored in C:\Users\dinosauce33 (My user). How do I change it so that all of my files that I create are stored in documents?
0
votes
0answers
22 views

autocompletion - set iskeyword disabling highlights

I have set up some syntax highlights for some patterns, for example: sc.nextInt() nextInt will be highlighted as a Function... Then I have included :set iskeyword+=(,.,) in order for autocompletion ...
0
votes
0answers
27 views

Can someone help me building nvim from source on/for Windows? I am having some issues doing so

I did the following: I downloaded the source files for 0.5.0 open msys2 mingw32-64 install packages: pacman -S \ mingw-w64-x86_64-{gcc,libtool,cmake,make,perl,python2,pkg-config,unibilium} \ ...
1
vote
1answer
19 views

Can Netrw use [host] type notation to look in .ssh/config and find the host to connect to?

Short Question: This is failing. Is it valid syntax? :tabedit scp://[home]/~/stuff/01234567/update/notes.txt Alternatively, can I easily use a longish somewhat complex shell command in vim to get ...
2
votes
1answer
59 views

Search and yank in visual line mode with execute normal

I have this in a buffer: aaa bbb ccc ddd eee with the cursor on the first line. I do :execute 'normal! jV/ddd\<CR>y' which I expect should result in the middle three lines yanked. But what ...
1
vote
1answer
30 views

How to type ê without pressing <C-k> e>

My keyboard layout is set to international american. And to obtain the character ê just press <sfhit+6> e. However, within the vim I need to press <C-k> e>. Is it possible to map <...
1
vote
1answer
25 views

Make fill column indicator visible by default in SpaceVim

I know there is a short cut to make the fill column indicator visible. But I want it visible a most of the time anyway. Can I set an option or call a function to toggle it automatically at startup? I ...
0
votes
1answer
39 views

ever since i moved from vim to neovim, my AG has started acting strange

I recently switched to neovim, but ever since my AG usage have acted weird lately. Here is my current .vimrc file. Here is my neovim init file ~/.config/nvim/init.vim: set runtimepath^=~/.vim ...
3
votes
2answers
151 views

Reversing all characters on each line of a range

In order to invert all characters on each line of a range I could think of the following :s/.*/\=list2str(reverse(str2list(getline('.'))))" where I can put a [range] if I want. Is there any ...
1
vote
2answers
77 views

Yank a line without a line break or moving the cursor

I want to have a key binding to yank the current line into the system clipboard. My current mapping is as follows: nnoremap <C-y> "+yy However, this also yanks the newline. I often use ...
0
votes
1answer
36 views

Get visually selected text - weird behavior when last selected char is multi-byte

I have made a simple function to echo the visually selected text. The function is simplistic as I am only interested in max one-line selection. The problem is, if the last character of the visual ...
0
votes
2answers
49 views

Find the specific line with character in specific position

Finding the line with a specific character before the last character. Suppose, I have the following string 1. addar_ctrl1,1,2,0,0,1 2. addar_ctrl2,3,2,0,1,0 3. addar_ctrl3,4,8,0,0,0 4. addar_ctrl4,2,6,...
1
vote
1answer
44 views

Is it possible to document or add comments to a scriptin file?

I have a lengthy scriptin that I'm using to help me convert JavaScript files to Typescript. There are about 30 commands defined in it so far: :%s/^\(\s*\)params\.\(\S\+\) = \(.*\);/\1 \2: \3,/ :g/...
1
vote
1answer
281 views

Vim doesn't flag “int” as a spelling mistake

I have a file en.utf-8.add in the folder of a file being edited by Vim. I issue :mkspell! en.utf-8.add to create a new en.utf-8.add.spl. In the edited document, the word int is not flagged as a ...
0
votes
1answer
23 views

Additional Bindings For Commands Under the Space-Prefix in SpaceVim

I have defined the following mapping in my bootstrap-before function: nnoremap <F5> <Space>jw I was expecting that pressing F5 would trigger the jump-to-a-word command now. What happens ...
0
votes
1answer
32 views

How to assign fileencoding's value to a variable?

In ex mode,i get the value for set fileencoding. set fileencoding? fileencoding=utf-8 How can assign str with the value utf-8 and print it? let str=`set fileencoding?` #it is a wrong statement,i ...
1
vote
2answers
57 views

Why does vi sometimes use harder-to-reach keys?

For example: [[ and ]] instead of [ and ], and G instead of g. Some ideas: Vim used these keys first, and they were backported to Vi (though G seems like an essential command for a code editor) Vi ...
1
vote
0answers
42 views

Is it possible to setup vim to use vimtex for Rmd files?

I need to write Rmd files, but I can't imagine life without vimtex. Is there a way that I can use vimtex with Rmd files? Ideally, I would also like to keep the syntax highlighting that I have for Rmd ...
0
votes
0answers
13 views

Neovim - Point builtin LSP client for ccls to a compile_commands.json file

I'm using neovim's builtin lsp client for ccls. It requires a JSON compilation database for parsing the codebase (or something, I dunno). I used to use Bear for generating the compilation database, ...
1
vote
1answer
20 views

What is corrupting my folds? And, more importantly, how can I fix it?

From time to time, I'll open up a document in vim and find that my manual folds are completely messed up. It's like vim decides to ignore its usual markers and, instead, start interpreting random bits ...
3
votes
1answer
44 views

How do I show a special symbol at the beginning of show lines (which are in the middle of logical lines) when wrap is on?

The screenshot of vim-gitgutter clearly shows its author uses some kind of continuation line character when wrap is on. How do I get that? I thought I could find it listed in :help 'listchars', but it'...
1
vote
0answers
28 views

Conditional mapping for two plugins (UltiSnips and Vimwiki)

Vimwiki table default mappings include <tab> for moving to the next table column in insert mode. Also UltiSnips default mappings include <tab> for expanding snippets in insert mode. Here ...
2
votes
1answer
21 views

Is there a filetype in Vim when opening the a file containing output/errors from g++ so that I can see those files with the original coloring?

Sometimes, when faulty outputs from compilations of C++ files/projects are to long, I like to redirect that output to a file, so that I can inspect it side-by-side with each of the offending files in ...
3
votes
1answer
40 views

add buffer to vim from the shell command line

I am currently trying to externally add a new buffer to a vim instance from the command line. That means I have already opened vim and I modify the files of interest to me. Then I want to go back to ...
1
vote
1answer
18 views

How do I diffput a deleted line?

When viewing a diff of two files in Vim, you can put changes from the source file to the destination file by pressing d then p, or by running :diffput. However, this doesn't work if the change is a ...
0
votes
0answers
11 views

Indent line in xml after omni-completion

When editing xml, lines are indented when pressing (among others) <, > or <CR> according to the indentkeys setting. For example: <tag> </tag| If the cursor is on | and I ...

15 30 50 per page
1
2 3 4 5
203