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
2answers
28 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
19 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
43 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
81 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
40 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
37 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
21 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 ...
1
vote
1answer
23 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 ...
1
vote
1answer
48 views

how to load vim8 optional packages in vimrc?

I am trying to load my optional language packages based on filetype. I am using vim8 native package feature. In vim I can load them with :packadd vim-javascript. However, I read in :help packadd - (...
2
votes
1answer
31 views

file search with :e

When open a file with :e, it have to be tell the exact path of the file, and even the temporary file will be listed, is there anyway to do Open a file with only name, and let it automatically search ...
1
vote
0answers
23 views

Remove spacing column begin line

I have an annoying problem that I have no idea how to fix it. Every time I open a specific log file for some weird reason the window starts with 2 spaces column. This happen only with this specific ...
1
vote
0answers
26 views

How to externally trigger [neo]vim to reload an edited file?

I have a file, /tmp/file.txt that is being edited by vim (or neovim), as well as some other external process. I wish the external app to notify vim, in such a way that vim takes that notification to ...
1
vote
1answer
35 views

Why set ft is not working?

I have au BufRead,BufNewFile *.vm set ft=velocity in vimrc. But if open .vm file and run :set filetype?, still get filetype=conf. How to fix this?
1
vote
1answer
42 views

How to pass function return value to make command in VIM [duplicate]

I have this configuration in .vimrc function! FindProjectRootDir() return "some path" endfunction set makeprg=LC_ALL=C\ make\ MONOCHROME=1 nnoremap <F7> :make -C FindProjectRootDir()<...
-2
votes
0answers
69 views

Why didn't vim fix UI isses? [duplicate]

This is not a duplicate question. I am aware of the history of how the hjkl keys came to be in use. And I also know that you can remap keys. I mean, doesn't everyone remap their escape key? But I'm ...
3
votes
2answers
66 views

Add line numbers and remove line numbers to selected lines

Based on the accepted answer of the following post How to add permanent line numbers to a file? I would like to have the capacity to select a certain number of lines and add numbers to those ...
0
votes
1answer
42 views

How to fix Leader Key Beep in Vim?

I cannot get the leader key working in vim. I have been troubleshooting for quite some time. Stuff I did already: Mapping leader key to another key :PlugInstall --> Already Installed x Plugin ...
3
votes
0answers
44 views

Maps literally read < and > instead of the actual character

Here's the situation: Entire .vimrc: inoremap a <CR> Action: user types ia to enter INSERT mode and type a Expected result: a CARRIAGE RETURN is entered into the document Actual result: the ...
1
vote
1answer
32 views

How to use the result of a function in a Vim keymap?

I have a function in Vim script that returns a string. " Return first directory with ".git" folder, if none is found " return the current directory function! s:project_root() for vcs in ['.git']...
2
votes
2answers
26 views

Add buffer space on line wraps

Is there a way to add some buffer space between the vertical separator and the content of a file in vertical split mode? Another way to say this: How do I force vim to not let a line touch a vertical ...
0
votes
1answer
23 views

Reload vim autocmd Filetype [duplicate]

I tried searching for this on the internet but I get bombarded with answers saying to :so $MYVIMRCwhich does not work if I add lines of the type autocmd FileType foo bar. What's a more efficient way ...
2
votes
1answer
38 views

Update external file based on VIM mode

Currently I have my vim set up to update the statuslline based on what mode the editor is in. Like if I'm in insert mode then the statusline turns red. Magenta in replace mode. Green in command ...
4
votes
1answer
55 views

Pressing Shift-Backspace in insert mode types '^?' instead of backspacing

When I mess up typing an uppercase letter, I usually hold Shift while pressing the Backspace. Instead of backspacing, it types ^? (to my frustration). Google tells me that ^? is the "delete" ...
1
vote
2answers
44 views

Number column in Tlist window

I want to hide the number column set nonumber norealtivenumber in Tlist window! Every time I call :Tlist the number column appears in the window. How can I disable the number column for that window.
2
votes
1answer
20 views

How to prevent vim from highlighting random words and types

I've been trying to disable vim from highlighting random words and types for a few hours now. I've noticed vim will highlight specific types when I write python and golang programmes. Even my .vimrc ...
0
votes
1answer
25 views

Option doesn't happen when opening vimrc?

I added this line to my .vimrc: set formatoptions-=ro. When I open any file it works as intended, except if it is .vimrc. In that case it doesn't work. Why does this happen and how to fix it?
2
votes
1answer
40 views

shared vimrc on two machines; only run command for one of them

I use git to share my vimrc across multiple machines. But now I have some commands which I only want on one machine. Namely, this line: au! redhat BufReadPost (derived from this very helpful answer! ...
0
votes
1answer
30 views

Ultisnips Sinppets in current scope on blank line

Background I'm using UltiSnips in conjunction with some autocomplete plugins. I have this line controlling the behavior of enter inoremap <expr> <cr> \ !empty(UltiSnips#...
0
votes
0answers
28 views

Run project specific _vimrc in windows?

I'm attempted to duplicate this functionality in a windows environment running gvim 8.1 but it doesn't appear to pick up my changes. I've updated my $VIMRC\_vimrc with set exrc set secure and my ...
1
vote
1answer
19 views

Colorscheme Errors (E185) with vimrc and sessions

I have a couple of things which suggest there's an issue with the way I use colorscheme with my vimrc file. Errors when running source ~/.vimrc The colorscheme used when opening a vim session ...
1
vote
1answer
57 views

How to set LaTeX syntax to “ConTeXt” in vimrc

TL;DR: How do I permanently and persistently :set syntax=context for *.tex files? I've been using vim for a LaTeX project, with monokai-tasty as the colour scheme. The default syntax highlighting ...
2
votes
1answer
42 views

How can I hide *.extension~ files by using auto hide plugin?

I have successfully hidden undo files by using this auto hide plugin, but I could not hide any *.extension~ files. suppose I created a.txt Now there are two files shown in windows explorer a.txt a....
2
votes
1answer
44 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
71 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
41 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
26 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
23 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
77 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
40 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
51 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
35 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
29 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 in my home directory on macOS, my statusline looks ...
2
votes
2answers
49 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
68 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 ...
2
votes
1answer
69 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
43 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
66 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
24 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
55 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 ...