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
19 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
1answer
66 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
26 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
15 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
72 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
26 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
19 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
38 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
20 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
18 views

Compiling java using :make

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
38 views

How do I make the cursor blink?

set guicursor=n:blinkwait5-blinkon5-blinkoff5 has no effect. Why is that? mp4
0
votes
0answers
41 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
64 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
19 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
24 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
20 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
11 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
30 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
39 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
31 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
31 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
58 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
29 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 ...
0
votes
0answers
26 views

Print command output on terminal on vim exit

I am trying to run shellcheck upon exiting vim, however I do not get the output of the command I run. I've tested running something like touch foo instead, and I managed to see the file being created, ...
6
votes
1answer
88 views

Set line length for gq without affecting typing

I recently discovered that I can use gq} instead of !}fmt to break up long paragraphs into lines. This works great. Unfortunately, I ran into a bit of a problem. GNU fmt uses a default max line width ...
-1
votes
1answer
44 views

What is 3kA in this mapping?

I'm trying to understand how to make mappings in vim (particularly neovim). Searching, I’ve managed to do some of the things that I want, but I can't learn what everything means. Example: a latex ...
0
votes
0answers
28 views

How to bind <C-U> to <Cmd><BS> in vimrc?

I understand that <C-W> is backward-kill-word and I have bound this to shiftBS and it works. But now I want to bind <C-U> to cmdBS. Is this possible? If so, how can I do this?
0
votes
0answers
41 views

Delete buffer only when a specific buffer is deleted

I've configured Vim to look like this: +------------------------------------+ | N | Code | | E | | | R | | | D |...
0
votes
2answers
44 views

How to backward-kill-word in Vim insert mode like zsh?

I'm re-learning Vim. My question is that I want to option + ⌫ to backward-delete a word in INSERT MODE. I've spent some days to achieve this (and succeeded) to my zsh shell through bindkey in .zshrc ...
2
votes
1answer
58 views

How to install more features to built-in Vim in macOS?

When I type :version inside Vim and I got a list of features as below, and I realized that there are some features/packages not installed by default (-python3 for example). How do I include/install ...
2
votes
1answer
164 views

How to change where Vim will read .vimrc file?

I'm re-learning Vim, and now I'm building my own ~/.vim/.vimrc file. Yes, it is store under the .vim/ folder, which is created by MacOSX after I updated to Big Sur. What I want is simply this set ...
0
votes
0answers
22 views

Command + Delete inserts a tab at the start of the line for some reasons

I want to delete everything from the point of the cursor to the front of line with Command + Delete on insert mode. So I wrote the following on ~/.vimrc. inoremap <D-Bs> <C-u> But this ...
2
votes
2answers
71 views

Can vim-plug write plugin settings directly to .vimrc?

I am new in using vim-plug. It works fine installing and updating all the plugins configured in .vimrc. But some plugins require some additional settings inside .vimrc to work correctly. Is there a ...
0
votes
1answer
51 views

Enabling rubocop linter the right way

I've got a vim VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 17 2020 21:54:53) on ManjaroLinux (Arch + kde) and I'm using rvm to run my rubies. The ruby I am using now is: => ruby-2.7.2 [ ...
0
votes
2answers
42 views

paste in insertmode without indent i.e. `<C-r>*` without indent

I want to do :set paste, paste, :set nopaste in one keyboard shortcut in insertmode (<C-r>*) In visualmode, with vnoremap p "+p works with no indent. But in insertmode, this <C-r>* ...

1
2 3 4 5
28