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
0answers
6 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
16 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
21 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
14 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? ...
0
votes
0answers
28 views

How do I prevent theme loading issues with transparency?

I just installed the jellybean theme and when I opened a random cpp file I got a black area that disappears when a new line is added, like in this picture: How do I prevent the black area from ...
1
vote
1answer
30 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
44 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:...
-1
votes
0answers
22 views

Mapping to <Esc> and <Return> not registering

I have this set of maps: nnoremap <C-s> :^[:w snoremap <C-s> <Esc>:w<Return>v<C-o> xnoremap <C-s> <Esc>:w<Return>v inoremap <C-s> <Esc>:w&...
0
votes
1answer
25 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
20 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
29 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
115 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 *....
0
votes
1answer
21 views

How do I enable mouse in netrw only (terminal vim)?

I would like to be able to use my mouse to scroll and click on directories to expand them in netrw. I don't want the mouse to be on for any other filetype/buffertype, so that I can still highlight/...
0
votes
2answers
93 views

Adding <Esc> to a remap literally inserts <Esc> into the file

I'm remapping o and O in my Git Bash vimrc to insert a new line without staying in insert mode: nnoremap o o<Esc> nnoremap O O<Esc> The problem is that a new line is inserted and the ...
0
votes
1answer
19 views

How to stop Vim hanging until keypress?

For context: I'm only getting started with vimrcs. I just installed Vim on a second machine. On this machine, I don't have admin privileges. However, I've managed to install Vim and gVim 8.2 in the ...
0
votes
0answers
31 views

How to get zathura to appear inside terminal and autocompile

I'm pretty new to vim and linux in general. I've been wanting to use vim for writing my math latex notes in the same fashion as pictured below. Whereas currently I am only able to accomplish the ...
0
votes
1answer
17 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
votes
1answer
73 views

How to check if total number of lines are bigger than 10 in Vim? [closed]

I want to check if number of lines are bigger than 10 in Vim. I tried to use this code in vimrc file: if line("$") > 10 colorscheme currentline endif Edit: I made a colorscheme with ...
1
vote
1answer
30 views

Vim autoload doesn`t work

I've created a ~/.vimrc file that uses plug.vim. call plug#begin('~/.vim/plugged') Plug 'something' call plug#end() I also downloaded plug.vim and put in the folder ~/.vim/autoload. But when I open ...
2
votes
1answer
21 views

Options readonly vs nowrite

Apologies if this is duplicate. I have searched and haven't found any related questions. What is the difference between the options readonly and nowrite? The reference manual says: readonly: If on, ...
1
vote
1answer
18 views

User <cword> inside a vimgrep regex expression

Writing a map to find header under cursor for markdown link. ## heading {#foo} ... ... [click on link](#foo) <- `cursur above this foo` What I am doing: nnoremap gO :lvimgrep "\v^#+.*(#.*)&...
0
votes
1answer
40 views

VIM automatic convert tab to spaces + trim trailling spaces when open or save

Using VIM on Ubuntu 20.04.2. I would like to clean up the white spaces automatically upon opening or saving a file with VIM. Create a file full of white spaces to clean up: printf "if (denom != 0)...
2
votes
1answer
15 views

Can using Vim-plug and Vundle together cause any issues in downloaded plugins?

I am completely new to vim and have to download few plugins. I had initially downloaded some using Vundle and now want to get more using vim-plug. I fear this may cause (version?) issues if I happen ...
-1
votes
1answer
25 views

mapping to delete and yank multiple lines e.g. d4y instead of d4d

In my vimrc I have nnoremap d "_d nnoremap yd dd to not save lines when I delete. Is it possible to create a mapping that when I press e.g. d4y it will cut 4 lines and save them into buffers? I ...
0
votes
1answer
22 views

Gvim loads incorrect colorscheme unless I run the command again

In my ~/.vimrc file, I have my colors set up like this: " Access colors present in 256 colorspace let base16colorspace=256 " Vim colorscheme colorscheme default " Lightline ...
0
votes
1answer
30 views

Java path required in .vimrc

Normally you would compile java using this: javac Hello.java java Hello Under certain conditions you can compile from Vim by just typing :make by placing this in .vimrc autocmd Filetype java set ...
0
votes
1answer
41 views

How do I make the cursor blink?

set guicursor=n:blinkwait5-blinkon5-blinkoff5 has no effect. Why is that? mp4
0
votes
0answers
42 views

Tool for convert multi files vimrc into single file

i try to collect my .vimrc files into single file is there anyway to generate single file using vimscript depending on source vimscript keyword or python code example of my .vimrc if isdirectory($HOME....
0
votes
1answer
75 views

Shared neovim/nvim and vim config-file, issue with coc.nvim: “(coc-definition)” works in vim - but not in neovim, why?

Noob, please bear over with me: I'm trying to share my ~/.vimrc config by sourcing it from ~/.config/nvim/init.vim. I try to use coc.nvim and it works for vim, but not for neovim/nvim (using a sourced ...
0
votes
1answer
21 views

Get count of string in vim

To get the count of a string I usually do something a bit hack-ish such as the following: Do a :%substitution on the string in question, such as: # how many times does the string "<Item "...
0
votes
0answers
25 views

Can I map the Mac “Command” Key in Vim?

I've seen others use nmap <D-V> <C-V> for instance to map Command-V to Control-V but it doesn't end up working on my end. Important: I should mention that I type code both on a virtual ...
0
votes
0answers
25 views

cscope E257: cstag: tag not found

I try to compile vim with cscope. However, I keep encountering the error E257: cstag: tag not found, no matter what position the cursor locates at when pressing CTRL ]. My vim version is 8.2. My dir ...
0
votes
0answers
12 views

Retrieving declaration not supported for filetype

I am currently using vim-lsp for bash. As in https://github.com/bash-lsp/bash-language-server#vim I have added in my ~/.vimrc the followings : if executable('bash-language-server') au User lsp_setup ...
0
votes
1answer
24 views

How to copy the current value of a `set` option into the clipboard?

I sometimes need to copy the current value of a set option, e.g. set statusline, into the clipboard (+) to paste its value here. I know how to show the current value of a set option, e.g. set ...
1
vote
0answers
18 views

Nerdtree display current opened file after jumping into a tag

I'm not sure if this is possible, I have my nerdtree opened for file let's say main.cpp. Then I use tag jump to one of the definitions which is in a different directory but nerdtree window still shows ...
1
vote
1answer
20 views

vim auto select tags upon launch

I have multiple projects (folders), and each of them has its corresponding tags generated. I found every time I launch vim it only links to my first tags file (:set tags?), I need to manually set the ...
1
vote
1answer
42 views

Vim to highlight functions and user-defined types

I have two scenarios where I want vim to highlight those items. Currently my fix for these are to add the return types directly into the after/syntax/c.vim file, but this gets incredibly tedious. Here ...
2
votes
1answer
40 views

Convert working commands to VIMRC friendly mappings (ie: :%s with regex)

Is there a simple way of taking a previously issued command and converting it into a .vimrc-friendly keybinding? For example, I have a simple substitution utilizing regular expressions that won't work ...
0
votes
0answers
32 views

E716: Key not present in dictionary: “3”

I have this global at the top of my .vimrc: let DevEnv = { 'enabled' : 0, 'open_dirs' : 0, 'term_bufnr' : 0 } One of my .vimrc functions calls: exec 'bd! ' . g:DevEnv.term_bufnr Note that g:DevEnv....
0
votes
1answer
22 views

vim-wiki mapping <leader>ww causing delay in another mapping

I'm using Neovim and my init.vim has a quick save mapping as below nmap <leader>w :w!<cr> Since i installed vim-wiki, there's a noticeable delay in the execution of w because of vim-wiki ...
1
vote
1answer
43 views

Why is my setting of `set softtabstop` in vimrc being clobbered when editing python files?

I am using vim 8.0.1763 on CentOS 8.1. Here is my ~/.vimrc " Cool vim plugins : http://vimawesome.com/plugin/fugitive-vim set number filetype plugin on " https://stackoverflow.com/questions/...
0
votes
0answers
17 views

How to open terminal in split in vimrc with keybinding [duplicate]

I am trying to open a new terminal (size of 10) inside of neovim. I use the command, :split|resize20|term. It works well, but I want to make a hotkey to do this in my init.vim nnoremap <C-P> :...
0
votes
0answers
8 views

How to go to file (gf) when is using rootPath in Javascript?

In Javascript is very common to have rootPath/rootURL import to avoid long ../../../../, like: import PageFoo from '~/pages/foo/'; //instead of import PageFoo from '../../../../pages/foo/'; When the ...
0
votes
0answers
32 views

How to add a breakpoint into vim

I'm wonder what the absolute most basic way to add a breakpoint into vim is. The equivalent of just 'passing through' the breakthrough line number to gdb, for example: gdb a.out --ex 'b 9' I'm hoping ...
0
votes
0answers
22 views

Syntax highlighting for two components of C syntax

What are the following two components that I need to target with syntax highlighting/rules? The first one is the int (or more generall, any storage class) that I want to colorize. If currently have ...
0
votes
0answers
27 views

Setting up C code highlighting

I've used vim for mostly python or web-related projects. Now I'm trying to see if I can use it to write some C code. The first thing that I've noticed is whatever setup I have, doesn't have any C code ...
0
votes
1answer
64 views

Can Vim remember cursor position as well as lines displayed?

I would like Vim to remember both the cursor position and the lines displayed, for example, in the screenshot line 26 to line 46 are shown, and cursor is at line 44. If I exit as it is now, is it ...
0
votes
0answers
15 views

Airline changes a title in the tabline by showing the result of quickrun in a new tabpage

I tried to show the result of quickrun on a new tab page. I succeed in showing the result via a new tab page by the following vimrc. A function Unique_open_tab opens the result via a new tab page. (In ...
2
votes
1answer
39 views

Navigating between split vi windows [duplicate]

On Windows OS, I am using Chrome web browser to ssh into a remote Linux terminal and using vi there. One can use Ctrl-w + hjkl to navigate among split vi windows. However, the problem is Ctrl-w ...
1
vote
1answer
30 views

Partial abbreviations

Pretty new to vim so this might be a basic question. I am trying to construct an abbreviation such that only part of a word gets corrected. For instance abcPRops gets corrected to abcProps defPRops ...

1
2 3 4 5
29