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
1 answer
223 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
86 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
22 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
5 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
18 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
30 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
55 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
1 answer
50 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
42 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
109 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
38 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
  • 756
0 votes
1 answer
99 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
0 votes
0 answers
25 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
101 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
24 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
67 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
36 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
63 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
153 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
27 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
50 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
28 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
47 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
32 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
  • 105
0 votes
0 answers
99 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
36 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
  • 145
1 vote
1 answer
79 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
34 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
70 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
100 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
55 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
76 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
69 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
58 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
55 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
29 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
40 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
45 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
127 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
55 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
62 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
0 votes
3 answers
246 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
210 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
55 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
244 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

1
2
3 4 5
34