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
1
vote
1answer
78 views

How to change the color of the vim ruler?

was hoping someone could help me in changing the color of the ruler in vim? Specifically, the opacity as I'm trying to make it match the rest of my vim opacity, but can't seem to pinpoint where ...
1
vote
0answers
46 views

Remapping Ctrl+backspace in insert mode to delete one word back

I want to bind Control+Backspace in insert mode to delete a word. I'm able to bind Control+Del in both insert and normal modes, but I can only seem to bind Control+Del in normal mode. I've checked ...
0
votes
0answers
27 views

The text color in Airline status line and tabline changes when I source the vimrc

So my airline status line looks like this when I start vim it looks like this -> https://imgur.com/zwOILU7. And when I source the vimrc it looks like this -> https://imgur.com/JnxeUfS I want it ...
0
votes
1answer
58 views

How to transform this Vimscript into Lua?

Can anyone help me transform this into nvim.lua? inoremap <silent><expr> <TAB> \ pumvisible() ? "<C-n>" : \ <SID>check_back_space() ? "<TAB&...
0
votes
0answers
22 views

How to make vim show suggest current word in spellchecking suggestiong if current word is correct?

I often write code, and sometimes I check comments with z= when I am not sure of a spelling of some word. Vim then presents a list of suggestions. However, when I got the spelling right and the word ...
0
votes
0answers
16 views

highlight clear SignColumn isn't taking effect

I can't understand why the setting highlight clear SignColumn in my vimrc doesn't seem to work when nvim launches. I've tried appending a : :highlight clear SignColumn. And I've tried adding the ...
0
votes
0answers
27 views

Mapping Esc makes vim open in REPLACE mode [duplicate]

I've enabled hlsearch to highlight text after searching, $ grep hlsearch ~/.vimrc set hlsearch and now I want to clear the highlight, which I can do with :noh. I saw that I can assign this to esc key ...
1
vote
0answers
44 views

error: there was a problem with the editor "vi" -- while trying to change deployment file

Facing this error error: there was a problem with the editor "vi" when trying to change a deployment file in the Kubernetes cluster (AKS) kubectl edit deploy xxxxx -o yaml upon exiting the ...
-1
votes
1answer
40 views

Problem setting cursor colors in vimrc: suppress the `-ne` that is written to my xterm on exit

Following the vim manual and also some threads on this site, I can set the color of my cursor to orange in insert mode and red otherwise, with the following lines in my .vimrc file. " use an ...
0
votes
1answer
44 views

Typescript add missing import on cursor?

I'm working on a TypeScript-React project using neovim, because I love it. I want a feature: when my cursor is on a name that has not been imported, I can press some key-combination to choose which ...
0
votes
0answers
13 views

Mouse navigation not working in VIM

I started using VIM today and I found out that we could use the mouse pointer to go to a line in vim using set mouse=a But unfortunately, it is not working here is the config file https://pastebin.com/...
0
votes
1answer
36 views

Automatically launch debugging session if make succeeds, quickfix list otherwise

Currently, I have begun using vim for C++ projects. I use vimspector for debugging help. This offers a command :call vimspector#Launch() to debug the current successful build. To build the current ...
0
votes
1answer
45 views

Trouble with persistence of background setting via vimrc

I have a structure thus: myproject/ .vim/ .vimrc Contents of .vimrc are: let g:usercolour = 0 if g:usercolour == 0 set background=dark colorscheme default endif if g:usercolour == 1 set ...
0
votes
1answer
29 views

Using a vim syntax file, I would like some Keywords, such as ??, to be colored

I have been trying to get through the syntax file documentation on vim help, https://vimhelp.org/syntax.txt.html#%3Asyn-files but it's quite the read and I figured someone here may know how to go ...
0
votes
1answer
27 views

Is there a way to have specific settings activated when using the term feature?

I often have neovim in a horizontal split mode with two buffers. The top buffer is the text file that I'm editing, and the bottom buffer is running a terminal using the term feature. I typically use ...
-1
votes
1answer
32 views

Why are so many underscore lines in my file when to open it with vim?

Everytime i opened a file with vim,so many underscore lines in it such as below: How can remove all the underscore lines ? :colorsheme is desert. The highlight output: The terminal is LXTerminal. ...
1
vote
1answer
37 views

To toggle statusline colors when switching modes. Problem with C-C

I use the following code to have different statusline colors for Normal and Insert modes: highlight statusLine ctermfg=black ctermbg=red guifg=red guibg=black autocmd ...
2
votes
1answer
68 views

Making Vim work with Unicode: what is the reason to use "setglobal fileencoding=utf-8"?

There is a tip on Vim Wiki about working with Unicode: if has("multi_byte") if &encoding !~? '^u' if &termencoding == "" let &termencoding = &encoding ...
0
votes
1answer
39 views

Difference between %f and %F (it's not that obvious!)

This might be a silly question, but what is the actual difference between %f and %F in status line? From :h statusline: f Path to the file in the buffer, as typed or relative to current directory. F ...
0
votes
0answers
37 views

What is the reason to specify ':cANSI' (or another character set) for a font

I often see that fonts intended to be used on Windows are defined with :cANSI. set guifont=Consolas:h11:cANSI The help is, of course, provide some explanation, but I don't really understand it. cXX -...
1
vote
1answer
39 views

How to get timezone using strftime command?

I have a custom command for stamping time in my log files. However, I would like that format to match the one of bash command date. For example, I use this command: :command InLog pu=strftime(\"\...
1
vote
1answer
40 views

choose template option for newfiles in vim

I have different templates in this directory ~/Documents/Library/ like: Template.cpp, normal.cpp, advanced.cpp normally i use this autocmd BufNewFile *.cpp 0r ~/Documents/Library/Template.cpp I want ...
1
vote
2answers
44 views

jedi-vim prevents mapping [[ to * and ]] to #

jedi-vim appears to prevent mapping [[ to # and ]] to * mapping does not alter behaviour produced by [[ or ]] in .py files when jedi-vim in bundle folder (and does alter behaviour in .py files ...
0
votes
1answer
37 views

Can you have relative numbers, but for characters/words in a line?

This is relativenumber. It shows the line numbers, relative to your cursor: 1 one line before your cursor 0 your cursor is here 1 first line after 2 second line 3 third line 4 and so on It's super ...
2
votes
1answer
295 views

How can I detect the encoding of a file correctly?

Sometimes I download files in cp1251, cp866, and koi8r encodings, all of which are used to represent Cyrillic characters. How should I specify them in set fileencodings=... so that when I open such a ...
2
votes
1answer
206 views

How does smarttab actually works?

Yes, I'm aware of what :h smarttab says, but I still cannot figure it out. " My vimrc set backspace=indent,eol,start set tabstop=8 " I always keep this 8 set shiftwidth=4 set softtabstop=-1 &...
0
votes
2answers
33 views

To reload vimrc on file save

I'm trying to make Vim reload its vimrc when I save a file. I have found different solutions, but none of them works for me for some reason. Vim version: 8.2.2824, OS: Windows 7. My vimrc: " I ...
0
votes
1answer
31 views

How can I create a command alias for :Ex /path/to/directory

I'm trying to make my life easier by making a shortcut for the following command :Ex /path/to/directory I need to to be able to press :akeyword and execute the command above. The directory needs to ...
0
votes
2answers
39 views

how to make a word turn into certain commands in vim command line?

I want :cup in vim command line to turn into :tabdo call MapRunCmd()<CR> Hope that somebody can help me out PS: I've tried this nnoremap :cup :tabdo call MapRunCmd()<CR> but didn't like ...
0
votes
1answer
45 views

How to escape a pipe (|) in my vimrc

I've seen How to escape pipe character in `:make`, `:grep` and friends How to escape pipe (|) in mapped substitution? https://stackoverflow.com/questions/29596150/use-to-diplay-tabs-in-vim But none ...
0
votes
1answer
30 views

Run `vim -c <command>` before loading vimrc?

I'm adding some setup to my .vimrc, and what I want to do is to be able to run a command using the command line before the vimrc is executed. I tried vim -c 'command' but it runs after the .vimrc. The ...
1
vote
1answer
66 views

inserting non-printables in vi

After a near-crash, the assistence has installed LINUX 20.4 instead of 16.04. When in vi I try to insert a ^C using ^V^C I insert [27;5;99~ Is someone able to tell me which initialization file ...
0
votes
1answer
35 views

Need help to make a by-default `:RunWithFile` of this toggle function

related to this post, How to make a toggle function in .vimrc that toggles multiple configs of almost same type? @BLayer's code func! MapRunCmd() abort if exists("b:rwfcmd1") && ...
18
votes
2answers
4k views

Vim cannot find medical spell files

Problem specification I would love to have a medical spell dictionary in vim. Currently, I have a lot of medical terms in my own personal English dictionary right now. However, using an official ...
0
votes
2answers
36 views

How to move `n` number char <left> in vim command line?

My init.vim code autocmd FileType cpp nnoremap <F4> :RunWithFile ~/Downloads/ > output.txt && cat output.txt I want my cursor position to be exact 31 times <left> in command ...
1
vote
1answer
79 views

How does "set mouse=a" actually work?

Could somebody explain, what is the reason to use set mouse=a? People say that thus I will be able, for example, to resize split windows (:sp, :vsp) by dragging separators, but I already can do it if ...
1
vote
1answer
45 views

Is there a reason to include "set ruler" and "syntax on" in my vimrc?

Could somebody explain, why some people add set ruler syntax on to their vimrcs? Aren't these settings are already enabled by default? Is there an objective reason for it?
0
votes
1answer
41 views

Youcompleteme: shortcut key to format selection

According to this documentation :'<,'>YcmCompleter Format will format the selected text. I am struggling to map this to shortcut key <S-F2>. I have tried all of the following after having ...
0
votes
1answer
40 views

Why vim creates an extra last line when importing a template?

My init.vim code: autocmd BufNewFile *.cpp 0r C:\Users\User\Desktop\cp\Template.cpp When i create a .cpp file, Template.cpp code is imported in that cpp file. upto this point, everything is fine. ...
0
votes
0answers
46 views

Difficulty mapping normal key strokes into .vimrc

I am trying to create a shortcut key that does the following steps in normal mode: Go to stack trace window Go to second line from top in this window Press Enter In step 2, the second line from top ...
0
votes
1answer
34 views

Line continuation and commenting out

This is a part in my .vimrc that is used to change appearance of tabs to → (arrow right) and spaces to · (dot). set list set listchars= \tab:→\ , \space:·, \nbsp:·, \extends:›, \precedes:‹ ...
0
votes
2answers
43 views

project-based config: how to load plugins/colors from custom subdir of $PWD when doing `vim -u local/vimrc ...`?

The Need, the Goal... By "project-based config" I mean a project contained in a git repo that contains all the vim configuration -- vimrc and plugins and colorschemes -- right there in the ...
0
votes
1answer
67 views

how to deduplicate packpath / runtimepath?

Problem: I noticed that my "&packpath" has some duplicates, I want to remove them. What I have tried: My viml knowledge is not very strong but I did manage to create a unique "List&...
0
votes
1answer
33 views

How do I make the statusline selectable in gvim/macvim?

With terminal vim I can just double click the statusline and select the filename, which is very handy. In gvim or macvim clicking the statusline prompts me to resize the active window, not very useful....
1
vote
0answers
15 views

How to suppress "file written" shortmess?

Upon saving a file, vim shows a message like, "file" [New] 0L, 0C written I want to suppress this message. I have tried adding shortmess+=FW to my ~/.vimrc but it doesn't seem to work.
1
vote
1answer
43 views

Setting 'viewdir' does not work with :mkview

I'm trying to use :mkview with 'viewdir'. I set 'viewdir' as the help page said: set viewdir='C:/Users/MyPC/vimfiles/view' and made sure that C:/Users/MyPc/vimfiles/view exists, but I still get error ...
3
votes
2answers
146 views

Call plugin-defined function in .vimrc

I use tpope/vim-fugitive and airblade/vim-gitgutter and I want to selectively enable gitgutter only in git repositories. Since vim-fugitive provides FugitiveIsGitDir which returns 0 or 1, this could ...
0
votes
1answer
20 views

Root using symlink for .vim. Vim configuration of other user not inherited as expected!

I have customized my Vim environment under my "login" ID ${HOME}. Everything is under ~login_ID/.vim (no customizations under ~login_ID/.gvim). I have created a symbolic link /root/.vim ...
0
votes
1answer
40 views
2
votes
2answers
134 views

Vim 8.2 no user defined functions

Yesterday I updated Vim to version 8.2 thru my Linux distro repositories (Fedora). And now I noticed that no user defined functions exist. They worked just yesterday, before the update. I define ...

1
2 3 4 5
31