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
2 answers
20 views

How to set all files under a folder to a specified filetype?

I have some zsh function files that I should not add extensions to for the convenience of calling, i.e. my_func instead of my_func.zsh. But this causes an issue that Neovim cannot detect their ...
  • 1,131
0 votes
0 answers
7 views

vim (8.2) "freezes" when :VimTexCompileSS is used (I need to write CTRL+C to make it work again)

I am using vim with vimtex, to use the background compilation. When I use the command :VimTexCompileSS, I am then unable to write anything on vim, unless I press CTRL+C to stop it. To click on the ...
0 votes
0 answers
33 views

Creating a local vimrc for a large LaTeX project with selective plugins, settings, and mappings

This is related to my previous question that you can find here: I am currently working on a large project (a PhD thesis with multiple chapters, each consisting of around 30 pages) and have found that ...
  • 213
-1 votes
0 answers
29 views

The key i to insert two double quotes at the current position is not working

On Vim, I try to record a key sequence macro to surround a selected text in double-quotes. First, I select a string of text and press key q followed by a register key to associate the macro, here I ...
1 vote
1 answer
109 views

When to use "set exrc" and local '.vimrc' in Vim, and how to manage plugins with multiple 'vimrc' files for large projects?

I'm using Vim for a project that has a lot of pages per chapter, and Vim is a little bit slow. I want to create a local '.vimrc' file for this project with only the plugins I need, and I'm trying to ...
  • 213
0 votes
1 answer
17 views

`Cmd+V`/`Ctrl+V` pasting has an extra new line

In init.vim I have: set clipboard^=unnamed,unnamedplus In order to ensure text is yanked into the system clipboard. In Neovim, I select the lines in line mode (V) and copy them with y: a b c In a ...
0 votes
1 answer
52 views

Is there a popular config for Neovim? [closed]

I found a lot of repositories in Github about init.vim like amix vimrc but I couldn't find anything about init.lua. Do you know some repository? I think many of people still using Vim.
1 vote
2 answers
53 views

Enable github copilot in Neovim for shell command editing

I use bash and like to use the built-in command Ctrl xCtrl e to invoke an editor in the shell in order to edit the current line. This creates a temporary file, named /tmp/bash-fc.[Some random ...
0 votes
1 answer
40 views

vim xterm-kitty problem

Using Vim with Kitty , the client area redraw doesn't work when I resize the window; in this context set term returns term=xterm-kitty. However, starting Vim with vim -T kitty the redrawing of the ...
0 votes
1 answer
20 views

Do I need to set `:filetype on` myself in Neovim?

As title. I'm a user of Neovim and am trying to learn something very basic. My point is that I don't want to set things that will be enabled by Vim by default. And what's the relation between :...
  • 1,131
1 vote
2 answers
117 views

Call original gf after remapping gf to custom function

gf doesn't work for absolute links used in Azure DevOps yaml files, p.e. - template: /devops/template/my-template.yml (It only works without the leading slash.) This is why I have created my custom ...
  • 195
0 votes
1 answer
14 views

Plugin specific config not loaded

I have in .vim/after/plugin/ a file called deoplete.vim Inside is this code let g:deoplete#enable_at_startup = 1 " Enable autocompletion at startup " Autocomplete Deoplete + Vimtex call ...
  • 213
1 vote
1 answer
43 views

How can we know if we can intall a plugin on both Vim and Neovim?

I find in noevimcraft a list of Neovim plugins Can we install them inside Vim or gVim? It seems that the plugins in vimawsome can be installed on Neovim but not always in Vim. Is that correct? How can ...
0 votes
1 answer
17 views

Having trouble understanding part of `'runtimepath'` documentation

I get the basics of the runtimepath as explained in :h 'runtimepath'. Except for the remark at the end for Neovim (nearly identical in Vim): You can put a directory before $VIMRUNTIME to find ...
0 votes
1 answer
34 views

How do I get coc.nvim to auto-open?

I installed Plug 'neoclide/coc.nvim', {'branch': 'release'} And now I seem to be able to use <C-n> and <C-p> to trigger autocomplete menu but it doesn't show up automatically as I type. I ...
  • 249
0 votes
1 answer
19 views

GNU Octave octave.vim syntax file auto indent not working

Before introducing the octave syntax file in ~/.config/nvim/syntax/octave.vim from here auto-indent worked as expected. After introducing the file, the syntax coloring works, but the auto-indentation ...
0 votes
1 answer
22 views

How to make auto-format portable?

I have these long lines, using Vim built in function to auto-indent programming files on saving file. How can I make this more compact ? Actually, I just want to exclude .txt files, because I don't ...
0 votes
1 answer
24 views

Invalid argument error with tab in listchars

I used list and listchars in vimrc file to display hidden characters but I get this error: E474: Invalid argument: listchars=tab:> after tab:> there is also a space. Below I have the complete ...
0 votes
0 answers
24 views

How to use the prefix key in tmux and Vim?

I am new to tmux. I have some configuration added to my tmux configuration file. I use Ctrl Space as prefix in tmux, and I want to use the same prefix key in Vim. But I find that Vim uses Ctrl Space ...
0 votes
1 answer
30 views

How to always open the `:h` as a split from the current window?

As title. Say I have A|B and already called :h foo on B then if I call :h bar on A it will not create a new split under A but change the content of the split from B instead. What I expect is that I ...
  • 1,131
0 votes
1 answer
32 views

How to map Vim command and CTRL-W R together?

Problem I am trying to map the F10 key with theterminal bash % command so I can execute the current open file with bash in a split pane setup (this functions works). The problem is when I try to add ...
  • 1
-1 votes
1 answer
76 views

What is the Vim shortcut on Mac to expand emmet snippet? [closed]

I am in newbie to Neovim. I have tried CMD Y but it is not working.
0 votes
2 answers
28 views

How can I use 'while' and 'if' in Vim script properly to turn off highlight automatically?

Consider: This is my code in Vim. As the code comment describes, I want to remove highlight when the cursor moved. Currently, I highlight will remove when entering insert mode, but it can still be ...
0 votes
2 answers
33 views

I am using Vim 7.4. I do not have admin privilege to update it. I want to use plugins as I cannot use plugin manager

I download Vim-plug but I am unable to use it. I have downloaded NERDTree in ~/.vim/pack/vendor/start/nerdtree. But when I give command :NERDTree in gVim editor it gives an error: Not an editor ...
0 votes
1 answer
31 views

Vim: mapping tab to ctrl space only if the cursor is in front of a non whitespace character

I am using the jedi-vim extension and really don't like pressing ctrl-space to bring up auto-complete. I would like to use tab, but also obviously when coding I need tab for indentation as well. I ...
  • 1
2 votes
1 answer
27 views

Get current vimscript script name and line number?

In C programming language, it's typical to log a message with filename and line number of the source code file the message is coming from: #define log(fmt, ...) printf("%s:%d: " fmt "\...
  • 213
0 votes
0 answers
20 views

Execute a command after successful EasyMotion's motion

I've EasyMotion plugin installed. I want to execute a command (G just for example) after a motion (note: the motion requires an user's input) is completed. In my ~/.vimrc I've tried to do it by ...
3 votes
3 answers
344 views

How can I create mappings to execute specific Vim commands, depending on if a makefile exists?

In general, I have makefiles setup anytime I'm working on C projects. To save and compile these projects, I've bound the ' key to do this: map ' :wa<CR>:!make<CR> However, I sometimes ...
1 vote
2 answers
50 views

why setting as autocmd

To display linenumbers, I can do: :set number in the edited file (that works) or insert set number in the .vimrc (that works too). To change the filetype, I can do: :set filetype=c in the ...
0 votes
0 answers
37 views

Coc Nvim automatically select all text between tags

I have mapped esc to < C-J> in .vimrc and whenever I try to go to normal mode after inserting some text inside any html tag using that mapping it selects all the character between that tag like ...
2 votes
1 answer
50 views

Cannot open terminal ini nvim

I installed Plugin terminal using the vim-terminal plugin and try to execute :TerminalSplit bash but before the terminal open I got a warning message. Python 2 interface is not installed, using Python ...
0 votes
1 answer
54 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 ...
0 votes
1 answer
45 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 ...
  • 172
1 vote
1 answer
24 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 ?
0 votes
1 answer
24 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 ...
1 vote
1 answer
118 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 ...
  • 21
1 vote
1 answer
22 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 ...
0 votes
1 answer
43 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 ...
0 votes
0 answers
56 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?...
  • 101
0 votes
1 answer
17 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 ...
  • 5
0 votes
1 answer
18 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: ~/...
0 votes
1 answer
30 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 = &...
0 votes
0 answers
45 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 ...
  • 101
0 votes
0 answers
24 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 ...
  • 101
0 votes
1 answer
107 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', \ ...
0 votes
0 answers
25 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....
1 vote
1 answer
64 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:...
1 vote
1 answer
22 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> ...
  • 13
0 votes
1 answer
41 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 ...
1 vote
1 answer
45 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 ...

1
2 3 4 5
35