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
35 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
34 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
2answers
76 views

How do I make the cursor blink?

set guicursor=n:blinkwait5-blinkon5-blinkoff5 has no effect. Why is that? mp4
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 ...
15
votes
4answers
2k views

How to label tmux tabs with the name of the file edited in vim?

Whenever I open a tmux session in terminal, all of the tabs containing vim sessions are labelled vim. My question is: How to configure it to label tmux tabs with the name of the edited file or ...
1
vote
2answers
871 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. ...
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 ...
13
votes
2answers
4k views

How can I modify Vim to work with a different keyboard layout?

I type with a non-QWERTY keyboard layout. Many of the keys Vim uses are now on the home row, but some key bindings just don't work, the most obvious one being the hjkl keys. How and where can I ...
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
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. ...
2
votes
2answers
400 views

expand('<cWORD>') returns empty string in inoremap

I'm trying to define an insert mapping like this: inoremap <expr><buffer> ; (Test(expand('<cWORD>'))).";" in which the Test function is defined as: func! Test(a) echom ...
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
3answers
340 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 ...
4
votes
2answers
4k 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
690 views

Mapping doesn't work for tabs

I have several files opened in tabs in Vim. I want to switch between tabs, so I use Ctrl+left to move left (previous) and for next also. But my mapping doesn't work. :map <C-Left> :tabprevious&...
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 ...
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 \...
0
votes
1answer
141 views

set clipboard=unnamedplus not wok

I am a newbie in vim and I added set clipboard=unnamedplus in .vimrc but doesn't work , in my previous os, I had the same problem and I fixed it by reinstalling vim using source and adding some extra ...
2
votes
3answers
152 views

VIM mouse scrolling on Konsole show ^[OA at the top and ^[OB at the bottom of the page

function! GitBranch() return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") endfunction function! StatuslineGit() let l:branchname = GitBranch() return strlen(l:...
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 ...
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 ...
1
vote
1answer
1k views

NeoVim: colorscheme won't work in init.vim; requires command to be typed

I'm new to NeoVim and just getting started. My init.vim file under NeoVim\share\nvim\runtime\plugin\init.vim successfully sets everything except for the colorscheme and background. As seen in the ...
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 / ...
96
votes
1answer
63k views

What is the purpose of swap files?

When I edit files, Vim tends to create files named .filename.swp, which I find annoying. From vim -h, I see that the -n option suppresses the creation of swap files. Is there a vimrc directive that ...
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 <...
1
vote
1answer
2k views

Make YouCompleteMe open definition in vertical split even if buffer is not saved

There is something I cannot do with YouCompleteMe that I could do when just using tags to navigate to a definition or declaration. The desired behaviour is (taking into account that , is my leader ...
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 ...
17
votes
4answers
29k views

Remap Esc key in Vim

Is it possible to remap the Esc key to another key in Vim? When I'm using Vim in a full screen VMware vSphere web client console window and I press the Esc key to exit edit mode, it also takes me out ...
1
vote
1answer
100 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
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
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, ...
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
0answers
17 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
35 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 &...
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
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
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?
1
vote
2answers
55 views

welcome message hidden by “exe” in timer function

My vimrc holds a script to change the color of the CursorLineNr conditionally based on the mode. My problem is that it hides vim's welcome message when it's launched without a file. I would like to ...
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". ...
1
vote
1answer
85 views

How to forget specific file settings and treat it like a new file

Suppose I had tabstop set to 4 in ~/.vimrc. When I edit a file, I set the tabstop to 5 with :set tabstop=5. After that, I close vim and restarted the terminal. When I open the file again, the tabstop ...
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 ) ...
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
1answer
23 views

Sending two keys in series during autocompletion confirmation

I have the following mapping: inoremap <expr><CR> pumvisible() && complete_info().selected != -1? "\<C-y>" : "\<CR>" inoremap <expr><Space&...

1
2 3 4 5
29