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
2
votes
1answer
273 views

Alternatives to vimrc for Vim-LaTeX while Sourceforge is down

Sourceforge has been down for the last few days. It seems the only way to find what to add to your vimrc to get Vim-LaTeX to work is to download the 'recommended settings' from Sourceforge. This ...
3
votes
1answer
2k views

timeoutlen breaks <leader> and vim-commentary

I installed vim-airline about 2 weeks ago. At that time I read a section in the FAQs about a delay occurring after exiting insert mode and into normal mode. I noticed the delay and applied the fix ...
0
votes
1answer
166 views

Error characters in vimrc function

I'm trying to run a function that is in my vimrc to insert dependencies in a php class. The script must enter a parameter type hinting in the construct of my class and assign the result of this ...
1
vote
1answer
4k views

Syntastic doesn't find C header files despite Configuring

I have configured the following properly in my .vimrc in the root folder of a project to keep syntastic settings Project specific. But still Syntastic throws errors saying "No Such File or Directory"...
0
votes
0answers
194 views

Forcing bracket to go under cursor

So I am trying out javascript on vim. It is great that it automatically indents the braces for me when I close them etc.. But I was typing some JS and got into a bracket muddle. Here is what I had: ...
4
votes
0answers
333 views

How to remap <C-[> on linux [duplicate]

I have the same vimrc file for both Windows and Ubuntu environments. It works fine on both platforms, except for one difference. The line: nmap <C-[> <C-t> is working fine on Windows, ...
15
votes
3answers
2k views

How to label tmux tabs with the name of the file edited in vim?

Whenever I open a tmux session in terminal, all of the tabs containing vim sessions are labelled vim. My question is: How to configure it to label tmux tabs with the name of the edited file or ...
24
votes
8answers
6k views

Is there a best practice to fold a vimrc file

I recently realized that my vimrc is now more than 400 lines long (which IMO is too much I'll try to reduce that) and to make it easier to navigate, read and edit it I decided to investigate the ...
9
votes
4answers
12k views

Environment Variable for Personal Runtime Path? (~/.vim on *nix, ~/vimfiles on win32)

I'm trying to move my .viminfo file into my .vim/ folder for cleaner syncing across multiple machines. (I have my .vim stored on Dropbox, and then create symlinks to it from my home directory.) So ...
9
votes
2answers
1k views

How do I prevent Vim from unindenting empty lines?

Vim keeps unindenting the lines I want to keep indented if I don't write anything on them... I'll give an example, where the | is the caret. Caret is indented and I press enter if expression: ...
4
votes
1answer
458 views

How to use the value of a register in a key mapping?

I want to map a key to the system command `tmux set-buffer $var` where $var is the value of @0 register. How do i insert the @0 value into the map command map <leader>t :!tmux set-buffer @...
21
votes
5answers
9k views

Settings and plugins when root (`sudo vim`)?

It's really frustrating when I need to edit a file as root and use sudo vim somefile.conf and I can't use any of my keybindings and settings and plugins. Is there a way to get all my customizations ...
8
votes
1answer
1k views

Current line number aligned to the left with number and relativenumber

I use relative line numbers along with an absolute line number for the current line: set number set relativenumber The absolute current line number is always aligned to the left, and the help pages (...
2
votes
0answers
819 views

How to set vim theme in Vagrant?

I installed Vagrant within Windows, box is ubuntu server 14.04. My vim script: set t_Co=256 colorscheme solarized " colorscheme molokai But it doesn't works, and I got no solutions with Google. ...
6
votes
2answers
2k views

How do I conditionally set :colorscheme?

My .vimrc chooses my preferred color scheme (solarized) which is installed via plugin management system. Yet on some systems which don't have that plugin the :colorscheme solarized command runs but ...
0
votes
1answer
247 views

Avoid Redraw When Running External Command

I do some automatic setup in my vimrc that calls git clone, before any other plugins (such as dispatch.vim) are installed. It's called after some other messages are displayed using echom, and I'd like ...
4
votes
1answer
222 views

How do I setnumber and relativenumber for :Explore in .vimrc

In my .vimrc I have set relativenumber and set number it works in the editor but not in :Explore. I have to set it manually every time. How can I always get set relativenumber and set number in :...
1
vote
1answer
135 views

`filetype plugin on` and square brackets

With this .vimrc: nnoremap [ :lp^M nnoremap ] :lne^M filetype plugin on vim becomes sluggish when switching between "errors" of location list with square brackets. As opposed to using lprevious/...
2
votes
2answers
925 views

Short buffer name

Is there a way to shorten the displayed name of the buffer, for example, on the image, path(...)/application_controller.rb to simply "application_controller.rb"? If I have many buffers with such long ...
18
votes
3answers
13k views

How to make vim automatically add a newline to the end of a file?

Vim normally writes <EOL> for the last line only when there was one in the original file. How to make vim to write a new line at the end of a file all the time (when the file is not binary and ...
9
votes
1answer
4k views

Override cursorline background color by syntax highlighting

I've set the background color of the current line to light gray like this: hi CursorLine cterm=NONE ctermbg=253 (Note that my color scheme is black-on-white.) However, this way any background ...
4
votes
1answer
154 views

Is there a way to make preprocessor definitions in vimrc?

I'd like to create a new symbol to use in my vimrc that's <normal>, so I do not have to type <C-\><C-N> to get to do the "go to normal mode" command, nor clutter the vimrc file with ...
1
vote
1answer
780 views

vimrc Line Placing me In Replace Mode

I have the following one-line ~/.vimrc file: Line 1/1: nnoremap <silent> <ESC> :nohlsearch<CR><ESC> Whenever I edit a new document, now, I am placed immediately in Replace ...
3
votes
1answer
461 views

Contents of _vimrc file depend on how it is opened

I've run into a weird problem with Vim on Win8 that I just can't get my head around. Some of the stuff I'm going to mention happened months ago and therefore aren't fresh in my memory anymore, so ...
2
votes
1answer
66 views

Highlight word, depending on its prior use in the file

I try to color a word depending on its prior use. For example I have the following text file a : Type1 b : Type2 And now I will take about a and b So Ideally I would like to define Type1 within the ...
0
votes
0answers
53 views

Create project specific mappings and abbreviations [duplicate]

When I'm working in a project it would be useful to be able to set some abbreviations / mappings that are specific only to that project. I know that I can have file specific mappings in ~/.vim/after/...
3
votes
1answer
144 views

Configuring include-search for PHP

I just learned of the existence of include-search, but even after reading :help include-searchand :help includeexpr I'm not sure what I need to do to have [I find included and required files. How do ...
1
vote
2answers
1k views

Prevent CtrlP from indexing parent directories

I'm sure this will have been asked before, but I can't seem to find a solution. I tend to open Vim from the root of my project, let's say: ~/dev/project/ Which looks something like: project/ | - ...
4
votes
1answer
535 views

How to set the opening file as the tags in vim?

I have lots of files named by file.tags, ncl.tags, flod.tags, ... , fortran.tags. when opening file.tags, I want to set tags=file.tags.And when opening ncl.tags, I want to set tags=ncl.tags,and so ...
8
votes
1answer
2k views

How to change the value of timeout for one key command?

What I want To temporarily change the timeout value for certain key commands Where I've looked From :help 'timeout' I have : The timeout only happens when the 'timeout' and 'ttimeout' options tell so. ...
8
votes
2answers
3k views

How to write condition with regular expression?

I'm aware of the following comparison: if @% == "/tmp/crontab.zi5NeVPGRc" set nobackup set nowritebackup set noundofile set noswapfile endif But how can I use regular expression? For example ...
3
votes
2answers
459 views

Is there a simple way to require clean syntax before saving?

I currently use Ricardo Signes's plugin to allow me to use a single command to both check my Perl syntax and save my code only if it is syntactically correct. However, isn't there a simpler way to do ...
14
votes
1answer
17k views

How can I change the colour of the line highlighted with the 'cursorline' option?

I can highlight the current line like this :set cursorline, which underlines the current line. However I would like to highlight the entire line in a lighter color. How can I achieve this look?
5
votes
1answer
3k views

Filetype that LaTeX should be

From :help filetype: If the first line of a *.tex file has the form %&<format> then this determined the file type: plaintex (for plain TeX), context (for ConTeXt), or tex (for ...
2
votes
2answers
599 views

I have a something in my vimrc to match text over 80 characters as an error. It only works in the right most split. Any ideas?

From my .vimrc: match ErrorMsg '\%>80v.\+' And a screenshot: I have tried a minimal vimrc and it still doesn't work in the left splits.
15
votes
4answers
1k views

Why does this <Esc> normal mode mapping affect startup?

I'm experiencing a weird problem with a normal mode mapping of Esc. If you create the file escmapvimrc with the contents: set nocompatible set showcmd " Doesn't affect the problem: just makes it ...
11
votes
1answer
954 views

Is it possible to create custom “set” commands in my rc file and call them from a modeline?

I recently asked a question in which I learned that it is not possible to pass anything except parameters to :set in vim modelines. I understand the security concerns, but I'm wondering if there isn't ...
3
votes
2answers
684 views

Is it possible to include coding style vim modelines e.g. psr-2 or drupal? [duplicate]

In vim you can include modelines in comments at the start/end of a file, like // vim:sw=4 ts=4 et I regularly work with PHP and try to stick to PSR-2 but Drupal (of course *rolls eyes*) has to be ...
12
votes
1answer
3k views

How can I run an autocmd when starting Vim with no file, a non-existing file, or a blank file (but not when starting with an existing file)?

I would like to run an autocmd in the following scenarios when I start Vim: With no filename specified. When the file is new. When the file exists but is completely blank. In all of the above three ...
6
votes
1answer
767 views

Current filename not visible in airline

I'm using airline in vim on the terminal (as part of spf-13, fyi). However, all kinds of other random info (including other open buffers) tends to fill up the line and push out or cover what the name ...
12
votes
1answer
469 views

How to use sensitive data in .vimrc?

I want to have my .vimrc synced through github so it has to be public file, but at the same time i have to put some sensitive data (for example db passwords/hosts for dbext.vim) in it, without giving ...
1
vote
1answer
2k views

Linespace in Vim using iTerm2

I am using Vim 7.4.488 in iTerm2. Currently I've configured the 'linespace' setting in iTerm2's preferences. However, I would like to set a different linespace for Vim. I know that :set linespace=1 ...
5
votes
1answer
903 views

Perl folding with perl_fold_blocks

I have the below settings in my .vimrc relating to Perl code folding. When I type za to toggle folding, it works on any sub { } by just folding up the sub. However, if I za a non-sub block (e.g. ...
61
votes
7answers
34k views

Fastest way to switch to a buffer in vim?

One way to select a buffer in vim could be to browse the buffers list, using standard commands as :ls, or with some external plugin / vimscript code to browse a list in a window. Let's say I want to ...
8
votes
2answers
6k views

How to make vimrc settings applicable for a directory tree only [duplicate]

Is there a way to make certain vimrc configuration valid only for files under a defined directory tree? Or alternatively, is there a way to have a .vimrc file in a directory, and make its setting ...
35
votes
2answers
9k views

What's the difference between let and set?

I don't know much of the theory behind Vim. It looks as if we set some variables, and let other variables. What's the difference, and when is one required over the other? Also, the solarized vim ...
3
votes
0answers
150 views

How can I work around the inability to save macros in ViEmu? [closed]

I would like to be able to save my ViEmu macros between sessions of Visual Studio 2013. This feature was requested in 2010 and apparently almost made the cut for ViEmu 2.5: I was wondering if ...
13
votes
9answers
28k views

Colorscheme's background not correct in terminal

I imported the solarized colorscheme and palette. My terminal has the correct colors and background, gvim has the correct colors and background, but vim has an incorrectly colored background. The text ...
88
votes
7answers
22k views

How do I debug my vimrc file?

I have a problem in Vim, and I think it may be in my vimrc file (or have been told it could be my vimrc file). How do I verify this? If it is my vimrc file, how do I know where exactly the problem ...
4
votes
2answers
2k views

How can I get vim to not auto-wrap pasted text? [duplicate]

I am pasting several lines of text into vim at once (from another application, so I am using the OS's copy and paste and insert mode in vim). The longest of these lines is below: " :PluginClean -...