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
2
votes
1answer
28 views

Passing arguments function with --argument or -a format

Is it possible to pass arguments to Vimscript functions with the --argument or -a format, similar to arguments in the command line? I am writing a command that submits a job in a remote machine. I ...
0
votes
1answer
44 views

Setting conceallevel in .vimrc does not work in .tex file

I've set conceallevel=0 in .vimrc, but the text is not shown normally after opening .tex file. I have to type it again while the file is open and it works. From my .vimrc: "vimtex config set ...
0
votes
0answers
22 views

Why isn't vim recovering the most recent save

I'm having some graphical issues with my setup that means I sometimes need to restart my machine having not saved a file which is currently being edited in vim. However, the saved file which vim ...
0
votes
1answer
13 views

how to autocmd BufWritePost stdout to tidy upon :w?

tldr; How do pass stdout of BufWritePost to an external command? On command line I can run cat index.html | tidy -indent -modify I'm trying to call tidy automatically when I :w This is what I have so ...
0
votes
1answer
21 views

How to Start vim with splits open

I want IDE-like look when I start vim. 3 columns. Leftmost, at 15% width, file & symbol browser, then 60% width of main editor space and 25% showing debug points and run logs on right most part. ...
0
votes
1answer
22 views

how vi automatically collapses {}

I always come across a lot of code wrapped in {}s while reading, and I wondered if there was a way for vi to automatically fold these {}s instead of manually marking them.
1
vote
2answers
52 views

How to use vi to quickly jump to a previously browsed line

For example, I'm browsing the 700th line, and I typed ":456" to jump to the 456th line. Now I want to quickly return to the 700th line. Is there any shortcut key instead of typing ":700&...
0
votes
1answer
50 views

Is it possible to dynamically set the `let var=“string”`? [closed]

I'm playing around with my .vimrc as usual. I have a colorscheme which displays differently with let ayucolor="dark" let ayucolor="mirage" let ayucolor="light" I'm ...
0
votes
1answer
22 views

Vim shortcut for :tabprevious change opened file on start

I try to configure my .vimrc file adding new shortcuts for my daily routing. One of my basic operations in every single IDE is switching between "tabs". I suppose to put the same key binding ...
3
votes
1answer
70 views

Disable spell checking for URLs in BibTeX

I would like to disable spell checking for the URLs in my BibTeX (.bib) files. I was able to disable spell checking for the citation keys (author-year or author+year) as follows: autocmd FileType bib \...
1
vote
1answer
37 views

Convert print statements to log statements using a custom mapping

I want to write or find a plugin that helps me convert print statements to log statements in Python 3. Consider a situation: I am writing some code, I want to add a feature based around some API, I ...
0
votes
2answers
48 views

Where are buffer level variables stored in Vim? And how to get their RAM / storage usage?

Where does Vim store b: buffer level variables / dictionaries? RAM or some kind of file on a disk? If it stores it in RAM, how to get an estimate of RAM / storage used by a particular variable / ...
0
votes
1answer
25 views

How to run additional command in nnoremap?

I have the following lines in my .vimrc: nnoremap <nowait><silent> ¡ :colorscheme tokyonight<CR> nnoremap <nowait><silent> ™ :colorscheme tone<CR> nnoremap <...
0
votes
1answer
67 views

How to customize the name of each tab in Vim/NeoVim?

I have patched my own nerd-font and I want those cool icons for each file-type to be shown in the name of tab in Vim/NeoVim. I guess this can be done easily like I have customized my zsh command ...
0
votes
1answer
24 views

The remap doesn't resize terminal window

nnoremap <leader>rt :term<cr> <C-\><C-n> :resize 10<cr> i I've tested the remap manually, it works as expected. A terminal window spawns I go into terminal normal mode, ...
0
votes
1answer
33 views

How to get the buffer type of the current buffer?

I'm writing mapping, and I want to decide whether I have to do additional actions when current buffer type is a drawer called Fern, here is my command currently nnoremap <nowait><silent> ; ...
0
votes
0answers
16 views

How to entirely disable Jedi completion

I am using Jedi for its Doc-lookup functionality, and only for that: # Jedi-vim: use *K* to get python library keyword definition: https://github.com/davidhalter/jedi-vim Plug 'davidhalter/jedi-vim' ...
0
votes
1answer
22 views

How to run internal (Neo)Vim “:Command” from external Terminal?

I'm using MacOSX, and I have script on Terminal, and since I will probably forget how to update everything inside Vim/NeoVim, is it possible to pass command, e.g. :PlugUpdate, to nvim/vim so that I ...
0
votes
1answer
19 views

pylint default filepath in ALE

I am trying to set up my pylintrc file in vim, but am having some difficulty getting it to read from the correct path. It seems to work when I have the file in the directory that contains the vim file ...
0
votes
1answer
34 views

How to inverse boolean in Vimscript?

I have the following script but not working: I don't know what's the standard way to inverse the boolean(I used number 1/0). I not sure whether it's correct to put global variable, which I used to ...
0
votes
1answer
28 views

Map to a key to do nothing?

I'm tuning :sp, :vsp things, and for example I have: nnoremap <nowait> <C-L> <C-W><C-L> nnoremap <nowait> <C-W><C-L> :vsp<CR><C-W><C-L> ...
0
votes
1answer
16 views

Waiting for a copy event

I have the following function: function _X() normal! gvy vs tmp normal!p ALEFix black normal! ggVG normal! y <------- endfunc Unfortunately, the y does not work. That is, ...
0
votes
1answer
27 views

ALE Fix for a visual selection

I am figuring out a way to apply linting to a visual selection of code. For example: I only want to lint run :ALEFix on that section of code, and not the 100s (or 1000s) of lines of other code in the ...
0
votes
0answers
25 views

Creating shortcut for vim command

I created following shortcut for vim command in .vimrc: :nnoremap <Leader>1 :set foldexpr=getline(v:lnum)=~'^\\s*$'" But the shortcut doesn't work. The shortcut doesn't work if I change 1 ...
0
votes
1answer
50 views

VimPlug#begin in both vimrc and init.vim?

I'm new to neovim settings. I'm migrating from vim to neovim. My question is described in the comment below, (*). In ../init.vim I have: set runtimepath^=~/.vim runtimepath+=~/.vim/after let &...
0
votes
1answer
21 views

How to set different color theme for Terminal and GUI?

Since there are themes only work on GUI, so is it possible to make the Terminal to use another theme than GUI one?
0
votes
2answers
52 views

How can I make vim check for vimrc updates on startup?

My vimrc file is hosted on github. I update it once in a while, and use it on many different computers. Is it possible to make vim asynchronously check the github repo for a new version of the vimrc ...
0
votes
0answers
9 views

Is there a way to use dvorak in both command mode and insert mode at the same time using keymap settings

I was trying to use dvorak with vim So I tried the normal keymap in the Edit settings, It works fine while in normal and insert mode But It goes back to qwerty when in command mode ( i.e. :command ) ...
1
vote
2answers
19 views

How to avoid getting search results from files that are in a directory that contains a folder named “xyz” in its path

I would like to exclude results of a vimgrep search pattern from the quick fix list. The exclusions should be for all files that are under a directory or parent directory called "xyz". ...
0
votes
0answers
22 views

Save and restore a variable across launches

I wanna save the state of a variable (say, background) such that the state is restored next time I start vim. More in detail, it should work like this: I set background to either dark or light. I ...
0
votes
0answers
26 views

Vim unknown function: validator#enable [closed]

After I removed the syntastic plugin I get this error everytime I start vim. My _vimrc: set langmenu=en_US cnoreabbrev Tree NERDTree nmap <F1> :NERDTreeToggle<CR> " Vim with ...
0
votes
2answers
35 views

Can a register's value be checked at startup?

There are probably 20 better ways to do what I'm trying to do. Please direct me to them if so - I haven't found them and not quite sure what to terms to search. I would prefer to set background=dark ...
0
votes
1answer
24 views

How to use tab for indent in indent function while expand tab was set?

When expandtab is set, how to let the indent function defined in file vim/indent/xxx.vim use tabs, rather than spaces to indent lines? Edit: Here is the background. I have use vim's built-in CHANGELOG ...
2
votes
1answer
35 views

How to use func to quickly add specific comments to certain lines of a file?

I wrote a function, the function is used to add comments to some lines, the content is as follows: func Add(x) call setline(a:x+1, "\ //*********************************************************...
0
votes
0answers
16 views

Recover init.vim from inside a certain session

I accidentally deleted my init.vim using a rm -rf command. I know that this kind of stuff is irreversible, but luckily I've kept a terminal running neovim open before I've done this madness. Is there ...
0
votes
1answer
9 views

How to make mouse click ALSO enter Insert mode?

I've enabled mouse and clipboard and ... something else: set mouse=a set clipboard+=autoselect guioptions+=a That's almost perfect, but I want it so that when I left click it moves the cursor and ...
1
vote
3answers
139 views

Function That Substitutes Across Multiple Files

I'm trying to create a function that implements the functionality outlined here: Vim search replace all files in current (project) folder My current attempt: nnoremap <C-F> :call ...
0
votes
0answers
25 views

How can I stop vim from automatically entering visual mode when I click into the PuTTY window with my mouse?

I suspect this is the same in vim as well, but fwiw I'm actually using nvim. For a long time I've used set mouse=a so I can choose to navigate my file with the mouse, if I so wish. What I've never ...
0
votes
2answers
28 views

Colours in (g)vim output window

I've started learning Rust, and have been setting up my Vim workflow to use it. I'm still relatively new to Vim, and mostly what I've written in it is PHP for a website. Now that I'm working with a ...
1
vote
0answers
43 views

Vim 8 terminal not properly sourcing vimrc on startup due to t_ut (Windows)

I have just been setting up a colour scheme for vim (namely onedark) and following advice elsewhere on the internet (here). I added the line set t_ut="" to my .vimrc. When I re-source my ....
1
vote
0answers
21 views

Change colour of character under cursor?

I'd like the character under my cursor to always be black in normal mode, so it contrasts with the cursor. I'm using windows terminal, which doesn't support this directly, and vim (not gvim), so guifg ...
1
vote
1answer
31 views

Re-indent for eruby files does not work

I am trying to re-indent a foo.html.erb file, however when I do gg=G everything gets aligned to the beginning of the line. I couldn't figure out why that happens. I've tried installing polyglot or ...
1
vote
1answer
33 views

Showing showbreak character at the end of the line that is wrapping

Is there a way to show showbreak character at the end of the line that is wrapping, not at the beginning of the next one? 1. Lorem ipsum dolor sit amet, consectetur \ adipiscing elit, sed do ...
0
votes
1answer
15 views

Map comma in select mode to exit select mode, enter insert mode, append a comma

Is it possible to remap comma in select mode to exit select mode, enter insert mode, [optionally: go the end of the last selection (which the cursor seems to be for ultisnips)] and append a comma? ...
1
vote
1answer
31 views

Vimrc, two functionalities become one

I have a vimrc file. In that file i have the following two lines. noremap gg :silent exec "!/home/john/gf.sh /home/john/guides/"<enter><C-L> nmap gh tlet @"=system('perl /...
0
votes
0answers
117 views

Vim-Airline TabLine not displaying with arrows

I have set up Vim-Airline, but Vim-Airline-Tabline's tab seperator is showing vertically rather than as arrows. My tabline: Expected tabline: init.vim relating to airline: let g:...
0
votes
1answer
34 views

Shortcut for a multiline J/K

This question is a sort of follow-up to this: https://stackoverflow.com/questions/66466202/how-to-go-back-in-vim-to-last-cursor-position, which asks how to be able to do something like 17j and then ...
1
vote
0answers
27 views

gvim 8.2 windows10 _gvimrc location

I am using gvim. I have checked the location of the RUNTIMEFILE with :echo $RUNTIMEFILE and found that is is located in c:\Programme\vim\vim82. The file _gvimrc is there indeed. However, I do not have ...
0
votes
1answer
34 views

Prepend text to all commands in terminal mode

I would like to prepend clear; to all commands in terminal mode. This reduces the amount of 'clutter' in my terminal screen and makes things slightly clearer for me.
4
votes
1answer
124 views

What is the most idiomatic way to achieve filetype-specific functions?

Is it possible to declare a function only for a specific filetype? Currently, if I have the following in ftplugin/tex.vim: function! Foo() echom "yes" endfunction Then when I load a *....

1
2 3 4 5
29