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
23 views

Autoreload vimrc when writing to vimscript files

I wanted to have my vimrc automatically update when I write to a .vim file using this autocmd: autocmd BufWritePost *.vim,$MYVIMRC source $MYVIMRC But for some reason when I have this enabled and ...
0
votes
0answers
15 views

ftplugin not loading

This is my .vimrc set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle....
1
vote
2answers
46 views

Is there a way to paste at multiple locations/lines in vim?

I use :copy a fair bit. So like range :12,15 copy 20 will paste a block of text from 12 to 15 lines at 20th line. But when I want to paste a line at multiple places it doesn't work. For example :24 ...
0
votes
0answers
35 views

How to control .cache folder location?

Is there an option to control .cache folder location in Vim? Is there a setting or a variable for this?
2
votes
1answer
38 views

Is there a 'toggle' :set option?

In my $VIMRC I have: nnoremap <leader>A :set formatoptions+=a<cr> nnoremap <leader>a :set formatoptions-=a<cr> What I'm wondering is if there's something more like: nnoremap ...
2
votes
0answers
26 views

Issues in changing font size in vim

I using konsole terminal emulator and I am facing some issue with changing the font size in vim. If I add the following snippet into my .vimrc. In the vim application, the font size will snap back to ...
1
vote
1answer
21 views

How to use matchadd to add exact word?

Referring to answer from this link.. Adding two groups, :highlight MyGroup1 ctermbg=green guibg=green :highlight MyGroup2 ctermbg=blue guibg=blue Then adding two words foo and bar into specific ...
0
votes
0answers
19 views

Any ideas why python3 syntax highlighting not working on vim? [on hold]

Tried several plugins, I have +python3 on vim --version. What should be my next steps when debugging this problem? Thanks.
0
votes
1answer
28 views

How to create a custom colorscheme in which define custom highlight group each of containing set of words?

Let's assume we want to create a custom colorscheme. For example, content of a custom colorscheme file ~/.vim/colors/mytheme.vim are as follows, " syntax highlighting groups hi Comment guifg=#007f7f ...
1
vote
0answers
25 views

vim doesn't load syntax for a single file

I was toying around with my .vimrc editing it, and then checking in another file whether my changes worked or not. But now I ended up in a state where opening one file with vim file1.tex (this was ...
1
vote
1answer
53 views

Gvim 8.1 on Windows 10 won't source $HOME\_vimrc

I have a $HOME\_vimrc present, but it doesn't show up in the output of :scriptnames. And when I run gvim -V, it reports: could not source "$HOME\_vimrc" The only thing in my $HOME\_vimrc is the ...
1
vote
1answer
23 views

I'm using a colorscheme installed with vim-plug, how can I change the color of the line numbers?

I'm using this colorscheme, how can I change the color of the line numbers? I think that the colorscheme will overwrite anything I'll put in .vmrc.
1
vote
1answer
27 views

Why can't I install this colorscheme properly?

I'm trying to install this colorscheme. They instructed to use a package manager so I've used vim-plugged: Plug 'rakr/vim-one' While my colours on vim did change, it really does not look like the ...
0
votes
0answers
33 views

Send keystrokes and string to gdb terminal

I started debugging a c program inside vim with: :packadd termdebug :Termdebug with vim 8 and and gdb > 8.3 installed. In order to set a breakpoint, I would like to send the following string while ...
0
votes
0answers
31 views

Center current line to the center of screen when opening a file

I would like to execute 'zz' to center the current line to the center of the screen when opening a new file. I have tried the following, but it does not seem to be working for some reason: autocmd ...
0
votes
2answers
49 views

Making operator insert and append repeatable

Is there an insert and append operation that can be followed by a text-object? I've found this plugins: https://github.com/deris/vim-operator-insert https://github.com/mwgkgk/vim-operator-insert ...
1
vote
1answer
39 views

Underscore suddenly a word boundary

I now have Vim version 8.1.2102 from Sep 30 2019 15:45:59 on Fedora 30. For some reason the word boundary in C++ code now also includes the underscore somehow, so I see this: When I have the cursor ...
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 ...
0
votes
1answer
53 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 ...
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[/]...
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 ...
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 ...
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 ...
1
vote
1answer
29 views

Vim - swaping the curly braces and brackets, breaks the plugin shortcut

I want to swap curly braces and brackets. The problem I encountered is that some plugin shortcuts dont trigger. Here's example. If I put this in my config file: nnoremap { [ nnoremap [ { then ...
0
votes
0answers
27 views

How to remove blank line at the very bottom of the UI

To make things easier to explain, please see below a screenshot of VIM running on my computer. How can I get rid of that blank line at the very bottom, i.e. below the "n lines, p characters written" ...
3
votes
2answers
80 views

Multiple vimrc files for different file types in vim?

I'm a vim beginner. I want to handle multiple programming languages. I find great resources for how to perfect vim for one programming language by putting ton of stuff in one vimrc file. This is ...
0
votes
0answers
20 views

Auto-insert C++ comment only on <shift+enter>

The comment auto-insert feature is often very helpful and otherwise very annoying, depending on the kind of comment I am writing. Is it possible to bind the auto-insertion of // exclusively to <...
0
votes
0answers
49 views

VIM suddenly highlighted the spaces in my file how do I turn this off?

I just recently used Vim as my code editor. It was working fine then suddenly when I opened a file to edit my code this happens. When I open the file nothing is highlighted. But when I start scrolling ...
0
votes
0answers
26 views

How can I complete both words and WORDS? [duplicate]

I found this question, but mine is a bit different. When I write code dealing with arrays or classes like $myArray['myElement'] or document.getElementById("myElement"), I get annoyed because I have ...
2
votes
1answer
33 views

How to disable arrows in insert mode VIM

I want to disable my VIM-arrows in VIM, to get used to move the cursor using hjkl. I have tried a lot of different approaches found on this forum, however, i can't seem to disable the up and down ...
0
votes
2answers
53 views

What's the fastest way to open up .vimrc?

I'm just getting into Vim, and, as one might expect, I'm constantly adding things to my .vimrc. At the moment i'm using :tabe ~/.vimrc and I was just curious if there was a quicker command for getting ...
1
vote
1answer
32 views

Search for more then one numeric value in vim

I am trying to search for numeric values in files. I use / command to start my search (/34587). However I need to add more then one search criteria (i.e. finding value 3487 and 09087 for instance). ...
1
vote
0answers
29 views

Vim unknown colored block

My vim on WSL has some unknown colored blocks. The weird thing is it happens randomly and some colored blocks would disappear when I pass them using cursor. The following is my .vimrc settings: ...
0
votes
1answer
35 views

Syntax Question for exec (executing two commands)

In my .vimrc, I have the following exec command: inoremap <C-f> <Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b.vimtex.root.'/figures/"'<CR><CR>:w<CR&...
1
vote
1answer
67 views

Same plugins for every .vimrc file (vim-plug)

I have a question regarding the following situation: I want to use a default .vimrc and a vimrc (name it .vimrc2) for a special purpose. However, when I start vim with vim -u ~/.vimrc2 I have the ...
0
votes
2answers
51 views

Reload complete configuration from within vim

Every now and then I update my ViM configuration, and I would like to have a way to reload everything. I know that I could use :source ~/.vimrc and I could run it similarly for all the modified ...
1
vote
2answers
47 views

Moving the cursor a large number of times in a nnoremap

I have a shortcut in my vimrc to search for a string through my repository: nnoremap <leader>gg :vimgrep // **/*.py \| clist I want the cursor to be between the // characters ready for a ...
2
votes
1answer
50 views

Helptags gives: E488: Trailing characters

I am relatively new to vim. I made my .vimrc file watching different tutorial in order to use vim mainly as a python IDE. I am using pathogen as plugin manager and I have recently installed python-...
5
votes
1answer
476 views

How do I remap “å” to type “å”?

I recently came over some use for letters like æ, ø, and å. For context, these are available on my keyboard, and work fine in other programs. It's also a Norwegian keyboard if that's relevant. With ...
1
vote
1answer
36 views

In Vim how to keep markers per session?

I use sessions to separate projects in my workflow. - info.txt file that I always mark "I" - log.txt file that I always mark "L" But when I switch sessions, my markers are kept from the last ...
1
vote
3answers
61 views

Non ascii characters to similar ascii characters at Vim

I want to convert nonASCII characters to similar ASCII alternatives. I can do it at shell using echo şİçğ | iconv -f utf-8 -t ascii//translit but how can I do it for selected vim text?
2
votes
1answer
21 views

How to set printexpr on MacVim persistently?

Using MacVim 8.1.1722, if I print a buffer, it opens a PDF in Preview.app. I want to open the PDF in Google Chrome instead. So I changed the file association so open foo.pdf opens Google Chrome not ...
2
votes
2answers
79 views

Get file name and directory in .vimrc file

I have mapped my f5 key in vimrc file to run the code using the following command: map <F5> :!sh -xc 'cd "/home/hashir/vscode/" && g++ test.cpp && ./a.out It is working well. ...
1
vote
0answers
31 views

Vim go into insert mode when as a macro starts

When doing <ESC>qq you can record a macro into the q register (still in command mode though). How can I make <ESC>qq go into insert mode right away (without having to type i)? map qq qqi ...
3
votes
1answer
50 views

Is there a way to make some modeline that applies to all files in a directory, recursively?

I have a project consisting of files that Vim doesn't recognize by default, but has support for highlighting and indentation. I would like to have a vimrc file or a vimmodeline (or whatever similar) ...
0
votes
1answer
108 views

Vim error detected

Vim error detected Everytime i quit the vim i got this error, it's just pop up in a second. I already upgrade the vim to the latest version but still got the same error.. How to fix that? The error ...
1
vote
0answers
44 views

How to avoid dialog box when using echo in vimrc/gvimrc file?

If there is a echo/echom sentence in the vimrc or gvimrc file, a dialog box is popped out when gvim starts. How to avoid this?
2
votes
1answer
43 views

Write text under the cursor to new file and delete it form current file

I have this in my vimrc: " Export text under the cursor noremap <leader>e :w! >><Space> This allows me to select text using visual mode, press leader e, type a file name, and ...
2
votes
0answers
105 views

How do I setup Mypy with Neomake

I'm trying to use Mypy with Neomake, but without success. I am currently using flake8 with Neomake, and it works seamlessly, e.g.: def foo(bar): return 1 foo(1) > E305 expected 2 blank lines ...
3
votes
2answers
43 views

How add new date formats to work in 'tpope/vim-speeddating' vim plugin?

In vim plugin 'tpope/vim-speeddating', it support wide variaty of date formats. e.g. %Y-%m-%d%[ T_-]%H:%M 2019-08-04 07:42 %Y-%m-%d 2019-08-04 But how to add my ...