I made a .vimrc file within the \~\.vim directory using the command: type NUL > .vimrc and edited the file with vim.
I put the following settings in my .vimrc file to set up Pathogen and Syntastic as well as some other small settings. These are the settings that I had:
execute pathogen#infect()
syntax on
filetype plugin indent on
set number
set tabstop=4
set colorcolumn=110
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
However when I exit and open vim again, my settings don't work.
Path to the config file on Windows differs. You can see with :help .vimrc what that paths are, it says:
"$HOME/_vimrc" (for MS-DOS and Win32) (*)
"$HOME/vimfiles/vimrc" (for MS-DOS and Win32) (*)
"$VIM/_vimrc" (for MS-DOS and Win32) (*)
Note: For MS-DOS and Win32, "$HOME" is checked first. If no
"_vimrc" or ".vimrc" is found there, "$VIM" is tried.
See |$VIM| for when $VIM is not set.
This means you should create config file in C:\Users\YourUserName\_vimrc or C:\Program Files (x86)\Vim\_vimrc (usually in latter case some default _vimrc is already exist).
Related
when I run
vim good.html
and
:verbose set et?
expandtab
Last set from ~/.vimrc
but when I run
vim good.py
and
:verbose set et?
expandtab
Last set from /usr/share/vim/vim74/ftplugin/python.vim
I want apply ~/.vimrc file in .py, not python.vim
Yesterday I all is fine but today suddenly path was changed
please someone teach me how can I change the path
Put this into your .vimrc:
autocmd VimEnter *.py set expandtab
or if you want to have the configuration of .vimrc to be executed after all plugins being loaded - in case they have changed some settings -, you can add this line:
autocmd VimEnter * source ~/.vimrc
Note: It could have a side-effect depending on the content of your .vimrc because the latter actually will be executed twice (at the begining and at the end of vim startup) so you need to consider that.
Concerning Plugins now, if they are logged in some specific folders like .vim or vim installation path they will be loaded automatically unless you removed them or run some specific commands to be ignored.
Vim has also the ability to detect the type of file which is being edited, and this occurs when the option filetype is activated and probably this is what happened to you.
So typing :filetype will confirm that. Maybe you can desactivate it for some specific files if you wish. It is up to you !
:help VimEnter
VimEnter
VimEnter After doing all the startup stuff, including
loading .vimrc files, executing the "-c cmd"
arguments, creating all windows and loading
the buffers in them.
i starting to use VIM for windows, i download the minimal windows vim exe from here:
http://www.vim.org/download.php#pc
i created simple vimrc file that is located in the gvim.exe directory that looks like this :
vimrc:
set secure exrc
"disable beep
set noeb vb t_vb=
"color scheme
set background=dark
highlight Normal guibg=Black guifg=White
"remove topbar
set guioptions-=T
the thing is that when i execute the gvim.exe , it doesn't load the vimrc
it load it only when from within vim i run :
:e vimrc
:so %
what i missing here ?
Your plugins, colorschemes, etc. are supposed to be here:
%userprofile%\vimfiles
Your vimrc is supposed to be there:
%userprofile%\vimfiles\vimrc
I want to enable cursorline only for gvim but disable it for vim in TUI, I tried this in .vimrc
if has("gui_running")
set cul
else
set nocul
endif
but it doesn't seem to work.
The .vimrc gets read by gvim and vim while the .gvimrc gets only read by gvim. As the docs say:
The gvimrc file is where GUI-specific startup commands should be placed. It
is always sourced after the |vimrc| file. If you have one then the $MYGVIMRC
environment variable has its name.
While your command should do the trick, I'd place the set cul command in my .gvimrc.
This will also help your .vimrc being cleaner and you don't need gui_running checks anymore.
When I open a *.tex file with Vim, filetypes is read as plaintex (returned by set ft?) by YCM.
So I added in .vimrc :
let g:ycm_filetype_blacklist = {'plaintex' : 1}
But nothing had changed.
Here I want that filetype .tex is read as tex type (set ft=tex).
How to define it with YCM options?
After research (from vim-latex plugin) I found that I have to add following:
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
Does YCM set the 'filetype' option? If you want it set to tex, then check where it was set:
:verbose set ft?
I bet it is set in $VIMRUNTIME/filetype.vim, in which case it is my fault. Luckily, I made it configurable. According to :help ft-tex-plugin,
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 LaTeX). Otherwise, the file is searched for keywords to
choose context or tex. If no keywords are found, it defaults to plaintex.
You can change the default by defining the variable g:tex_flavor to the format
(not the file type) you use most. Use one of these:
let g:tex_flavor = "plain"
let g:tex_flavor = "context"
let g:tex_flavor = "latex"
Currently no other formats are recognized.
I think that
:let g:tex_flavor = 'latex'
in your vimrc file will make you happy.
When trying to set DoMatchParen I get the following error: E492: Not an editor command: DoMatchParen. I thought that pi_paren is a standard plugin. What could be the problem?
Thanks.
I too get that error when I do :DoMatchParen, but this is because I switched off this feature in my .vimrc with the following line:
:let loaded_matchparen = 1
Could it be that either your personal .vimrc or a system-wide configuration has this option switched off? You may wish to try putting:
:let loaded_matchparen = 0
in your .vimrc file to see whether that allows the feature to load properly. You can find (or create) your .vimrc file in the following places:
Recommended place for your personal initializations:
Unix $HOME/.vimrc
OS/2 $HOME/.vimrc or $VIM/.vimrc (or _vimrc)
MS-DOS and Win32 $HOME/_vimrc or $VIM/_vimrc
Amiga s:.vimrc or $VIM/.vimrc
(info taken from vim's :help vimrc command output).