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.

2
votes
1answer
33 views

`.vimrc` unsuccessful in setting highlight style

1) To underline misspelled words, I can execute the following in an open buffer: :hi clear SpellBad :hi SpellBad cterm=underline :set spell 2) However, if I write in my .vimrc the first two lines, ...
0
votes
0answers
14 views

Is there an `edefault` in the spirit of `gdefault` for setting the appropriate flags in vim's substitution commands?

To perform a buffer-wide substitution on all occurrences of foo (and not just the 1st one in a line), we can do %s/foo/bar/g The g flag may be omitted by setting this in the vimrc as set ...
1
vote
0answers
59 views

Simple .vimrc takes a very long time to save

Saving a file with :w takes several seconds for me, and I can't figure out the culprit. This is my .vimrc " Specify a directory for plugins " - For Neovim: ~/.local/share/nvim/plugged " - Avoid using ...
0
votes
1answer
32 views

How to disable margin (+/!)?

Currently I installed vim addons for python. http://fisadev.github.io/fisa-vim-config/ However, I don't like the +/-/! on the margin. Does anyone know how to disable all of them? Thanks,
0
votes
1answer
25 views

localleader is not obeyed

for my fortran code, I have defined: au FileType fortran let maplocalleader = "`" # i have tried \` as well. For fortran filetype in vim, :echo maplocalleader is showing ` as expected. But, then,...
0
votes
0answers
17 views

Problems installing Vundle in fresh install of Vim

I, I'm trying to to install vim to use as a Python IDE on arch. I was using this tutorial to do it, but ran into some troubles. When I tried to open vim I got the following error messages: https://...
1
vote
1answer
68 views

enter inside curly braces does not indent

When I create a curly braces and press enter inside it I get this behavious {|} -> enter key { |} Now how do I get vim to do this {|} -> enter key { | } my vimrc brief filetype plugin ...
0
votes
1answer
35 views

custom snippet extender Ultisnips

Suppose I have a snippet: snippet prg !This is file : `!v expand('%:t:r')` ! Author= `!v expand($USER)` ! Started at: `date +%d.%m.%y` ! Last Modified : Sun 16 Jun 2019 12:30:58 IST ...
0
votes
2answers
47 views

Move cursor to old position after scrolling

I often want to edit text in say line 200 of a file, but while doing this I need to look at say line 100, so I scroll to line 100. Is there a way to quickly jump back to line 200 after scrolling? Is ...
1
vote
1answer
31 views

How to source vim-scripts on Windows?

In (g)vim on Windows I can use :source \Program\ Files\ (x86)\Vim\vim81\msvim.vim to source the script for the Windows settings. Vim suggested the syntax with leading backslash when I found it in some ...
2
votes
1answer
21 views

How to have getcwd() give path with ~ in place of home folder?

I have the following (simplified) statusline config in my vimrc: set laststatus=2 set statusline= set statusline+=%{getcwd()} When I'm somewhere my home directory on macOS, my statusline looks like ...
2
votes
2answers
39 views

Can EXINIT contain more than one command?

I have my EXINIT set to export EXINIT="set ts=4 sw=4 ai nosm nows expandtab" I also want syn off to turn off syntax highlighting by default. How can I add this to EXINIT? Tried using ; as a the ...
2
votes
1answer
52 views

How to stylize text between backticks ( ` ) to match text style between single/double quotes ( ' | " )?

In my vim, I'm using gruvbox. Syntax colorization is great for everything except text written between `backticks`. You'll note once backticks are used, all subsequent lines of text are green. I would ...
1
vote
0answers
52 views

How does vim receive f1-f4?

Literal terminal code of <f4> is: ^[OS result of set <f4> is: t_k4 <F4> ^[[14;*~ They are totally different, unlike results of f5-f12 (which are the same except the ...
-1
votes
1answer
38 views

vimrc for ale is creating confusion: is my augroup wrong?

My vimrc: https://paste.fedoraproject.org/paste/Wl5jvebADSDoAI4HbIX-hA and my corresponding python file is: https://paste.fedoraproject.org/paste/g60mU7xBqGaEuKKWkZ6Rnw The problem is, with ALE, as ...
0
votes
1answer
49 views

How to set tabs in vimrc (Vim 8.1, Windows 10)

I thought this was straightforward i.e. put the command that works in the buffer viz "set ts=4" in vimrc but this does not seem to work if I also want the functionality provided by vimrc_example, ...
0
votes
1answer
19 views

How can I specify “split or move” logic for <C-W><C-L> and similar move commands?

Is it possible to make <C-W><C-L> command to make split on the right, if it's the rightmost pane opened? Otherwise, it would behave like regular move. It's something like "conditional ...
2
votes
1answer
49 views

Where can I find color settings used by Vim and NeoVim?

I've been using dotfiles created by other people to setup Vim. Recently I decided to create my own config and investigate what's NeoVim about. I'm using default OSX Terminal.app with zsh shell (I've ...
0
votes
0answers
30 views

Vim “Follows” Hard links

I have a git repository that contains my vimrc file and a couple of other utilities, called myvimrcgit. I then hard link my vimrc to ~/.vimrc, so that they point to the same inodes. Now, when I go to ...
1
vote
0answers
40 views

blue warning suppression, zip folder [closed]

Is there a way I can remove the blue warnings that appear when editing a file from a zip folder in vim? Is there some setting I can apply in the vimrc file? Sorry, they are not really warnings but ...
0
votes
1answer
35 views

Cursor in middle of the screen at start and end of file

I'd like to keep the cursor at the middle of the screen wherever I am in the file, without scrolling. This mean to have blank space above the file when I'm at the start of the file, and have blank ...
-1
votes
1answer
37 views

ctrl-n - should not insert text

When I am using the ctrl-n functionality (autocomplete word), it just inserts the text. I do not want to do that, instead, I would want to choose a word from the dropdown list, which I may then want ...
0
votes
1answer
45 views

/usr/share/vim/vimrc taking precedence over ~/.vimrc for textwidth

Here is my ${HOME}/.vimrc : set textwidth=0 set history=100 (FWIW, inverting their order has no effect, as one would expect.) It is read by vim (:echo $MYVIMRC returns the correct path), and indeed ...
1
vote
1answer
22 views

Single key/keyword to invoke code formatter across all extensions?

Is there a way to bind a single in visual mode, or a small word in ex mode that will invoke the code formatter for the active filetype? For example "ESC : fmt" or CTRL ALT F in visual mode, to invoke "...
2
votes
2answers
111 views

imap <space> to _ (underscore) when writing function names in python files

the goal is to be able to write functions names that follow PEP8 as easily and naturally as writing this sentence. there are many types of situations that need handling insert _ (underscores) for ...
0
votes
1answer
24 views

Debugging foldexpr function

I have debug=msg,throw in my .vimrc. When trying to debug a foldexpr function, the echom statements I use to print are ignored and are not accessible by :messages. Any way to make them work?
2
votes
1answer
63 views

How to read a from a file while executing code

Related config: noremap <F5> :make<CR> noremap <F6> :!./%<<CR> noremap <F7> :!./%< 2>/dev/null<CR> The problem is while running the program with F6 when ...
1
vote
1answer
26 views

Vi shortcut to execute line under cursor as a command

I am searching for a way to execute a line under the cursor as a command. I assign it to a combination of <Leader>el and basically I found a way to do it with :exe !@u but the issue I have here ...
1
vote
0answers
24 views

Different versions of vimrc being read [duplicate]

I have an absurd problem. Honestly, I have a hard time figuring out whether this belongs here or a Windows forum. Using Vim on Win10, I've changed my C:\Program Files (x86)\Vim\_vimrc from the awful ...
0
votes
1answer
28 views

How to access any given vim plugin documentation?

I am new to vim and I've been asking a bunch of questions on here, most of which has to do with plugins. What is the correct way to access the documentation for plugin? As an example, I am using the ...
0
votes
1answer
52 views

how could I use gvim through ssh two hops

I sometimes need to work on remote server which does not have x11 installed and thus I cannot use vim with its full features. I want to work on remote server with the gvim installed to my local ...
0
votes
1answer
27 views

Enable line numbering for directories

When viewing a directory (using :Explore, for example), I would like to see line numbers. I can run :set number after opening the directory, and that works, but I can't get numbering to turn on by ...
1
vote
0answers
55 views

Does explicit setting of $MYVIMRC imply its execution as private vimrc?

Vim manual says: "The $MYVIMRC environment variable is set to the file that was first found, unless $MYVIMRC was already set and when using VIMINIT." Does this also mean that setting of $MYVIMRC (e.g. ...
1
vote
1answer
17 views

How can I run a specific vimrc file after running the default one?

How can I run a specific vimrc file after running the default one? (i.e. run the default one, then one of my choosing)
1
vote
1answer
36 views

UltiSnips not working with VimWiki

I have been trying to make UltiSnips work with VimWiki to no avail, as they share mappings for expand snippet/next link (on <tab>). I tried setting VimWiki's bindings to something else by using ...
0
votes
0answers
24 views

tabstop doesnt work by default in python files [duplicate]

I have set up set tabstop=2 set lcs=tab>.,trail=. in .vimrc when i open .txt files, tabs are displayed as >. however when i open a .py file, tabs are displayed as >......... I ...
1
vote
0answers
26 views

unable to setup persistent undo history in Vim

I've looked up and tried several of the following post up here regarding setting up persistent undo history in vim, but still I'm not able to do so. (macOSX Mojave) here are some info: :version ...
0
votes
1answer
44 views

How can I get vim to type continuously, rather than holding in place for keymappings?

For the purpose of this question, imagine that I have set iab phil philosopher In vim, as far as I know, the default display pattern when typing out the characters "phil" at the start of the word is ...
0
votes
2answers
82 views

how could I enable vim clipboard with sudo and x11 installed

I am given an account on a new server these days. The new server does not have x11 install, neither do I have sudo. So I cannot install system packages, and I cannot compile with the option -with-x. ...
2
votes
1answer
97 views

Change/Set color to a string in statusline

I'll preface by saying that I am using Airline, plytophogy/vim-virtualenv plugin and gruvbox as the Airline theme. I am trying to change the color of some string in the status line to, say, orange. ...
0
votes
0answers
16 views

How can I get swap files for new/unsaved files/code in empty buffers? Any way to recover unsaved files?

I'm trying to configure Vim to make it so that if my system crashes I can recover my work from swap files set in set directory=. I tested this out on Vim in Windows using gVim. If I forcibly crash ...
0
votes
0answers
15 views

Disable E303 warning when swap directory isn't writeable

I sometimes run vim as another user than me, using my own vimrc. In this case the swp and undo directory aren't writeable, and vim warns me with E303. I don't care about not having swap file in this ...
2
votes
0answers
53 views

Unwanted extra indentation of multi-line statements

How can I make continuation lines indent 1 tab instead of align with the some text? With the default cindent options, I get the following: static int A = 0, B = 0, C = 0; But, ...
1
vote
0answers
42 views

Syntax highlighting - help me find the bug

I have a bug and I can't figure out the solution. Perhaps you esteemed folk can be of aid. I want to extend a syntax file (julia syntax in polyglot package). I want to include the following patterns ...
0
votes
1answer
43 views

Setting a list of tag files

Is there a way to set multiple default tag files, to be searched sequentially in my vimrc? My hope was that I would be able to have a local tags file that would be searched first and then, if nothing ...
0
votes
1answer
130 views

Integrating autocomplete and snippets

I'm trying to set up an autocompletion/snippet workflow that's a bit complicated. This is stemming from needing a better workflow for latex. Right now I'm using coc.nvim and UltiSnippets but I am ...
0
votes
1answer
61 views

don't use scrolloff=5 for mouse clicks

I use (neo)vim with mouse=a and scrolloff=5. Clicking on one of the top or bottom five lines with the mouse causes the screen to jump (so that the new cursor position is more centered), which ...
0
votes
0answers
28 views

In Vim, how to enable Meta in all keybindings?

In case it's relevant, this is on MacOS and iTerm. How do I use key mappings that involve the Meta key, e.g. <M-e>? For example, the auto-pairs plugin has a keybinding that allows you to ...
0
votes
1answer
37 views

Vim opens an empty buffer when I try to open an existing file

when I use: vim <file_name> vim opens an empty buffer with no name ([No Name]). But when I type: :tabnew <file_name> it opens the file properly. I tried :bdelete to delete the open buffer ...
1
vote
1answer
216 views

How to set if else for vim's “set background = ” for light and dark colorschemes?

For themes like One or PaperColor, there are dark and light versions. For dark or light theme, I usually add my own customizations like bracket color, comment color... etc. I tried to combine them ...