Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
31 views

Mapping Buffer Movement [duplicate]

How can I configure Vim and MacVim to respond to control-arrow and meta-{h,l} key-presses? The configuration below is ignored by both. I'm using iTerm2 (version 3.2.7), Tmux (version 2.8), and Vim (...
4
votes
2answers
29 views

Command works in ex mode but not during init (call)

When I run this command in ex mode it works without a problem: :call deoplete#custom#source('ultisnips', 'rank', 1000) However, when I put it in my vimrc I get an error: Error detected while ...
1
vote
1answer
24 views

Load current buffer in another pane

I'm writing a plugin where I have several buffers open in split panes ( let's call them small panes ). The user can navigate between the small pane using the usual ctrl+w , wincmd etc ways. While I ...
0
votes
1answer
31 views

autocmd for markdown textwidth=100 failing

I want to set my markdown files to have textwidth=100 but cannot get it working. The strange thing is that it works sometimes and sometimes not. My autocmd is: augroup auFileTypes autocmd! ...
0
votes
0answers
32 views

An operator pending mapping [on hold]

I have added the following operator pending mappings to my vimrc. onoremap K H onoremap H ^ onoremap J L onoremap L g_ This does not do what I want it to. I tried other suggestions in :h omap-info ...
1
vote
0answers
45 views

How do I configure my VI environment on Ubuntu 18.10?

I have a fresh install of Ubuntu 18.10 and VI is exhibiting behavior I am unaccustomed to. For example, when I insert something using "i", 4 spaces are automatically placed in front of what I've ...
1
vote
1answer
16 views

How to do a conditional key mapping dynamically?

I know that I can do a conditional key mapping by map-expression: map [key] [condition] ? [foo] : [bar] But now my situation is somehow awkward. I want to map <C-h> to <C-w>h if I have ...
0
votes
0answers
13 views

Pixels or half-points for font size?

It seems that Vim use typographic points for font, instead of pixels. Is there a way to: specify font size in pixels or use half-points (set guifont=Yourfont:h10.5)? E.g., I use 14 px Consolas font ...
1
vote
1answer
28 views

Detecting whether colorscheme is available [duplicate]

How can I detect whether a color scheme installed via a vim-plug plug-in is available? For context, I'm trying to automate my Vim setup on a new machine, pulling the vimrc from a git repository. The ...
0
votes
1answer
25 views

Setting $XDG_CONFIG_HOME

My current nvim is in ~/AppData/Local/ and I want to drag it out just one directory below $HOME. How can I set $XDG_CONFIG_HOME, and can it be done via Neovim?
0
votes
1answer
31 views

map <expr> <F2> Cannot Check Focus Pane

How can a keypress dynamically change its behavior, depending upon which split pane has focus? (Specifically, whether the pane containing the cursor has another split pane to the right, or not.) map ...
0
votes
0answers
22 views

How to bind command+s to save file on macOS?

I have a Macbook. I want to save files by pressing command + s (this should happen if it is in insert mode or not, and I want it to go to non-insert mode after it is saved). How do I do this? ...
1
vote
1answer
21 views

Show / hide horizontal scrollbar depending on “wrap” option

I'm trying to show / hide horizontal scrollbar conditionally, depending on wrap option: with wrap - show horizontal scrollbar with nowrap - hide Here is what I tried, but for some reason it doesn't ...
0
votes
1answer
40 views

Vim disables syntax highlighting after execution `autocmd BufAdd * exe 'buffer ' . expand('<abuf>')`

Following code switches off Vim syntax highlighting for buffers opened after its execution. autocmd BufAdd * exe 'buffer ' . expand('<abuf>') Why? Is it bug?
0
votes
1answer
27 views

My gVim (8.1, Win10) does NOT invoke $VIM\_vimrc during initialization

My $VIM\_vimrc is as follows: source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin My $HOME\_vimrc does not have this option. I was led to believe that Vim first invokes ...
2
votes
0answers
28 views

vi -u doesn't seem to work?

As system administrator I have to work under several user IDs, some of which are shared with others. We all have different tastes in what we like in terms of settings for our vi, so I am looking at ...
0
votes
1answer
31 views

Add whitespace conditionally, based on flags

I'm trying to add whitespace on the left side of the flags section, and to hide this whitespace when flags aren't exist. Here is what I mean: Statusline with no flags: :File.txt ...
1
vote
0answers
20 views

Ignore acronyms as spelling errors in TeX files

My LaTeX files contain lots of acronyms and they are often highlighted as spelling errors. I tried to ignore acronyms by adding syn match AcronymNoSpell '\<\(\u\|\d\)\{3,}s\?\>' contains=@...
2
votes
1answer
106 views

Keep cursor position while removing control characters

Here is an attempt to write a function which will remove trashy characters (^F, ^S, ^Z, zero-width space, etc) on save, and keep cursor position. colorscheme desert set guifont=Consolas:h10 set ...
2
votes
0answers
47 views

Preventing autocmds from being redundantly repeated

I'm trying to figure out what is the proper way to prevent autocmds from being redundantly repeated. Here are articles which I have already read: Remove augroups around autocmds in .vimrc (related ...
0
votes
0answers
40 views

Exclamation mark after autocommands

I'm trying to understand what does exclamation mark after autocommands mean. Sometimes it is possible to see something like this: function! LangSpecificOptions() if (&filetype == 'markdown' || ...
0
votes
2answers
49 views

How to use variables? [duplicate]

I'm trying to use indent size as variable, but it doesn't work. let indent=4 set tabstop=&indent set softtabstop=&indent set shiftwidth=&indent set expandtab I tried both &indent and ...
0
votes
1answer
29 views

Replace text in status line flags

How could I replace text in status line flags? set laststatus=2 set statusline= set statusline+=%r%m Is there a way to replace [RO] to Read only, and [+] to Modified?
6
votes
2answers
237 views

Why does xnoremap mapping make visual selection slow?

I have made a mapping xnoremap j; <Esc> where j; puts you into normal mode if you're in visual mode. Having this mapping in my vimrc slows down visual selection. I can't figure out why this is ...
0
votes
1answer
34 views

To encode trailing space with something like {U+0020}

How could I encode space in .vimrc? This is required here: set list set listchars=tab:→\ , As you see, I use comma to workaround this issue, but I want something like set list set listchars=tab:→{U+...
0
votes
0answers
22 views

Configure Denite to Open File in New Window

Below is my configuration for denite. When I select a file from the denite buffer, the file is opened in the preview split window rather than a new window. How can I configure denite to open the ...
1
vote
2answers
38 views

How to detect running in intellij in vimrc?

I have some plugins I would prefer load by default in the terminal, and cause performance issues or ux glitches in jetbrains ides running ideavim. Neovim needs to start getting adopted, but that's an ...
0
votes
1answer
46 views

Can I define something in .vimrc to speed up pasting of large amounts of data?

Occasionally, I paste large amounts of data into vim, using Ctrl+v in my terminal emulator (in Linux). This takes several seconds before vim is responsive again. I have tried two other methods, which ...
0
votes
0answers
20 views

How to Close Preview When Exiting Denite?

Below is my configuration for denite. When I exit from a denite buffer without selecting a file or buffer via the escape key or ctrl-o q, denite displays the contents of the file or buffer that the ...
0
votes
1answer
31 views

Enable syntax highlighting in vim using colorschemes?

In my installation of vim 8.1 (compiled from source) syntax highlighting is not working. The runtime path ($VIMRUNTIME) is set to /XYZ/VIM8/installnew/share/vim/vim81 which contains (autoload, ...
0
votes
0answers
13 views

Displaying specific text only in the airline of a given window

Suppose that using bufwinnr() I find the windows number where a given buffer is being displayed to be 2. With that information, is there a way to display a specific string only in the airline status ...
5
votes
2answers
70 views

What is fileencoding of .vimrc?

I've upgraded vim and now it's unhappy about some UTF-8 values in my .vimrc. This lead me to the question -- when vim reads .vimrc, what encoding does it assume the file has? I.e. what's fileencoding ...
0
votes
1answer
34 views

Identifying the PID of Vim 8.1 internal terminal launched with :terminal ++close

When launching an internal Vim 8.1 terminal for an exclusive program like in terminal ++close ipython, is there a way to identify from vimscript which is the PID of the launched process (i.e. of the ...
0
votes
1answer
22 views

Mappings with counts at the end without using loops?

Suppose you are trying to create a set of mappings such that pressing <C-t> followed by a number # would alternate to the respective tab at index #. I know that using a loop, I can do: " Map ...
0
votes
1answer
29 views

Autocmd for hard wrap and going back to the previous position!

In my .vimrc file I have autocmd BufWritePre *.c :g/./ normal gqq with text width 119 in order to hardwrap the lines before saving the buffer. I tried autocmd BufWritePre *.c :g/./ normal gqq``...
1
vote
0answers
18 views

Repeat Emmet commands in vim with dot operator

Is there a way i can repeat an emmet command in vim. Below is the sample text file <h1>Hello World</h1> <h1>Hello World</h1> So i use emmet to wrap the the first line inside ...
0
votes
0answers
26 views

Default Window to be 80 characters wide?

I use vim split window a lot but I would like each default window to have width set at 80 chars. Are there any plugins/hacks that can accomplish this?
1
vote
0answers
34 views

Is it possible to see only defined code except else in vim on linux?

I'm trying to see the verilog and systemverilog programing codes on linux by using VIM. but some codes are defined with so many 'ifdef~'endif syntax. so I'd like to see only the code related with ...
2
votes
1answer
35 views

Not displaying ErrorMsg for long lines only with tex, md and calendar buffers

I use and love the plugin calendar.vim. Those days, I decided to add the following to my vimrc: autocmd BufEnter *.tex,*.md call matchdelete(4) autocmd BufLeave *.tex,*.md call matchadd("ErrorMsg", "\...
0
votes
1answer
28 views

How to print a message after `autocmd` is done

I'm using ctags to generate tag file so that I can jump to declaration or to definition while working with C/C++ project. To make ctags work automatically while entering vim, I add such a line in my ...
1
vote
1answer
28 views

How do I make vim display virtual space at the bottom when opening a file?

I really like not having my cursor at the bottom part of the screen. Using :set scrolloff=20 does help when scrolling down a file, but it doesn't work when I reach the bottom (unless I zz). Another ...
1
vote
1answer
30 views

How to create or modify vim commands?

In Vim wrapping lines at 80 characters without breaking words can be done with the following commands according to this article: :set formatoptions+=w :set tw=80 gggqG Setting 80 char wrap is ...
0
votes
1answer
25 views

How to remap ö in .vimrc? [closed]

Writing :set noremap ö : in vim works fine, but with my .vimrc file containing: set noremap ö : I get the following error: Error detected while processing /home/anna/.vimrc: line 1: E518: ...
0
votes
1answer
65 views

Configuration from Vim 7 (macOS) to Vim 8 (Ubuntu) results in errors

I'm working long time with my own vimrc and lots of adjustments for different file types, ... in the macOS terminal (Vim 7.4.8056)and (the same config-files) on a rented Apache Server. Now I just ...
1
vote
0answers
31 views

display list of buffers `ls` without scrolling down

Is there a way to display output at the bottom of the screen like ls does, but without scrolling down to accomodate the output? The Vim Wiki (no https) has the following snippet :nnoremap <A-n>...
0
votes
1answer
59 views

Setting default gVim font via `vimrc`, conditional on the operating system

I can place the following code into my _vimrc file on Windows 7/10 and the font will default to 'Consolas - size 11' when I launch gVim. if has("gui_running") if has("gui_gtk2") set guifont=...
-1
votes
3answers
71 views

Change $HOME before it gets accessed

I'm using vim 8.1 on windows. The IT department has set $HOME to a slow network drive. Every time a file gets written to $HOME vim slows down. I have $VIM/vimrc with the following content. let $HOME ...
0
votes
0answers
26 views

How do I make Ctrl+Shift+C to work with xnoremap?

I want to copy selected in Visual mode text with Ctrl+Shift+C key combination. I've added xnoremap <C-S-C> "+y to the end of my .vimrc file and it didn't work. I can confirm that it works ...
0
votes
0answers
27 views

Use a file in ftplugin directory for multiple file types?

Let's say I want to use one file to set settings for xml, html, and plist files. So I have: .vim/after/ftplugin/xml.vim .vim/after/ftplugin/html.vim .vim/after/ftplugin/plist.vim But I want to join ...
0
votes
1answer
32 views

how could I use different `.vimrc` with `-u` option

I have configured my .vimrc to make my vim work, and then I renamed my .vimrc to be .vimrc2. After that my vim can run as clean mode, but when I run my vim with vim -u .vimrc2, there are errors like ...