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

Vim hiding lines in the script

I facing a strange issue, it might be common but I could not find any solution so asking here. When I'm opening a python file using vim editor, it is auto-hiding many lines in the script. I found that ...
user avatar
0 votes
3 answers
260 views

Toggle Vim Terminal with Mapping like VS Code

I am trying to implement toggling of the Vim terminal like VS Code by doing <C-~>. But am not sure how to go about it. I find executing :term to open and to close tedious. I figured having a ...
user avatar
0 votes
0 answers
28 views

How to include local as highlight group?

I thought thats super duper easy to customize within semshi. But it seems it aint. Or at least i dont find the correct file, command or what so ever to archieve this. To put it simply i just want to ...
user avatar
0 votes
1 answer
218 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 ...
user avatar
1 vote
1 answer
35 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 ...
user avatar
  • 379
0 votes
0 answers
57 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 ...
user avatar
1 vote
1 answer
261 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, ...
user avatar
  • 13
0 votes
0 answers
19 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 ...
user avatar
  • 1
1 vote
2 answers
39 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 ...
user avatar
  • 123
6 votes
1 answer
653 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 ...
user avatar
0 votes
0 answers
41 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 ...
user avatar
0 votes
1 answer
188 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 ...
user avatar
  • 1
3 votes
1 answer
99 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 ...
user avatar
  • 121
0 votes
1 answer
123 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 $...
user avatar
1 vote
1 answer
26 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: ...
user avatar
0 votes
0 answers
34 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/...
user avatar
  • 771
0 votes
0 answers
41 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 ...
user avatar
  • 771
1 vote
1 answer
58 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 ...
user avatar
  • 771
0 votes
0 answers
153 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 ...
user avatar
  • 141
4 votes
1 answer
191 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 ...
user avatar
  • 551
1 vote
0 answers
189 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() ...
user avatar
1 vote
1 answer
120 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 ...
user avatar
  • 25
1 vote
1 answer
201 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 ...
user avatar
  • 25
0 votes
0 answers
76 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 ...
user avatar
5 votes
2 answers
222 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 ....
user avatar
  • 161
2 votes
1 answer
305 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 ...
user avatar
1 vote
1 answer
40 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 ...
user avatar
0 votes
1 answer
81 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 ...
user avatar
  • 121
1 vote
0 answers
336 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 :...
user avatar
0 votes
1 answer
29 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....
user avatar
0 votes
1 answer
53 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 ...
user avatar
  • 379
1 vote
1 answer
49 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, ...
user avatar
  • 379
0 votes
2 answers
21 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?
user avatar
  • 771
0 votes
1 answer
97 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 ...
user avatar
1 vote
1 answer
53 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?
user avatar
1 vote
2 answers
59 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,...
user avatar
  • 11
0 votes
1 answer
46 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 ...
user avatar
  • 23
1 vote
2 answers
245 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 ...
user avatar
  • 771
0 votes
0 answers
142 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 ...
user avatar
1 vote
1 answer
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 ...
user avatar
0 votes
1 answer
112 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 ...
user avatar
  • 3,141
0 votes
1 answer
82 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, ...
user avatar
0 votes
0 answers
58 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 ...
user avatar
1 vote
1 answer
313 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 ...
user avatar
1 vote
0 answers
210 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 ...
user avatar
  • 11
0 votes
0 answers
136 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 ...
user avatar
0 votes
1 answer
501 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&...
user avatar
  • 771
0 votes
1 answer
121 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 ...
user avatar
  • 173
0 votes
0 answers
95 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 ...
user avatar
0 votes
0 answers
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 ...
user avatar

1 2
3
4 5
34