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
1answer
18 views

Compile C++ in vim

I want to make a shortcut for compiling C++ file. I use :map <F5> :!g++ % -o app && ./app <CR>. How can I edit it to set output file's name, C++ file's name without .cpp instead of ...
1
vote
1answer
24 views

Visually select two words in Vim

Say I have a phrase is later found at and what to delete a phrase later found, then what I do would be In the normal mode, I put a cursor on l, and press vww. This will select from l to a of at. This ...
0
votes
0answers
26 views

nmap in vimrc is working in wrong way

I was trying map a function to key "0". This is the code I used in vimrc nmap 0 :exec "nohlsearch"<CR> This mapping will allow me to non highlight the word under search But ...
0
votes
1answer
19 views

Where are neovim's cached, file-specific settings?

Vim has a ~/.vim/view/ directory for storing file-specific settings, such as saved cursor position and any command manually ran while viewing a file. Sometime, when I would update and source my vimrc, ...
0
votes
0answers
16 views

How to add more than one skeleton file with the same extension?

So I have a skeleton file for leetcode/hackerank stuffs, with the extension .cpp, achieved with the following: :autocmd BufNewFile *.cpp 0r ~/.config/nvim/skeleton/cp.cpp but I would also like a ...
1
vote
2answers
29 views

How can I open python output in a editable buffer?

I am using this in my vimrc, to get output of current script printed on the screen when I click enter. autocmd FileType python map <buffer> <CR> :w<CR>:!python3 %<CR> How can ...
6
votes
1answer
604 views

Why does "thge" correct to "Chge" using spellcheck?

I was showing a friend the spell-check feature in Vim which I add activated by adding the lines setlocal spell and set spelllang=en_gb to my .vimrc. He did the same on his end and tried a few spell ...
0
votes
0answers
20 views

activate vim-lsp on single JavaScript files

vim-lsp's typescript-language-server doesn't seem to work or get activated when working on single JavaScript files or projects that are (I think) under version control. Is there a way to configure ...
0
votes
1answer
30 views

Vimscript - Loading function(s) from another .vim file

I'm forking an old vim plugin (effectively dead since 2018) that needed some love. Once I got to the .vim file, I noticed that the functions were all defined in there, which made the file unreasonably ...
3
votes
1answer
78 views

Sort tab-completion suggestions (files first, then directories) in vim command line

When i go to command mode, type :e and press tab, i get like this Excuse the file, directory writings on the right side (used for explanation) A.cpp file Adamwathan/ directory ...
0
votes
1answer
21 views

Does Vim (NeoVim) remove mappings when sourcing vimrc?

I was editing my vimrc, and decided to remove a mapping based on some information I found on <cr>. So I deleted the mapping and called my :SourceVimrc command (command SourceVimrc source $...
1
vote
1answer
17 views

Unexpected TabNew behavior

I want to create a netrw sidebar whenever I open a new tab. I tried this: au TabNew,VimEnter * \ | :Vex \ | :vert res 40 but this makes a layout like this when I :tabe file2: tab1: ...
0
votes
0answers
15 views

The Indentation of NeoVim is broken on C++20 file?

As title. Now it indents on every other line and it won't add indent after { and press Enter. If you want to see the video I recorded, here: https://www.reddit.com/r/neovim/comments/rlh58n/...
0
votes
0answers
35 views

The dilemma of using both space-tab and tab

Now I have to learn some makefile. I only need to use the plain-old tab in this file. In other ones I want to happily keep my 4-space-tab. My current idea is to find a way/script so that I can toggle ...
1
vote
1answer
36 views

Is it possible to set scrolloff to top and bottom with different values?

As title. For example, say I imagine there is something like scrolloffTop and scrolloffBottom and I can set each with different values. If there is no such options, I would like to know is it possible ...
0
votes
0answers
65 views

Disabling Warnings

Scenario: View a file with view src/somefile.c in one terminal Edit the same file with vi src/somefile.c in a second terminal After saving modifications to the file with the vi instance in the second ...
4
votes
1answer
69 views

How can I print from nvim on linux

I would like to be able to send my currently open text file to the paper printer. I often use nvim to create a daily scratch to do list, and need a paper copy to go with me in my back pocket through ...
1
vote
0answers
51 views

Sorry, the command is not available in this version

I am trying to install the UltiSnips plugin using vim-plug (for everything else, vim-plug works just fine). I put this: call plug#begin('~/.vim/plugged') Plug 'sirver/ultisnips' call plug#end() ...
1
vote
1answer
23 views

`:call append!` -- how vim insert line (append or setline) while respecting indentation

I want to put a string function output in my vim when press xx. My current working example is: nnoremap <silent> xx :call append('.', 'string_output')<CR> However, this put a line without ...
1
vote
1answer
74 views

Silently run two commands mapped by nnoremap in vim

I have this sort of command in my vim settings which read the output of some external command (here is date) and then run another external app. My problem is I want to run it without leaving current ...
0
votes
0answers
39 views

How to change color of the text on statusline?

I use a airline for my nvim and vim config (share between both) and I want to change the font color of the status line. I tried using base16_solarized_light or dark but I don't like it and would like ...
4
votes
2answers
177 views

Double Press Override for 0 Key

My .vimrc remaps 0 to ^ in normal and visual+search modes. :nmap 0 ^ :vmap 0 ^ Ideally, I would like 00 to go to the true beginning of the line (i.e., what 0 does by default). Is this possible in a ....
2
votes
0answers
29 views

Plugin conflicts over BufWinEnter Autocommands

I have vim-markdown and nerdtree installed. And everything was working fine until I added the following to my .vimrc (verbatim from the nerdtree readme) " Open the existing NERDTree on each new ...
0
votes
0answers
17 views

Why `highlight X ...` from `.vimrc` does not work in gVim (but works in VIM) and I have to type it again during session?

For following snippet of code, to see what was highlighted I need to run :highlight LineHighlight ctermbg=darkgray guibg=drakgray after running vim session, and then rest of snippet works (i.e. loads ...
0
votes
1answer
23 views

Syntax highlighting with bogado/file-line and slim-template/vim-slim (e.g. when doing `vim app/views/sessions/new.html.slim:20`)

when I edit a slim file by line, e.g. vim app/views/sessions/new.html.slim:20 I don't get the syntax highlighting :(, other types of files work fine (e.g. ruby files). I use slim-template/vim-slim and ...
1
vote
0answers
71 views

Neovim - blend transparent highlight colors

I am trying to make the NvimTree background a different color than the main neovim window, while retaining transparency set by Alacritty. The desired panel can be made fully transparent with :...
0
votes
1answer
25 views

How to Check if evim.vim loaded instead of default.vim to change Window title

Hello I intend to change title of vim/gvim window only if vim -y/easy is started. I know that evim.vim is loaded, but If I change the titl using evim.vim , and I upgrade the vim, I will lost my change....
0
votes
1answer
48 views

Key mapping for converting `((` to `\left( | \right)`

I would like to have something in .vimrc where when I type (( in insert mode, it automatically converts that into \left( | \right) with the cursor position at | in insert mode. Any ideas? I also would ...
1
vote
1answer
40 views

vim command for jumping to <++>

I recently moved from vim-latex-suit to vimtex. In vim-latex-suit, there was this awesome feature that when I press Ctrl-j, it jumps to where <++> is and replace that to the cursor. To clarify, ...
0
votes
2answers
18 views

Insert mode <S-Tab> to delete one <Tab>-indent?

I want to use <S-Tab> to do the reverse of <Tab> in insert mode in Lua. (If this is complicated in Lua then VimScript is OK) How?
0
votes
1answer
45 views

Vim autocomplete not caching

In some of my projects, vim autocomplete is very quick, but in other projects it hangs the editor while displaying a status line "examining file ..." that slowly crawls through all the files ...
1
vote
1answer
50 views

What are these sections of the screen called, and how do I move between them?

I'm new to vim and stuck in one of these windows; I couldn't move to the others. They are not tabs; I tried :tabnew to make sure. How can I move between them? What are they called?
1
vote
2answers
43 views

Shortcut to erase the last character of the line in normal mode

I'm searching for a command (let's say Ctrl+j) to add to my .vimrc to erase the last character of the line in normal mode, without changing position of the cursor. I'm beginner in this .vimrc language,...
0
votes
1answer
25 views

How to properly set up ftplugin files for working with different filetypes in different windows?

$ vim --version VIM - Vi IMproved 8.1 I set up the following vim configuration files: " .vim/ftplugin/text.vim set textwidth = 0 " .vim/ftplugin/python.vim set textwidth = 99 set ...
1
vote
2answers
77 views

Some migration problems from vimrc to init.lua

How can I simplify the following codes in my init.lua? (For "simplify" I mean that by vim.cmd(...) you're actually letting Lua run vimscript under the hood. But there is probably a Lua API ...
1
vote
0answers
77 views

My $VIMINIT causes a warning in :checkhealth in neovim

I have this in my .bashrc file so that I can use two different configuration files for vim and neovim: export VIMINIT='let $MYVIMRC = !has("nvim") ? "$XDG_CONFIG_HOME/vim/vimrc" : &...
0
votes
0answers
26 views

Is there any way to list classes, fields, and functions, in C/CPP files using vim, ccls, and coc.nvim like vscode?

I'm using vim8.1 + coc.nvim + ccls to work on C/CPP projects since my vscode always crashes. Many of the features on vscode can be implemented by several plugins. However, I have not found a plugin to ...
1
vote
1answer
20 views

Give error if more than one file opened

I usually don't use Vim's multiple-files features. If I open Vim on multiple files, it is usually user error. For example, a common mistake of mine is that I end up entering the following: vim vim ...
0
votes
1answer
46 views

Why is my $HOME variable set to C:\Windows\system32 when I run vim as a different user and what can I do about it?

I've created another domain user in Windows and I'm trying to run gvim from it. I've created a %USERPROFILE%\_vimrc but when I start gvim and check :echo $HOME it's set to C:\Windows\system32. I'd ...
0
votes
1answer
49 views

Is there a vim that uses python instead of vimscript throughout?

There is a vim plugin that allows even the .vimrc to be composed in lua. But I would prefer python. Does anyone know of such a plugin or version of vim that uses python throughout the internals, ...
0
votes
0answers
18 views

Vim Plug installment error on MacOS: Error creating directory /Users/api/.vim/autoload

I just migrated today from VSCode to Vim, and I need a little bit of help regarding the installation of Vim Plug. I installed Vim with Homebrew, and now I want to install Vim Airline. The tutorial I ...
1
vote
1answer
127 views

How to change the color of the vim ruler?

was hoping someone could help me in changing the color of the ruler in vim? Specifically, the opacity as I'm trying to make it match the rest of my vim opacity, but can't seem to pinpoint where ...
1
vote
0answers
66 views

Remapping Ctrl+backspace in insert mode to delete one word back

I want to bind Control+Backspace in insert mode to delete a word. I'm able to bind Control+Del in both insert and normal modes, but I can only seem to bind Control+Del in normal mode. I've checked ...
0
votes
0answers
47 views

The text color in Airline status line and tabline changes when I source the vimrc

So my airline status line looks like this when I start vim it looks like this -> https://imgur.com/zwOILU7. And when I source the vimrc it looks like this -> https://imgur.com/JnxeUfS I want it ...
0
votes
1answer
107 views

How to transform this Vimscript into Lua?

Can anyone help me transform this into nvim.lua? inoremap <silent><expr> <TAB> \ pumvisible() ? "<C-n>" : \ <SID>check_back_space() ? "<TAB&...
0
votes
1answer
57 views

How to make vim show suggest current word in spellchecking suggestiong if current word is correct?

I often write code, and sometimes I check comments with z= when I am not sure of a spelling of some word. Vim then presents a list of suggestions. However, when I got the spelling right and the word ...
0
votes
0answers
30 views

highlight clear SignColumn isn't taking effect

I can't understand why the setting highlight clear SignColumn in my vimrc doesn't seem to work when nvim launches. I've tried appending a : :highlight clear SignColumn. And I've tried adding the ...
0
votes
0answers
29 views

Mapping Esc makes vim open in REPLACE mode [duplicate]

I've enabled hlsearch to highlight text after searching, $ grep hlsearch ~/.vimrc set hlsearch and now I want to clear the highlight, which I can do with :noh. I saw that I can assign this to esc key ...
1
vote
0answers
61 views

error: there was a problem with the editor "vi" -- while trying to change deployment file

Facing this error error: there was a problem with the editor "vi" when trying to change a deployment file in the Kubernetes cluster (AKS) kubectl edit deploy xxxxx -o yaml upon exiting the ...
-1
votes
1answer
41 views

Problem setting cursor colors in vimrc: suppress the `-ne` that is written to my xterm on exit

Following the vim manual and also some threads on this site, I can set the color of my cursor to orange in insert mode and red otherwise, with the following lines in my .vimrc file. " use an ...

1
2 3 4 5
32