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

Autocmds for particular filetypes

I'm trying to understand using the autocmd to modify properties for certain files. Here is a basic example I have in my vimrc: syntax on autocmd BufRead *.py syntax off However, when I then open up ...
David542's user avatar
  • 2,435
1 vote
1 answer
361 views

Vim filter command not using line-wise selection

I may have seen this question before on Vi Exchange but I'm having trouble locating it while searching now. If it's already been answered, please let me know the duplicate and I can find that. I have ...
David542's user avatar
  • 2,435
1 vote
1 answer
210 views

Silent mapping that automatically redraws -- no messages or blank screen

I would like to open a url in vim. Using gx from netrw has been problematic, so I created the following simple mapping: nnoremap <leader>k !open <C-R><C-F><CR> This gets the ...
David542's user avatar
  • 2,435
1 vote
1 answer
498 views

matchadd makes vim slow with large files

In my vimrc I have this line : call matchadd('ColorColumn', '\%81v', 100) It colors the 81th column in a subtle grey background so I can track my line length : (see the l and the f) I found out ...
nobe4's user avatar
  • 16k
1 vote
1 answer
339 views

Remove ~ in buffer at vim startup

When open vim or kill buffers to empty I encounter with ~ and I'd like to disable/remove it.
Tuyen Pham's user avatar
  • 1,306
1 vote
0 answers
255 views

Re-mapping Swedish letters

On a Swedish keyboard to the right of the keyboard one has: O, P, Å L, Ö, Ä [ and ] are extensively used by Vim, and hard to reach on my keyboard, so therefore I've mapped these to Ö and Ä in my ....
Max's user avatar
  • 153
0 votes
1 answer
463 views

Match pattern and highlight it in modeline for a specific filetype

I need to match Issue in .conf filetype and highlight it with custom color but set in mode line instead of a fix in syntax/conf.vim file. The use-case is for each kind of document I need to highlight ...
Tuyen Pham's user avatar
  • 1,306
0 votes
1 answer
538 views

Auto activate autocompletion

I would like to have autocompletion active on its own like on sublime text without doing Ctrl+n. I would like to have this without any none native plugins as the already existing autocompletion in ...
user avatar
0 votes
1 answer
268 views

Bracket is added in unintended position when I paste some code in vim

when I tried to paste code for(int i = 1; i <= N; i++) if(ord[i] == -1) dfs(i, 0, i); from clipboard in vim(of course in insert mode), it became for(int i = 1); i <= N; i++) if(ord[i] == -1) ...
david Hwang's user avatar
0 votes
2 answers
61 views

How can I change this comment plugin to work at the start of the line?

I got this from voyeg3r's gist He and @dave-kennedy made it 3 years ago. I am here because I couldn't contact them Can someone help me add a feature such that this vimscript code puts comment out ...
Mega Bang's user avatar
  • 199
0 votes
2 answers
456 views

Shortcut based on filetype

I would like to do the following remap: :inoremap <Option-Space> &nbsp; In other words, pressing option-space would add an html-escaped space. How could this be done, so that it only works ...
David542's user avatar
  • 2,435
0 votes
1 answer
41 views

Restricting filetype mappings

I have written the following mapping in my vimrc: autocmd FileType python :iabbrev <buffer> for for item in:<left> After I source the python file it works. However, now whenever I ...
David542's user avatar
  • 2,435
0 votes
1 answer
139 views

Reloading syntax on vimrc change

My vimrc has a function that extends the default-provided syntax for C: function! Bx_c_syntax() "{{{ "A faked version of the real thing let b:match_words= \ '\<...
Petr Skocik's user avatar
0 votes
1 answer
124 views

Why is an autocmd using cryptmethod a better way to prevent Vim from recording events than a separate vimrc?

There is a comment by Carpetsmoker which suggests a way to prevent Vim from recording events for certain filetypes: I would not recommend using a separate vimrc file, for the simple reason that it'...
Mateusz Piotrowski's user avatar
0 votes
1 answer
57 views

How can vim tell me which buffer is changed on disk among multiple buffers?

I am using this code in my vimrc if a file is changed outside vim, it shows File changed on disk. Buffer reloaded. set autoread autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' |...
Mega Bang's user avatar
  • 199
0 votes
1 answer
260 views

Renaming .vimrc and putting into other folder

I want to rename my. ".vimrc" as "bob.vimrc" And I want to put it inside "/Users/bob/bobs bits" As you can tell, I'm on a Mac. But everything keeps going wrong. I don't want a ".vimrc" symlink in ~,...
user251764's user avatar
-1 votes
2 answers
498 views

Shortcut for automatic execution

I've found the following command to execute Python or Matlab or any other language as far as I understand to execute code nnoremap <buffer> <F9> :exec '!python' shellescape(@%, 1)<cr&...
user10853's user avatar
  • 119
-1 votes
1 answer
325 views

Why Error E172 on Execution?

Code "" http://vi.stackexchange.com/a/7787/2923 function! OpenSelectionAsTabs() range let tabnr = tabpagenr() for line in range(a:firstline, a:lastline) execute "tabedit " . getline(...
Léo Léopold Hertz 준영's user avatar
-1 votes
1 answer
208 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 ...
sbh's user avatar
  • 53

1 2 3
4