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
0 votes
2 answers
35 views

How can I extend syntax highlighting with my own keywords?

I already have syntax highlighting for javascript, but what I'd like to do is extend it with some additional rules. What I've been trying to start, is using highlight "Prototype" with a cyan ...
Sophie McCarrell's user avatar
0 votes
0 answers
39 views

Why is key binding for CTRL-L key messed up?

I have run into a Vim key binding issue at the office recently. On the Linux system where I do my development work, while running Vim the CTRL-L key no longer redraws the screen. The .exrc file in my ...
Barry Kimelman's user avatar
0 votes
1 answer
31 views

Is there an efficient way to delete the duplicated block with same start and end to keep unique?

Description I have many large size files may including the same function definition. The block description is start with .start .* and end with .end In this example there is one duplicate definition ....
M_Sea's user avatar
  • 137
1 vote
1 answer
90 views

Is user vimfiles/after/ftplugin supposed to be after system/indent?

Should user vimfiles/after/ftplugin scripts loaded after any system script?
Konstantin Glukhov's user avatar
1 vote
1 answer
49 views

How to save the files when global replace completed in one command line

I have so many huge size of files and always need to do search and replacement so I map the command as nnoremap aa :let i=1 \| g/regexp/ s/^/\=printf("%1d. ",i)/g \|let i =i+1\|:w! 1.txt ...
M_Sea's user avatar
  • 137
3 votes
2 answers
541 views

How do I undo the result of the remap of ( to ()?

If my vimrc file has the following: inoremap ( ()<Left> which essentially auto-closes a (, changing it to () whenever I type ( in insert mode. How do I undo the change when I don't want that ...
siralbert's user avatar
2 votes
2 answers
89 views

Additional filetypes for different types of yaml files

Is it possible to create additional subcategories of filetypes? For example, it would be great if (neo)vim could pick up that the yaml file I'm editing is acutally a Kubernetes yaml file and set the ...
moo's user avatar
  • 155
0 votes
2 answers
44 views

Change what Vim does by default when no files are given

When running vim with no command line arguments, it opens a splash screen describing Vim. I would like to control what vim does "by default", so I can make it do something more useful like ...
Greg Nisbet's user avatar
  • 1,839
1 vote
2 answers
56 views

Conversion in Lua: how to tabdo all the visible buffers without changing view of the current tab?

Related to this post, how to tabdo all the visible buffers without changing view of the current tab? function! TabLcd() let current_tab = tabpagenr() tabdo <commands> execute '...
Mega Bang's user avatar
  • 199
0 votes
1 answer
49 views

Calling variables from SHELL and using them in Vim config (vimrc) [closed]

Question I am trying to use variables from SHELL inside my Vim configuration file, now, I have researched how to do this and asked ChatGPT about how as well. It is possibly due to the specific ...
Ella H's user avatar
  • 13
1 vote
1 answer
45 views

How can I use Regex in helpgrep?

I would like to use Regex in helpgrep. For example, searching for lines or sections that contain two words. Something like :helpg 'word1' & 'word4' to find this line as my result: word1 word2 ...
mohamadi_arch's user avatar
0 votes
1 answer
89 views

When I use helpgrep, how can I highlight my search results?

I'm using :helpg session in my Vim. I would like to highlight the pattern in the results like :set hls does for normal search. Is there a way to do this?
mohamadi_arch's user avatar
1 vote
1 answer
138 views

Why so % does not work when vimrc changes with another editor?

I opened a file in Vim. Then opened vimrc file with another editor (VsCode) and made some changes. I would like those changes to be reflected in my Vim session. I tried :so % but it didn't work ...
mohamadi_arch's user avatar
0 votes
2 answers
62 views

Why doesn't echo % do anything in command mode?

I read the section of current-file in the document. (see :h current-file) And I have a question. if % stands for the current file name, why I can not use echo %?
mohamadi_arch's user avatar
1 vote
1 answer
46 views

What is the meaning of lbr in Vim?

I write set lbr in my vimrc file but I don't know the meaning of that. What does this option do? I know it's about line-breaking but I need more explanation. This is from the Vim document and I can ...
mohamadi_arch's user avatar
1 vote
1 answer
73 views

What is the difference between `au BufNewFile,BufRead *.py` and `au Filetype python` in this specific case?

The issue Consider the following two Vimrc configuration lines for the YouCompleteMe plugin: au BufRead, BufNewFile *.py,*.pyw match BadWhitespace /\s\+$/ au FileType python match BadWhitespace /\s\+$...
Attilio's user avatar
  • 359
1 vote
1 answer
34 views

Whitespace character which is not the usual 'space'

I came across this character which looks like the usual space character but it is not identified with the usual highlight search '/' in Vim. For context, I added a space at the very last line to show ...
Stephen Jacob's user avatar
0 votes
0 answers
26 views

Replacing text in non selected lines

I have \begin{thm} in a lot of my .tex files. Whenever I am not in the selected line I would like this to be rendered as Theorem. I have tried using conceal but it is limited to rendering a single ...
Maths Wizzard's user avatar
1 vote
1 answer
146 views

Error when using vim-plug from git-bash

I just installed vim-plug to use the doxygen plugin. Added call plug#begin() Plug 'vim-scripts/DoxygenToolkit.vim' call plug#end() to the .vimrc (_vimrc because Win10..). Using the doxygen plugin ...
Max's user avatar
  • 113
0 votes
1 answer
19 views

Convert sequence of external commands to a Vim custom command

To reformat Markdown tables, I use the following sequence of external commands (e.g. after visually selecting my table lines): :<,>! sed 's/[[:space:]]\{1,\}\|/\#\|/g' :<,>! column -t -s '\...
gjherbiet's user avatar
0 votes
1 answer
68 views

MacOS - Vim overriding my highlight config in ~/.vimrc

~/.vimrc: set backspace=2 set nocompatible set clipboard^=unnamed,unnamedplus syntax on set expandtab tabstop=2 shiftwidth=2 set smartindent set hlsearch set incsearch set ignorecase set number ...
ray's user avatar
  • 1
1 vote
1 answer
48 views

I want to see my vimrc code but instead, runtime vimrc text is shown

I wanted to upload my .vimrc file to GitHub and while doing that, I think I broke something. After that process, when I type vim ~/.vimrc on my terminal, the only thing I see is runtime vimrc instead ...
Kerem's user avatar
  • 11
1 vote
1 answer
40 views

How to configure my own highlight for Vim editor in Linux using ~/.vimrc and ~/.vim/colors/mycolors.vim files? [closed]

I want to configure and customize my own syntax highlight for Vim editor in Linux Ubuntu 20.04. In my home directory, I created two files, ~/.vimrc and ~/.vim/colors/mycolors.vim. Here is the full ...
morris's user avatar
  • 11
1 vote
2 answers
142 views

Why is Vim ignoring my `expandtab` setting?

In my vimrc, I have set expandtab. When I edit a Tex file, however, Vim inserts tab characters , instead of spaces , when I press tab. I figured noexpandtab must be set by the TeX ftplugin for some ...
Wil's user avatar
  • 21
1 vote
1 answer
67 views

How to generate random string with required length in Vim?

I am using this code for console log nmap cll yiwocll<Esc>p I wanted to add some random string inside this console log, assume 10 characters symbols length. How to achieve this?
hden mila's user avatar
0 votes
1 answer
18 views

Disable a specific case provided by cindent when enter a colon `:`

As title. What I have currently after entering : after the std: std::memset(tempArr, 0, MAX_LEN_CASE*sizeof(int)); for (int i=0; i<MAX_LEN_CASE; ++i) { std: } What I expect is: std::memset(...
NeoZoom.lua's user avatar
  • 1,302
0 votes
1 answer
31 views

Custom highlight not effective unless sourcing vimrc

I customed comment and search highlight in my vimrc, but they are not effective every time I entered vim. I have to source vimrc to make them effective. How can I make them always effective? highlight ...
Kalei's user avatar
  • 1
0 votes
0 answers
23 views

Why does <esc> on empty, indented line, jump to beginning?

I'm trying to do something very simple, enter normal mode and ALWAYS be able to somehow put the normal mode cursor where it was in insert mode, whether through a mark, or otherwise. I'm doing this ...
Tallboy's user avatar
  • 177
0 votes
1 answer
60 views

Run a Vim command _after_ loading vimrc, but _before_ opening the file?

Is there a way to tell Vim from command line to run a specific command after running the vimrc, but before loading a file? E. g. vim --cmd <cmd> <file> runs <cmd> before loading ...
intelfx's user avatar
  • 307
1 vote
3 answers
455 views

Quit Vim when Buffer has no name (not :wq or :q!)

There must be a way to change the init.vim / .vimrc so I can quit Vim without saving first (:wq) nor force quitting (:q!). But I only want that behaviour when the Buffer has no name. Why? Because a ...
Pixelbog's user avatar
  • 417
1 vote
1 answer
85 views

Disabling Syntax Highlighting for Rust Files in Neovim 0.9.x

Please find the refined version below: In the attached images, the top one displays the syntax highlighting performed by the rust-analyzer Language Server Protocol (LSP), while the bottom image shows ...
Hyunsoo's user avatar
  • 123
0 votes
0 answers
83 views

Github Copilot indentation

Has anyone had any luck getting a good .vimrc configuration to work with GitHub's Copilot insertions? I seem to have two mutually exclusive cases. My normal .vimrc indents everything as expected when ...
topher217's user avatar
  • 109
0 votes
0 answers
17 views

NERDTree window change during tab switch

Currently, when using NERDTree, I hit Ctrl-ww to navigate to my NERDTree window from my editing window. Then, I navigate to a file I want to open, and hit t to open it in a new tab. Now, when I want ...
cz1's user avatar
  • 1
1 vote
1 answer
131 views

How to disable the ability to undo even after restarting Neovim?

I made some changes in files using Neovim. I close the vim and terminal. When I open the file again with Neovim, I am still able to undo the last things I changed before closing the terminal. I simply ...
Sugam Sharma's user avatar
-1 votes
1 answer
57 views

How to Vim multiply symbol "a" with a number from clipboard?

I need to multiply symbol "a" with a number from clipboard. For example 3a = aaa In clipboard register is @+. May be to do that throw command line mode, but don't understand how.
serii 's user avatar
  • 57
1 vote
2 answers
108 views

ALE Code Action for python

I have a working linter with the ALE plugin. Plugin 'dense-analysis/ale' let g:ale_virtualtext_cursor = 0 let g:ale_python_flake8_options = '--extend-ignore=E501' nnoremap <leader>ar :ALERename&...
Surya's user avatar
  • 21
1 vote
1 answer
166 views

What is `normal! zvzz` in vimscript?

I found here the following command normal! zvzz But I don't know what it does.
linrongbin's user avatar
1 vote
2 answers
126 views

Vim with terminal inside, I have to quit using a vim cmd as the terminal will prevent me from exiting, so I can't do :wq

Since I have a terminal inside vim I can't do :wq or I get 'job' running. I got around this using: vim --clean "+term" "+qa!" Then I'd have to do :w then :qa! In my ~/.vimrc I then ...
Nickotine's user avatar
  • 182
1 vote
1 answer
68 views

Simple way to go to definitions

I use this simple approach to jump to definitions in C++, which works fine for me. In my vimrc: autocmd BufRead,BufNewFile *.c,*.cpp,*.cc set path+=/Library/Developer/CommandLineTools/usr/include/c++/...
ranemirusG's user avatar
0 votes
2 answers
103 views

How to jump to the last non-blank character in soft wrapped long line in vim?

I have those setting in .vimrc setlocal textwidth=0 wrap formatoptions=tc2n linebreak noremap <buffer> j gj noremap <buffer> k gk noremap <buffer> $ g$ noremap <buffer> ^ g^ ...
Solarisending's user avatar
2 votes
2 answers
69 views

Apply local setting to .vimrc

Is it possible to overwrite a .vimrc setting with a local one? For example: I have set background=light in my .vimrc file And then, while editing another file I decide to change that setting, so I run ...
ranemirusG's user avatar
0 votes
1 answer
208 views

How to pass an argument for glob in fzf.vim Rg to support searching in specific files?

I am using fzf.vim plugin with ripgrep. Fzf comes with the command :RG and :Rgright out of the box that lets me to search for keywords in files. However, often I need to search for keywords in ...
Iggy's user avatar
  • 165
0 votes
0 answers
70 views

automatically execute zz after register jump?

whenever you are jumping between marks some of the marks are placed at the bottom of the screen and you have to do zz to bring them to the middle. Is there a way to auto-execute zz after each jump ...
sourcevault's user avatar
0 votes
1 answer
118 views

How does vim color theme set highlight groups?

Usually, I edit a highlight group like this: hi typescriptAliasDeclaration guifg=#b58900 But when I look inside an exampleColorTheme.vim, I cannot see any mention of these highlight groups. So how do ...
Vinn's user avatar
  • 639
1 vote
3 answers
67 views

How do I configure Vim so that the color is different according to the first line, and the other lines wrap automatically?

For some context, I'm talking about Git commits specifically. The Linux server that I use for work changes the color of the first line starting from column 53 (since 52 is the recommend commit title ...
Sean's user avatar
  • 255
0 votes
1 answer
103 views

My Linux server doesn't have a .vimrc file but Vim has a lot of configurations

Not sure if this is the appropriate place to ask, but at work I use a laptop to SSH into a remote Linux server and do some work from there. I want to use the server's .vimrc file for my own laptop as ...
Sean's user avatar
  • 255
0 votes
2 answers
161 views

Writing a bash script to startup Vim in a particular configuration for a project

I want to write a bash script that starts up a Vim session using a specific configuration. For instance consider a C project with the following structure project_dir - src - file1.c - file2.c ...
Sina's user avatar
  • 115
0 votes
2 answers
164 views

ftdetect, ftplugin not working as advertised -- what am I missing?

I've been reading documentation and trying experiments to register a new filetype in vim, and apply desired indentation rules -- all to no avail. As an example, say I want to register *.test as ...
StoneThrow's user avatar
1 vote
1 answer
72 views

How to use 'includeexpr' with relative paths?

Imagine there is a file src/main.js with import like this: import { A } from '_components/A'; And _components/A in turn has export { A } from './B'; I configured includeexpr to expand _ to src so ...
whysoserious's user avatar
0 votes
0 answers
81 views

Strange behaviour with vim-lsp+clangd+asyncomplete-lsp

here is my .vimrc: call plug#begin() Plug 'prabirshrestha/vim-lsp' Plug 'mattn/vim-lsp-settings' Plug 'prabirshrestha/asyncomplete.vim' Plug 'prabirshrestha/asyncomplete-lsp.vim' Plug 'piec/vim-lsp-...
Cart3sianBear's user avatar

1
2 3 4 5
37