Questions tagged [vimrc]

Vim reads initialization commands from a file called vimrc on startup. This can be used to set settings, define functions, execute autocommands, and more.

Filter by
Sorted by
Tagged with
0 votes
1 answer
200 views

Changing the Vim backward search key from semicolon to period

I am trying to change the key used for going backwards in search results while using Vim. Currently, the key used is the semicolon (,), but this conflicts with another function in my config. I would ...
Happy Cakiey's user avatar
1 vote
1 answer
165 views

Statusline vs Rulerformat - What is the Difference?

Question What is the purpose of the ruler? I have recently learned about the statusline and the rulerformat, and was wondering what the difference between them is. Why does the ruler exist? Why can't ...
Pixelbog's user avatar
  • 417
1 vote
1 answer
29 views

Does `.rc` do anything in `after/plugin/foo.rc.vim`?

I see some people add a .rc. extention to files in after/plugin, is there any difference between: after/plugin/foo.vim after/plugin/foo.rc.vim ? Or: after/plugin/bar.lua after/plugin/bar.rc.lua ?
run_the_race's user avatar
0 votes
1 answer
46 views

How can I set *.xsh filetypes as python?

I am trying to have set filetype=python automatically executed when I open a file ending in .xsh. However when I try it and then run the command set ft? it always shows me the file as xonsh. This is ...
Kiwiheretic's user avatar
1 vote
1 answer
971 views

`E492: Not an editor command` error only when opening file, but not when using :so %

I have the following in my vimrc: call plug#begin() Plug 'https://github.com/vim-scripts/RltvNmbr.vim' call plug#end() set number RltvNmbr When I type :so % while in my vimrc, it will turn on the ...
brianxk's user avatar
  • 21
1 vote
1 answer
30 views

Highlight a single word that would be encountered after a specific word

I want to highlight the next word encountered after a specific word (e.g.: "class"). In other terms, the next word after "class" should be highlighted with the highlight group that ...
SuperNoob's user avatar
0 votes
1 answer
119 views

Can I make a new mode in Nvim?

I want to create a new mode other than normal, visual, or insert because I want to: change the functions of all keys at once allow remapping preserve the mappings of other modes and retrieve when go ...
Dugesia7's user avatar
0 votes
0 answers
77 views

How to make `lead` override `trail` in listchars

I have the following lines in my .vimrc. set list set listchars=lead:·,trail:⎵ Whenever I have a line consisting of only spaces, the character shown is ⎵. How can I make vim prefer · in this scenario?...
efthimio's user avatar
  • 101
0 votes
1 answer
20 views

Rookie problem with Vim swaps

I am learning how to use Vim. I likely exited the editor by pressing Ctrl+Z which made it "crash". I now keep on having problems with swap files of .vimrc. Because of that, e. g., I cannot ...
Kolya's user avatar
  • 5
0 votes
1 answer
39 views

string substitution in statusline (change %F)

My current statusline (in .vimrc) contains %F to show the current filename. I want to perform a string substitution in %F. More specifically I want to substitute ~/remotes/foo -> [foo] Examples: ~/...
Laurent Claessens's user avatar
0 votes
1 answer
74 views

My key mapping appears when I run :map, but when I try to trigger it I get "E492: Not an editor command"

I am learning vim. I am at a part that I am very excited about because I think it will lead to a lot of productivity gains: key mapping. I added the following mapping to my .vimrc: let mapleader = &...
evianpring's user avatar
0 votes
0 answers
73 views

Display lint info in vim ruler

I've installed the vim-flake8 plugin and it works correctly to lint Python in vim. When I am on a particular line, I can use :call flake8#Flake8ShowError() and it will display the error in the vim ...
efthimio's user avatar
  • 101
0 votes
0 answers
55 views

Neovim exiting unexpectedly when closing floating window

When I first open neovim, if I use a plugin that opens a floating window (telescope, floaterm), when I close that floating window it'll exit neovim entirely. If I open a buffer/file first, then I ...
echo's user avatar
  • 111
0 votes
1 answer
307 views

Nvim on WSL: escaping space in g:clipboard.paste['*']?

According to :h clipboard-wsl in neovim, For Windows WSL, try this g:clipboard definition: let g:clipboard = { \ 'name': 'WslClipboard', \ 'copy': { \ '+': 'clip.exe', \ ...
Dugesia7's user avatar
0 votes
0 answers
31 views

Sort wildmenu list alphabetically

EDIT #2 - directory setup I set up a testing directory with the following: mkdir ~/Desktop/tester1 && cd tester1 touch aa.{js,css,html} touch aaa.{js,css,html} touch bb.{js,css,html} touch bbb....
Aaron Parisi's user avatar
1 vote
1 answer
88 views

Specify sorting in wildmenu list?

EDIT per accepted answer below, I have the following: function! MySortDirEnts(ent1, ent2) if a:ent1[strchars(a:ent1)-1] == '/' && a:ent2[strchars(a:ent2)-1] != '/' return -1 elseif a:...
Aaron Parisi's user avatar
1 vote
1 answer
72 views

Use contents of copy-paste buffer in command

I would like to use the content that reside in the current copy-paste buffer in a Vim command. For example: nnoremap <leader>hi <cmd>echo "copy-paste-buffer-content"<CR> ...
felrock's user avatar
  • 13
0 votes
1 answer
71 views

vnoremap to sort highlighted lines by length not working as expected

I found a command that would sort highlighted lines by their length and wanted to make a mapping for it so that I could avoid typing it every time. vnoremap ,s :<C-U>'<,'> ! awk '{ print ...
Shreevathsa GP's user avatar
1 vote
1 answer
48 views

User function unexpectedly returns the same output every call

UPDATE As @Matt pointed out g:jsonTemplate is a list that needs to be copied. I originally thought that multiline strings were strings and overlooked the varible assignment detail after debugging. The ...
a_baguette's user avatar
1 vote
1 answer
224 views

How to remove definition In between lines by coc-nvim

I want to remove the inline definition that come like this (underline parts): These are coming due to coc-nvim and I don't want to see them. How can I get rid of them?
Anurag Yadav's user avatar
0 votes
1 answer
48 views

Is it possible to disable showing `-- VISUAL LINE --` hint in the command line?

As title: I have a plugin that needs to show something in cmdline but now the space is occupied by: -- VISUAL LINE -- Any hint to get rid of it?
NeoZoom.lua's user avatar
  • 1,322
0 votes
1 answer
103 views

Vim mapping: Copy whole line X lines up/down and paste it X lines down/up

I find myself doing the following very often: xkyyxjp (where x is a number). I copy a whole line x lines up, and then I paste it x lines down (and vice versa); and so I wanted to make a map so I can ...
Peter Petigru's user avatar
0 votes
2 answers
153 views

How to remove .vimrc without sudo power

My .vimrc is a directory and not a file, I don't remember doing an mkdir but oh well. My problem is, I am on a school computer and don't have the rights to rm -rf the .vimrc file. I am out of ideas. ...
Elliot's user avatar
  • 1
0 votes
1 answer
453 views

Vim / Neovim PlantUML Preview didn't work

Environment macOS Ventura on M1 iTerm2 Homebrew Google Chrome I have tried to install a PlantUML-Preview in (Neo)Vim with this plantuml-previewer.vim plugin. There are described some dependencies: ...
Manny's user avatar
  • 1
1 vote
1 answer
68 views

Can you reload init.vim in-place in a way that gets rid of old keybindings?

Is it possible to reload init.vim without quitting Vim (Neovim in my particular case, but I don't think it should be different)? All the answers to this question that I've found here just say to re-...
rreagan3's user avatar
1 vote
1 answer
345 views

No digits in foldcolumn?

I would like my foldcolumn to have foldcolumn=1 width and to show only -, +, and | (happy to have an indication of the existence of a deeply nested fold, I don't need to know what the actual level of ...
Aaron Parisi's user avatar
2 votes
0 answers
224 views

How to configure cursor shape in visual, visual block modes?

I configure cursor shape in normal, insert, and replace modes with the following in my vimrc let &t_SI = "\<Esc>]50;CursorShape=2\x7" let &t_SR = "\<Esc>]50;...
Aaron Parisi's user avatar
0 votes
1 answer
136 views

Vim Colorscheme Not Loading [closed]

I created an 8 colour theme, put it in .vim/colors & told .vimrc to use it but the default colorscheme loads instead....
Clove Mill's user avatar
0 votes
1 answer
64 views

How do I determine the indentlevel to customize showbreak?

I want wrapped lines to look like this: some really long line that | ... reached the end of the | ... window. | const indented = () => { | // a really, really, | ... really ...
Aaron Parisi's user avatar
0 votes
0 answers
27 views

directly copying from `vim` to `mariadb` shell causing error

I have a file https://0x0.st/oYoB.com_5zfu After opening it with vim I tried to copy some portion of code and paste it in the mariadb shell. But it looked like mariadb was giving error. MariaDB [...
altair00's user avatar
1 vote
0 answers
95 views

The most lazy way to call the vim-copied content into bash

Setting in my .vimrc: set clipboard=unnamedplus Supporting in my vim: vim --version | grep clipboard +clipboard +jumplist +popupwin +user_commands +ex_extra -...
newview's user avatar
  • 291
0 votes
0 answers
455 views

Text width not working in markdown files?

I use vim pencil which has a setting called vim.opt.textwidth = 80. I also have this in my init.vim (neovim): let g:pencil#textwidth = 80 But when I am writing in markdown files, the text takes up the ...
Vinn's user avatar
  • 649
1 vote
2 answers
362 views

How do I restore normal colorscheme?

Upon launching vim, if I enter colorscheme the output is default. If I enter colorscheme default the colorscheme changes. If I change the colorscheme from the default to any other colorscheme and then ...
Jonathan Strange's user avatar
0 votes
0 answers
79 views

Vim not sourcing $MYVIMRC without restarting

At some point which I cannot pinpoint, sourcing $MYVIMRC on the fly stopped working. I tried the solution given here Vim doesn't source $MYVIMRC by typing the following on my terminal: export ...
Alvaro Neto's user avatar
0 votes
0 answers
84 views

Terminal inside vim: I can't quit without first exiting the terminal, any autocmd for this?

When I enter vim and open :terminal I want to :wq or :q without first having to switch to the terminal window and typing exit Any autocmds for this? Can't seem to find any. Note: I have the terminal ...
Nickotine's user avatar
  • 182
3 votes
1 answer
160 views

How to set g:python_indent.disable_parentheses_indenting?

:help ft-python-indent lists the following command: let g:python_indent.disable_parentheses_indenting = 1 but when I try to use that in my config I am getting the error message E121: Undefined ...
jakun's user avatar
  • 155
1 vote
1 answer
225 views

Checkhealth - ERROR: $VIM is invalid: $HOME/.config/vim

I share most of the configuration for vim and neovim between them and I set $VIM like this… if has('unix') let $VIM = "$HOME/.config/vim" elseif has('win32') let $VIM = "$HOME/...
paradroid's user avatar
  • 365
1 vote
2 answers
251 views

Python not working on Windows

I have a couple of plugins which use Python. They work fine on Linux but on Windows I am having difficulty in getting Python recognised. " Language Providers if has('unix') let g:...
paradroid's user avatar
  • 365
0 votes
0 answers
59 views

Vim automatically inserts "* " add the start of every new line in css files

If theres a "* " at the start of the previous line Vim automatically inserts a "* " at the start of the next new line. I want Vim to not insert anything. examples: 1|* {margin: 0;} ...
kongou's user avatar
  • 1
0 votes
1 answer
423 views

How do I add spaces to a file path in vimrc?

I am trying to set the shell to git bash in my vimrc. I have this: The code says: set shell=C:\Program Files\Git\git-bash.exe But because there's a whitespace in Program Files, it acts as a separate ...
GoodBoyNeon's user avatar
2 votes
1 answer
194 views

Why "c" option in formatoptions makes Vim hard-wrap my lists in "text" files?

Here is my test .vimrc: unlet! skip_defaults_vim source $VIMRUNTIME/defaults.vim set textwidth=78 let &colorcolumn = &textwidth + 1 set linebreak breakindent set number augroup ...
user90726's user avatar
  • 113
3 votes
0 answers
86 views

How to use :PlugInstall intelligently

I have installed YouCompleteMe in the past, but don't remember how. I recently decided to sync my ~.vim directory over multiple computers via a cloud service and realized I was inadvertently ...
jdc's user avatar
  • 141
2 votes
1 answer
379 views

What does runtime! debian.vim actually do?

The vimrc template I used had the message "Ensure options work with the Vim-related packages available in Debian." for runtime! debian.vim Here is the contents of /usr/share/vim/vim81/...
qwr's user avatar
  • 183
5 votes
1 answer
380 views

How can I convert vim8 function mapping to vim9?

I have a function in vim8 as: function! BSkipQuickFix(command) let start_buffer = bufnr('%') execute a:command while &buftype ==# 'quickfix' && bufnr('%') != start_buffer execute ...
BaRud's user avatar
  • 481
0 votes
1 answer
82 views

Vimscript: how to overwrite a variable that is inside an if block?

I have some code in a function like so: let branch = substitute(system('git rev-list -1 HEAD'), '\n', '', 'g') let num_branches = system('echo `git branch --contains '.branch.'` | wc -l') if ...
Jin's user avatar
  • 185
1 vote
1 answer
362 views

What does 'set setting^=value' really mean?

There is an old question here about best practices to store swap files, and there is an answer by flemingfleming (who haven't visited the site since 2018) where he suggested the following: set ...
john c. j.'s user avatar
2 votes
2 answers
428 views

How can I show the current keyboard layout in the statusline?

I use Vim with two keyboard layouts, English and Russian, and to be able to use Vim commands irrespective to the current layout, I have the following snippet in my .vimrc: " To switch between ...
user90726's user avatar
  • 113
0 votes
1 answer
114 views

vim status bar not consistent in all file

I recently set my vim status bar using this: " set status line set laststatus=2 set statusline= set statusline+=%#StatusLineFile# set statusline+=\ %F set statusline+=%m set statusline+=%= set ...
Jiang Yuanhao's user avatar
1 vote
1 answer
509 views

How do I :let a global variable in my vimrc in vim9script?

I am trying to change my vimrc to vim9script. For inbuilt fortran help, (:h fortran) we have: :let fortran_free_source=1 This is giving an error: E1126: Cannot use :let in Vim9 script If I remove ...
BaRud's user avatar
  • 481
8 votes
1 answer
393 views

Avoid breaking words before or after asterisk ('*')

If you have set wrap, sometimes you can see something like this: 5. A soft-wrapped line with an * italic* word. I would prefer Vim to not soft-wrap before or after asterisks, and so the same ...
user90726's user avatar
  • 113

1 2
3
4 5
37