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
2 answers
24 views

Why is my colorscheme showing weird colors?

I recently (few days...) updated Vim on arch (via the package manager), and I've noticed something about colorschemes has changed. However, I don't understand why I should see color changing if I don'...
user avatar
  • 1,562
1 vote
1 answer
16 views

Check if VimPlug is installed in .vimrc

I'm trying to have a .vimrc that is portable between machines. Some computers I use have VimPlugin installed, while others don't. On the ones with VimPlug, I'd like to do some setup using call plug#...
user avatar
0 votes
1 answer
27 views

How to map a sequence of vim commands to a shortcut?

I have the following sequence of vim commands I use to copy a function va{Vy, how can I map this to a shortcut key like F1? I'd also like to persist this.
user avatar
0 votes
1 answer
18 views

Configure the statusbar to show rows

I want to configure the statusbar in vim to show which row I'm on. I have it currently set as statusline=%l/%L\ (%3p%%) I want however to do something like the following statusline=%3l/%3L\ (%3p%%) ...
user avatar
2 votes
0 answers
25 views

How to remap deleting a word in insert mode?

My terminal emulator in which I use vim is alacritty, and I want the key combination control + backspace to do the same that control + w does when in insert mode (i.e. delete the entire last word). So ...
user avatar
  • 33
1 vote
1 answer
21 views

How to jump to the first error when using ALE?

I've installed dense-analysis/ale from this repo: https://github.com/dense-analysis/ale I'm trying to use it to detect errors automatically in my Elm projects. Errors are detected since they are ...
user avatar
1 vote
1 answer
182 views

Is it possible to execute Ex Commands (colon commands) in VimScript (vimrc/init.vim)?

First off, just an FYI: I am not that experienced with writing VimScript I have a plugin that I want to have enabled using its custom Ex command (:RainbowParentheses). Putting that inside my init.vim: ...
user avatar
1 vote
1 answer
36 views

Error detected while processing BufRead Autocommands

I'm a new user and I have just installed GVim on my linux. I just have ~/.vimrc file and no .vim folder may be because I did not install any plugins. When I try to refresh (by :e) or reopen the ...
user avatar
  • 11
0 votes
1 answer
17 views

What's going on with displaying tabs as 4 vs 8 in Vim vs other display clients (like a web server and firefox for example)

I'm not really sure if I should post this as a web browser question (or nginx), but I compose in VIM so here it is! Because I don't like 8 character tabs in my documents, I set by tabstops to 4, ...
user avatar
0 votes
0 answers
4 views

Modify save message with time stamp - ie: 5 sec ago

Using vim. Is it possible to have n seconds and n minutes ago on the save message? ie: "src/utils/index.ts" 72L, 2068B written 5 sec ago
user avatar
  • 125
0 votes
0 answers
12 views

macro doesn't work anymore after disabling smartindent

A while ago, with the help of the answers in this Question, I managed to write two macro's to create debug prints: autocmd Filetype python nnoremap <buffer> \p "=[printf('print("(%s)\...
user avatar
  • 137
0 votes
1 answer
26 views

Lazy loading only the lines can be seen from the current window?

As title. I just faced a situation that I have to browse some large file (for human, not machine perspective) with around 10,000~50,000 lines. Is it possible to only load those line that can be seen ...
user avatar
  • 123
0 votes
1 answer
29 views

How to remove views saved by :mkview

I use :mkview to save folders in vim: autocmd BufWinLeave *.* mkview autocmd BufWinEnter *.* silent loadview but how to delete currently saved views? I comment out those two lines from vimrc but I ...
user avatar
0 votes
0 answers
22 views

Overriding syntax highlighting for LaTeX defaults in vim

I am currently using default syntax highlighting for LaTeX in vim on a Windows machine. Here are the contents of my _vimrc file: set number set belloff=all syntax on set backspace=indent,eol,start set ...
user avatar
  • 111
0 votes
1 answer
39 views

How to filter lines only if the filter is successful?

I have the following lines in ~/.vim/ftplugin/python.vim: " yapf integration function FormatFile() :normal mp 0,$!yapf :normal `p endfunction autocmd BufWritePre *.py call FormatFile() ...
user avatar
  • 23
0 votes
0 answers
27 views

Convert Vim keymap to lua

I want to change my emmet leader key in vim, but I do not know how to do this in lua. Vim Script code: imap ,, <C-y>, Lua Code: local map = vim.keymap.set
user avatar
  • 1
2 votes
2 answers
32 views

minlines in gvimrc

I notice when I work with larger Mardown files, the syntax highlighting is broken if I skip around the page. This seems to fix the issue: syntax sync minlines=999 but if I put it into my _gvimrc, it ...
user avatar
  • 746
0 votes
1 answer
39 views

Disable/change colors in vim terminal (but not in open file)

I'm on Mac Neovim. When I type :term, I am greeted by this: This poses some issues; For example when I run a command, it also colors the output; I don't want this to happen. Is there some way to ...
user avatar
  • 11
0 votes
0 answers
20 views

a `nnoremap <buffer><silent>` on .vimrc make the curssor very slow on normal mode

To automate a bit the title creation for rst text I added this to my .vimrc: au FileType rst nnoremap <buffer><silent>h1 yypVr=o au ...
user avatar
1 vote
3 answers
75 views

jump out of parenthesis, bracket, brace, quotes etc

Looking for simple and straightforward solution. I'd like to jump out of parenthesis, bracket, brace, quotes etc while typing in "insert" mode. Obviously following mapping settings in ~/....
user avatar
  • 13
0 votes
1 answer
19 views

Function call makes cursor jump to beginning of file

I'm writing a function that should run a linter and then populate the location list with appropriate linting messages. The problem is that when I call the function (by running :Phpcs), the cursor ...
user avatar
  • 103
0 votes
1 answer
51 views

why is inoremap parentheses, brackets, quotes not working

I'm new to vim and trying to configure vim for my coding learning course. I tried these very basic inoremap lines in my ~/.vimrc, and there are also similar lines for <>'", but none of them ...
user avatar
  • 13
1 vote
1 answer
35 views

Unexpected behavior in edited vimrc: dropped out of insert mode when hitting empty line

sorry for the bad title. I could not think of how to better summarise the problem. I should also state, that I am fairly new to vim, so please be a bit considerate :). I made the following changes in ...
user avatar
  • 13
1 vote
0 answers
33 views

How does .vimrc relate to ~/.config/nvim/init.lua?

When I heard neovim had a "native language client", I wanted to trying moving it. Previously, I was using a language server loaded through vim-plug. This was always problematic. When I ...
user avatar
0 votes
1 answer
36 views

How do you set terminal options like t_Co in neovim?

When I put into my ~/.config/nvim/init.lua vim.opt.t_Co = 256 I get E5113: Error while calling lua chunk: vim/_meta.lua:659: Not a valid option name: t_Co But there is an option in vim called t_Co. ...
user avatar
0 votes
0 answers
26 views

Syntax coloring only works inside a particular directory

I have no idea what I did but syntax coloring only works when I open files with vim started inside a particular top level path (e.g. /Users/name/Source/git-repository/). If I open the same files when ...
user avatar
  • 103
1 vote
1 answer
40 views

How to add commands from an external script to .vimrc?

I have used this script to be able to highlight results from test reports: https://vim.fandom.com/wiki/Highlight_multiple_words When using it in Vim, it works fine when I type :Highlight 1 FAILED (For ...
user avatar
  • 137
0 votes
0 answers
13 views

autocommand variable is not substituded [duplicate]

let Dropbox = "/usr/Dropbox" ... autocmd BufNewFile *.php 0r Dropbox/vim/templates/php_start.txt The variable 'Dropbox' is not substituded by its value
user avatar
0 votes
0 answers
19 views

Taking user input and using it in cmd in vim [duplicate]

I am trying to configure my .vimrc file and got stuck on a problem. I am trying to get input from the user and use that in the cmd. Like, :let g:store = input("give input: ") :!echo store ...
user avatar
0 votes
1 answer
23 views

Custom folding for filetype best practice

In order to keep my tex files organized, i decided to add the following line to my .vimrc, so i can create folds for different parts of them easily by adding "%%" and "%;" as ...
user avatar
1 vote
1 answer
44 views

vim terminal linewrap in normal mode

So suppose there's some text in vim terminal that is longer than the terminal width and it causes a wrap. Now suppose I go into normal mode in that terminal. In normal mode, we have an addition of 4 ...
user avatar
0 votes
0 answers
24 views

Cycle through popup list without arrow keys?

I am faily new to vim/nvim. To assist my learning I have disabled arrow keys: nnoremap <right> <Nop> nnoremap <left> <Nop> nnoremap <down> <Nop> nnoremap <up> ...
user avatar
  • 75
0 votes
0 answers
30 views

coc.nvim and formatSelected with golang not working

Getting this error message when running the shortcut: [coc.nvim]: Error on "formatSelected": formatRange provider not found for current buffer, your language server doesn't support it. ...
user avatar
1 vote
1 answer
26 views

How to bind function calls in vim

Suppose I have some extension that allows for calling some function foo(). Can I somehow bind the command :call foo() to just :k for example?
user avatar
  • 33
1 vote
1 answer
62 views

In a vimrc, how do you preload a register with a string containing Special characters, like a newline?

In a vimrc file I want to preload register C with a string I regularly need when coding. The string has a newline in it but no success in getting it to work properly. Here is an example vimrc snippet ...
user avatar
1 vote
0 answers
23 views

How to check for presence of a glyph?

I run vim under various terminals, supporting different sets of Unicode glyphs. While I can make vimrc settings depend on the value of TERM, this is slightly error prone, since updates of glyph ...
user avatar
  • 337
0 votes
1 answer
51 views

How do I remove a default file from runtimepath?

I have this line in vimrc but it seems do nothing. set runtimepath-=~/scoop/apps/vim-nightly/current/filetype.vim This file is from $VIMRUNTIME. I don't want to use vim default filetype settings. How ...
user avatar
1 vote
3 answers
69 views

How can I set path of vim from the shell command result

I'd like to set c++ header file path automatically from .vimrc. So I tried to write .vimrc file as shown below: let g:gcpp_headers_path=system("g++ --version | grep g++ | awk '{print \"/usr/...
user avatar
  • 121
0 votes
0 answers
44 views

Yanking to system clipboard does not work

I'm on Ubuntu 20.04.3 LTS, I have +clipboard and +xterm_clipboard in my vim --version, and I have set set clipboard=unnamedplus in my .vimrc. For some reason, yanking still does not copy to the system ...
user avatar
  • 165
0 votes
0 answers
57 views

How portable is my $HOME/.vim directory?

I'm at home on a few unixy systems, FreeBSD/amd64, Linux/amd64 and Solaris/Sparc. I would like my ~/.vim directory as portable as possible, ideally in such a way I can keep them identical (say, rsync ...
user avatar
  • 337
0 votes
1 answer
47 views

Vim display compilation errors

I was wondering what plugin or change to my .vimrc file can allow for displaying auto compilation comments like this,
user avatar
0 votes
1 answer
53 views

Color line numbers RED with SUDOEDIT

I want to have a visual feedback when editing files with root privileges. I had in my .vimrc this config " Color line numbers RED with root if $USER == 'root' highlight LineNr ctermfg=red ...
user avatar
  • 101
0 votes
1 answer
36 views

Why doesn't vim-sneak's label-mode work even after enabling it?

I wanted lightspeed-like features in Vim (without having to install Neovim). I installed vim-sneak and followed the directions to enable "label-mode": let g:sneak#label = 1 But when ...
user avatar
  • 5
0 votes
0 answers
19 views

How to set background(label) of tabs

I tried the following out of this post. But somehow it does not work. Even if I enter it into my .vimrc and source it. Even if I enter something like: :hi TabLineFill ctermfg=Yellow ctermbg=Red ...
user avatar
1 vote
1 answer
33 views

How can I make `.vim/after/ftplugin/markdown.vim` take effect immediately

I change this file, but it seems that I have to restart vim to make it take effect. Is there any way to make .vim/after/ftplugin/markdown.vim take effect immediately? I try :source and :runtime, ...
user avatar
0 votes
0 answers
28 views

how to hover on linting or other icons in editor using vim?

So I use vscode with vim. And I use linting and helpers when I code. so I would like to know how I can hover over linting with vim so those help messages appear or just how to work with hovering with ...
user avatar
0 votes
3 answers
78 views

How to move cursor to the last blank space in a line in vim?

I understand that to move to the beginning of the line blank space I have to use 0, but to move to the last blank space in the line '$' or 'end' sign move to the last character. How to move to the ...
user avatar
2 votes
1 answer
52 views

How to save a macro (for quickly printing a variable)

I'm trying to create a macro for an action that I very frequently use in Python: printing a variable in a bright color so it can easily be found in the traces while debugging. So lets say there's ...
user avatar
  • 137
0 votes
1 answer
42 views

How to test for normal execution exit code?

func! ShouldReformat() return normal :w !elm-format --stdin --validate endfunc func! Reformat() if ShouldReformat() normal gggqG endif endfunc But return normal is not taken into account, ...
user avatar
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

1
2 3 4 5
33