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
1
vote
1answer
21 views

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

I'm struggling to find an answer to my problem, and it's one I've found myself with several times now. Is there a simple way of taking a previously issued command and converting it into a .vimrc-...
0
votes
0answers
17 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
15 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 ...
0
votes
1answer
22 views

NVIM: Switch from relative numbers to absolute when hit : (Command Line Mode) and vice versa

I'm trying to switch from the relative numbers to absolute when I enter the Command-line mode and vice versa. I have following script: function HandleRNumbers() if(&number == 1) nnoremap : :...
0
votes
1answer
15 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
16 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
20 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
25 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
38 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 ...
-1
votes
0answers
12 views

nvim and nvr have to use the same address

I am struggling to set up a nvr after installing it, but I still fail to accomplish that. The following is the error message. Is there any chance anyone can tell me how to resolve it? Can't connect to:...
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
38 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
20 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 ...
0
votes
0answers
24 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, ...
7
votes
1answer
70 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
39 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
27 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
38 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
39 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
32 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
98 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 ...
1
vote
0answers
19 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
67 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 ...
1
vote
1answer
35 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 [ ...
1
vote
2answers
41 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
vote
1answer
35 views

MacVim Text Randomly Disappeared [closed]

I am using MacVim to write code in C++. I went to modify my vimrc file and accidentally clicked :w when in the file. After doing this, all the text seemed to disappear. After a while, I realized the ...
1
vote
1answer
49 views

Vim: How to manipulate appearance of signs in .vimrc?

I have seen a guy on YouTube who has some sort of Markdown rendering in Vim. The * sign from a list is displayed as a •. When the cursor travels over it, the actual sign shows up. I have checked his ....
1
vote
1answer
69 views

Find and open a file by fzf in a new tab

I've configured my VIM to find and open a file by fzf: nmap <c-x><c-f> :Files<cr> It works fine, but I wanna open the file in a new tab instead of the current tab with the same ...
4
votes
1answer
45 views

How to save a macro which does not shift cursor position

I have to do </^< a whole lot. So I created a macro: let @w = '</^<Enter' (where Enter is entered via Ctrl+V M). But when I run it with @w it shifts the cursor down one line - which is NO ...
3
votes
1answer
37 views

Vim shows incorrect theme in error

Basically, all I'm trying to do is enable the syntax option. syntax enable colorscheme cobalt2 For some reason, I get no errors if I comment out the first line, but in case I don't comment it, I get: ...
1
vote
1answer
21 views

not finding the name of and plugin

I've installed "awesome" config for my vim; It has a plugin that shows some stuff on the left bar. I don't know its name, what's its name? and how can I disable it
2
votes
2answers
32 views

Concatenate mapping with zt mapping

I'm using CoC and coc-python, and there is the gd mapping, which goes to the definition of a symbol. The mapping is defined as: nmap <silent> gd <Plug>(doc-definition) Now, I want to ...
0
votes
2answers
41 views

How do I sync my vimfiles with Dropbox or other cloud storage?

I followed the directions in this post to sync my vimrc file in Dropbox with my two Windows computers. However, I also want to move all the other user content of my vimfiles folder to Dropbox as ...
2
votes
1answer
51 views

How to run shell commands inside Vim like Gary Bernhardt does in his screencasts?

I'm watching Gary Bernhardt's Destroy All Software screencasts, specifically A Compiler from Scratch. There, he runs shell commands without leaving Vim. I'm almost sure he's just using normal Vim ...
1
vote
1answer
37 views

How do you set vimrc to run a command on startup, only if one window is being opened?

I want vim to open Tagbar with :TagbarToggle when vim is starting up, but only: If the file is Python If it's not vimdiff If I'm not using vim -O file1.py file2.py to open multiple windows I would ...
1
vote
2answers
28 views

Where should I put filetype specific options for indentation?

At moment, mostly for random reasons, I have $ cat ~/.vim/ftplugin/c.vim set tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab smartindent autoindent cinoptions=g2 and this $ cat ~/.vim/...
1
vote
1answer
26 views

How to escape the end of a filename in a :read command?

I want to insert a skeleton to .sh files without any plugins. Vim complains that it can't find the file ~/.vim/skeletons/sh<CR><ESC>l. How do I indicate that /sh is the end of the filename ...
0
votes
2answers
47 views

How can i make this autocmd BufEnter command work?

i am setting the default vim-statusline, and i made this line on my colorscheme: hi MyStatusLineDevIcon ctermfg=7 ctermbg=0 cterm=NONE So i can color the devicons on my statusline.vim config I call ...
1
vote
1answer
83 views

Command already typed in when I open vim

When I open up vim, it starts off with :2R already entered into the command line. I tried commenting out my entire .vimrc, and then it opens up starting in replace mode, with the 2 key pre-pressed (in ...
1
vote
3answers
106 views

How do I make my own function to insert text in vim?

I have a folder of third party libraries called add-libraries and the location for this specific library is /home/yapjiahong/projects/cpp/add-libraries/plog/include. I want to write a function called ...
2
votes
3answers
1k views

Competitive Programming Vimrc is too long

I am preparing for the Egyptian Olympiad in Informatics and I prefer vim to be my code editor, but my problem is my vimrc, I think it is a bit long to type at the beginning of an onsite competition, ...
0
votes
1answer
33 views

How to set the document to move up and down while sliding the mouse wheel, while the mouse position does not change?

When I use the mouse wheel to slide the document, the document does not move at first, but the mouse cursor moves. How can I set the mouse cursor not to move while the document moves, so I don’t have ...
1
vote
1answer
21 views

What is corrupting my folds? And, more importantly, how can I fix it?

From time to time, I'll open up a document in vim and find that my manual folds are completely messed up. It's like vim decides to ignore its usual markers and, instead, start interpreting random bits ...
0
votes
0answers
39 views

Reset state of a file

I know that vim retains some meta information about a file (like cursor position before you last closed it, file type if you have manually set it) How can I reset this information? I'm in a very weird ...
1
vote
0answers
16 views

SupperTab support list UltiSnips snippets

I install the SperTab and UltiSnips plugins. I want to integrate SuperTab and UltiSnips but fail. Here is an example snippet numpy "import numpy" bw import numpy as np endsnippet snippet nu ...
0
votes
1answer
72 views

set clipboard=unnamedplus not wok

I am a newbie in vim and I added set clipboard=unnamedplus in .vimrc but doesn't work , in my previous os, I had the same problem and I fixed it by reinstalling vim using source and adding some extra ...
1
vote
1answer
28 views

how to map the Y key (shift + y) to copy from the current cursor position instead of copying the entire line?

I would like to map the shift+y key to move the cursor one position to the right, press the y key and wait for the move command. Similar to the operation of the p key. When used without the shift, the ...
0
votes
2answers
29 views

How can I make a mapping to toggle cursorbind?

I know that adding a ! to the end of an option works for some commands, but it doesn't work for cursorbind. How can I toggle between cursorbind and nocursorbind with a keybinding?

1
2 3 4 5
28