All Questions

Filter by
Sorted by
Tagged with
1
vote
1answer
26 views

Vim different colorchemes for different file, but same backgroung color

I'd like to have a colorscheme but keeping my terminal color as a background color. This code achieved that colorscheme MyFavoriteOne autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE I'...
1
vote
0answers
33 views

How to make “view” read vimrc?

view is the readonly mode of vim. I would like view to read the exact same .vimrc file for its initialization as vim already does. view does not seem to read ~/.vimrc by default (I checked by adding ...
1
vote
1answer
30 views

How to remap escape in *vi* (not vim)?

I've used the information in this answer previously, but recently encountered a minimal installation with only vi. I edited the .vimrc in the user's home folder (~/.vimrc), but when typing jj, the ...
0
votes
1answer
22 views

Why doesn't i<Ctrl-R>=expandcmd('se shm') work?

I'm trying to do i<Ctrl-R>=expandcmd('se shm') and more generally i<Ctrl-R>=expandcmd({expr}) but I'm just getting the literal {expr} inserted. When I type :se shm<CR> I get the ...
2
votes
0answers
23 views

Cannot :Explore public ftp service (I see empty listing with ../ and ./)

The address is ftp://ftp.yandex.ru/ I tried from bash: vim ftp://ftp.yandex.ru/ After that I was asked for username and password (but this is public anonymous server), ok I entered anonymous for ...
4
votes
1answer
74 views

Cursor Column in Visual Selection

What is the correct way get the column of the cursor after a visual selection was made? As a simple example, consider the following command. It takes a range and I am trying to obtain the column to ...
0
votes
1answer
27 views

Permit closing window with unsaved changes using vim setting

I wrote a plugin that executes a slow shell script and asynchronously shows the stdout in a popup (split) window. When I try to close my session while the popup is open, I get the message Save ...
0
votes
0answers
20 views

Getting conflict when setting ft=txtfmt

I installed The Vim Highlighter plugin by Brett Stahlman. The plugin requires setting filetype=txtfmt. I set the option using :set ft=txtfmt but got conflicts like Level 1 map ambiguity:[bf already ...
2
votes
1answer
36 views

ALE Error and warning highlighting gets disabled when termguicolors is enabled

I have the ALE extension installed, and would like it to highlight errors and warnings, however when :set termguicolors is enabled, the Here's a screenshot of the problem: set termguicolors ...
1
vote
1answer
57 views

How to match a word not following a defined pattern?

I have the following text file: 1: This is a book. 2: Here is the book for you. 3: There are book. 4: You can read the book. 5: Is book good to read? I want to find all occurrences of book not ...
1
vote
1answer
59 views

Is it possible to have vim run a command every time save `:w` is invoked?

I am editting typescript now, and I'd like to be able to have it so, whenever :w is invoked, the shell runs tsc compiling my new save. This beats having to !tsc every time. Does something like this ...
0
votes
1answer
54 views

Keep indentation after multiple newlines

I've got a problem where in insert mode, if I type something like { that will cause indentation, then press enter twice, then match that bracket (such that there is a line in between the opening and ...
0
votes
1answer
32 views

Jump to nearest pair of brackets with %

I'm looking for a way to change the behaviour of the % key. I know by default it will move the cursor to the corresponding parenthesis or brace, but I'm wondering if I can have it jump to the nearest ...
2
votes
1answer
192 views

Efficient Syntax Highlighting

I am using VIM as a note taking application and have created syntax highlighting to assist with readability. See below or the repo for all the files. syntax match Timestamp /^\d\d:\d\d \d\d[/]\d\d[/]...
1
vote
2answers
80 views

What is the difference between loaded and unloaded buffers?

I was looking at the documentation for the 'complete' option, and I found it a bit confusing: . scan the current buffer ('wrapscan' is ignored) w scan buffers from other windows b scan other ...
3
votes
0answers
21 views

How to mark multiple files in netrw?

I tried using MF *.h for example to select all the files in the current directory that end with .h but this doesnt work. What are good ways to mark multiple files using netrw?
0
votes
0answers
27 views

netrw bug? cannot copy marked file to target

When I try to do the following on Windows 10: go to a directory, set it as the target directory using mt go to a different directory, mark a file in that directory using mf use mc to copy the file to ...
0
votes
2answers
186 views

Font on Mac Catalina

I just now upgraded to Catalina on Mac (10.15) and immediately ran into an odd font behavior: when I open a file with MacVim (8.1.1722 (157)), the letters with tails (g, y, p...) have their tails cut ...
0
votes
0answers
27 views

Neovim highlight syntax region inside typescript tagged template literal

I am having trouble fixing a syntax plugin for Vim. I've found a bug in a plugin that has not been touched in a fair amount of time. I want to address it myself but I believe I am lacking in a lot of ...
0
votes
1answer
30 views

Enable spelling in code files outside of comments

I've got the following obviously misspelled file: bla blar blar When I open it as "bla.txt" and run :setlocal spell vim rightly points out all three words as misspellings. However, if I mv the file ...
0
votes
0answers
10 views

Deleting the temporary buffer created by Pymode

I'm using the python-mode plugin with automatic lint checking. I want an easier way to delete the temporary buffers used to show errors when I use :wa. Sometimes there are more than one. Now I'm ...
1
vote
1answer
65 views

Make mapping that accepts count independent of line count

I have a mapping that looks like this: nnoremap <expr> <c-x>b ":call MyFunction(" . v:count . ")\<cr>" I also tried to instead define function with range, but the effect is the ...
0
votes
2answers
31 views

How to find all .kl files in current directory with Flygrep (spacevim)

I tried with Flygrep *.kl but it didn't work, I searched how to use --include \*.kl as in a grep search but I didn't find anything
0
votes
1answer
38 views

Bell ring on mapping <c-/>

This is the problem. I want to use in my mapping but it causes a bell to ring every time I press on it, no matter what I mapped it to. For example: nmap <c-/> y I am on nvim-qt. PS tried ...
0
votes
1answer
18 views

How do I open ctrlp plugin file suggestions in Insert mode?

I'm using CtrlP plugin to switch to other files in Vim by pressing Ctrl-p. But this only works in normal mode. I want to trigger it by pressing the same set of keys in insert mode as well. How can I ...
0
votes
1answer
42 views

insert new bullet point in autoindent mode

with autoindent mode on, when writing a short bullet point on restructuredtext file: - item one ~ Then I press Enter, and I get: - item one ~ but I whould like to quickly by here: - ...
0
votes
0answers
15 views

Spell check operator

Is there a way to run the spell checking for a single text object instead of the entire file? I would like to do something like: gsip (go spell in paragraph) I've found a gammar check operator: ...
5
votes
1answer
454 views

What is the difference between <C-V>x and \x?

Run the following commands, where <80> is a literal byte entered by typing Ctrl-Vx80: let literal = "<80>" let quoted = "\x80" echo(literal) and echo(quoted) will now both output <80&...
0
votes
1answer
21 views

Calling a function when timeoutlen expires and retrieving the input command

This might be quite challenging, but I would like to achieve the following behavior. Imagine that I have two mappings that overlap: dcb := delete comment block := delete comment block (all adjacent ...
0
votes
1answer
14 views

How to fix incorrect highlighting from 'matchpairs' caused by setline()

when using setline() to insert brackets, matchpairs does not do its job correctly. Using these commands fu Test() cal setline(".", "()") endf au TextChangedI * cal Test() set up the text ( ) ...
1
vote
0answers
31 views

Is there a way to make a command running inside a vim terminal open files in buffers?

I often find myself operating in the vim terminal needing to edit a few files. In this case I might type vim *.h. This opens a new vim instance nested inside my vim terminal. Is there a way to make a ...
1
vote
1answer
27 views

Calling g@ from a a vimscript function

I want to call g@ from a function. Given an operation: " Taken from :help g@ function! CountSpaces(type, ...) let sel_save = &selection let &selection = "inclusive" let reg_save = @@ ...
1
vote
0answers
147 views

How to avoid screen corruption?

I'd been using Linux Mint MATE for years, and recently moved to Arch Linux with MATE Desktop Environment without any change of hardware or .vimrc. (By the way, I use no plugin.) After that, when I ...
0
votes
0answers
18 views

gvim window completely frozen

I have a problem with gvim on Fedora 30: when opening a file, the content is displayed, but then the window is never refreshed. Already tried a lot of different solutions, with no success: CTRL-L ...
1
vote
1answer
26 views

Error With Simple Function Using setline()

I'm trying to start writing some Vim Script, and I've come across this issue. fu Test() call setline(1, getline(".")) endf autocmd InsertCharPre * call Test() This is in my .vimrc. When I type ...
0
votes
2answers
41 views

How to remap Autocomplete on Control+N, to Control+Space?

I am trying to remap this functionality: to Ctrl+Space, by using this line in .vimrc inoremap <C-Space> <C-n> However, I can not seem to get it to work. If I press Ctrl+Space after ...
0
votes
1answer
29 views

I want to save my typescript file, and immediately run tsc myfile.ts from inside vim. What is the best way to accomplish this?

I am building a daemon, and nodemon currently monitors a file called server.js, which is compiled from the file I am working on, server.ts In order to compile server.ts, after saving with :w, I need ...
1
vote
1answer
18 views

detecting insert-normal mode

I notice that when in insert, pressing <C-o> will take me to normal mode, but once I finish pressing a sequence of keys, I get taken back to insert mode. I find this very useful, but I want a ...
0
votes
0answers
10 views

Refactoring Ruby imports

Is there any way in Vim reliably refactor (i.e. rename, move up or move down directory structure) Ruby’s require_relative statements? I’ve searched thoroughly and couldn’t find any plugin or CLI tool ...
1
vote
2answers
69 views

Send keys to a terminal buffer

I want to map a keyboard shortcut to execute the last command in a terminal buffer that I have open. I've made some progress: I am storing the buffer's channel id correctly but when I try to send ...
1
vote
2answers
34 views

How can I edit the contents of my clipboard in vim?

Often while editing (say, a post on this network), I find myself wanting to copy something, edit it, and paste it back. At other times, I have some text in my clipboard, but isn't perfect. I would ...
1
vote
1answer
26 views

How to backspace with X at the end of a line

In vim I often use <S-x> to 'backspace' in normal mode (deleting the char behind the cursor). However if I position the cursor at the end of the line, the last character on the line is not ...
1
vote
0answers
35 views

How to use actual window size to control vim settings?

Background: neovim with tagbar plugin installed Goal: when starting nvim, if current window size is larger than 100, open tagbar and set auto-open for new buffers. Currently I use the settings below ...
1
vote
0answers
31 views

Smart and auto indent not indenting as expected for JSX

I'm trying to figure out how to get vim to correctly indent the next line in a JSX block. Currently when I press enter, the cursor goes slightly behind where it should be. In the example below, my ...
1
vote
0answers
37 views

Running a command Async in Neovim

As far as I know, neovim enables running a command async, without blocking the user. This is also enabled in vim8 I was told. But I couldn't find examples of how to run a command asyncly. Suppose ...
1
vote
1answer
69 views

Vim is highlights everything after EOL in yellow upon scrolling

My vimrc: http://ge0rges.com/vimrc My environment is: Ubuntu 18.04 in WSL on Windows 10. VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41) Included patches: 1-1453 Modified by pkg-...
0
votes
1answer
79 views

How to automatically execute a command every time visual mode is entered and every time normal mode is entered

I would like to execute a command every single time I enter visual mode and another command every time I leave visual mode. Is there a way to achieve this? My objective is to automatically record ...
2
votes
3answers
414 views

How to create a vimrc macro using :sort?

I tried creating the following macro: search an empty line above my location go down one line shift-v find an empty line down go up one line :sort This should sort the entire section I'm pointing at....
2
votes
1answer
126 views

Different mapping behavior for the different visual modes?

I want to have different behavior for the different visual modes. As an example if I wanted to vnoremap S{ so that it has the following behavior: surrounds the selection in v mode, (puts { at the ...
2
votes
0answers
42 views

Is it more efficient to use one function instead of multiple autocommands?

I have a lot of lines with with filetype-specific autocommands defining mappings and abbreviations, which looks like this: augroup vimrc au! ... au FileType blah nnoremap <buffer> aa bb au ...

15 30 50 per page