I am using vim to learn latex and have a big vimrc config provided below. Now I wanna get rid of live latex preview function for some reasons. The problem is even if I comment out the vim-latex-live-preview plugin and do :VundleUpdate in vim, the live preview function is still there. Have no idea where it comes from.
"Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" ================ General Config ====================
set textwidth=0 "make paste into vim easier
set number "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
set history=1000 "Store lots of :cmdline history
set showcmd "Show incomplete cmds down the bottom
set showmode "Show current mode down the bottom
set gcr=a:blinkon0 "Disable cursor blink
set visualbell "No sounds
set autoread "Reload files changed outside vim
set hlsearch "high light search result
set cc=80 "get a red line reminder at column count 80
set clipboard="*" "the origina
"set clipboard+=unnamed "make vim register plus sys register,
set cursorline "get a line under where cursor point
set gcr=a:block-blinkon0 "禁止光标闪烁
"set lines=35 columns=80 "maybe a better choice
" autocmd BufWritePost $MYVIMRC source $MYVIMRC " 让配置变更立即生效
set incsearch " 开启实时搜索功能
set ignorecase " 搜索时大小写不敏感
syntax on "turn on syntax highlighting
set hidden " buffers exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
set nowrap "no, Wrap lines, I find nowrap is suitable for small screen
set linebreak "Wrap lines at convenient points
set guifont=Monaco:h16 " For MacVim
" set list listchars=tab:\ \ ,trail:· " Display tabs and trailing spaces visually
" guivim config {{{
" 禁止显示滚动条
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
" 禁止显示菜单和工具条
set guioptions-=m
set guioptions-=T
" }}}
"Lang & Encoding {{{
set fileencodings=utf-8,gbk2312,gbk,gb18030,cp936
set encoding=utf-8
set langmenu=zh_CN
let $LANG = 'en_US.UTF-8'
"language messages zh_CN.UTF-8
" }}}
" Turn Off Swap Files {{{
set noswapfile
set nobackup
set nowb
" }}}
" Persistent Undo {{{
" Keep undo history across sessions, by storing in file.
" Only works all the time.
" NOT WORKING: Didnt work when yanked right out of YADR
"silent !mkdir ~/.vim/backups > /dev/null 2>&1
"set undodir=~/.vim/backups
"set undofile
" }}}
" Indentation {{{
set autoindent
set smartindent
set smarttab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
set foldmethod=indent
filetype plugin on
filetype indent on
" }}}
" Completion {{{
set wildmode=list:longest
" vim 自身命令行模式智能补全
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
set wildignore+=*vim/backups*
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=vendor/rails/**
set wildignore+=vendor/cache/**
set wildignore+=*.gem
set wildignore+=log/**
set wildignore+=tmp/**
set wildignore+=*.png,*.jpg,*.gif
" }}}
" Scrolling {{{
set scrolloff=8 "Start scrolling when we're 8 lines away from margins
set sidescrolloff=15
set sidescroll=1
" }}}
" Change leader to a comma because the backslash is too far away
" That means all \x commands turn into ,x
" The mapleader has to be set before vundle starts loading all
" the plugins.
let mapleader=","
" ========================================
" Vim plugin configuration
" ========================================
"
" This file contains the list of plugin installed using vundle plugin manager.
" Once you've updated the list of plugin, you can run vundle update by issuing
" the command :BundleInstall from within vim or directly invoking it from the
" command line with the following syntax:
" vim --noplugin -u vim/vundles.vim -N "+set hidden" "+syntax on" +BundleClean! +BundleInstall +qall
" Filetype off is required by vundle
filetype off
" set the runtime path to include Vundle and initialize
"set rtp+=~/.vim/bundle/vundle/
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" let Vundle manage Vundle (required)
"Plugin 'gmarik/vundle'
Plugin 'VundleVim/Vundle.vim'
"""" MY VUNDLES """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" HEAVILY/MOSTLY taken from https://github.com/skwp/dotfiles
" Make Git pervasive in vim ( :Gblame + Glog + many more )
" TODO: figure out how to use
Plugin 'tpope/vim-fugitive'
" file navigator gutter
Plugin 'scrooloose/nerdtree.git'
" build a more useful statusline
Plugin 'Lokaltog/vim-powerline'
" awesome syntax highlighting
Plugin 'scrooloose/syntastic'
" a complex autocomplete tool developed by a developer in google research project
Plugin 'Valloric/YouCompleteMe'
" Command+T replacement (ctrl+P)
"Plugin 'kien/ctrlp.vim'
" Rails plugin ( :A mapping! )
"Plugin 'tpope/vim-rails.git'
" comment lines out (gc in visual mode)
"Plugin 'tomtom/tcomment_vim.git'
" Make it look amazing
Plugin 'altercation/vim-colors-solarized'
" Pimped out bar at the bottom of current buffer
"Plugin 'bling/vim-airline.git"
" Highlights class names + methods more brightly
" Handy for seeing syntax shape before your eyes
"Plugin 'vim-scripts/TagHighlight.git'
" Search everything in the current dir via :Ack
"Plugin 'mileszs/ack.vim'
" Enable Markdown Preview + GitHub flavored markdown
"Plugin 'jtratner/vim-flavored-markdown.git'
"Plugin 'nelstrom/vim-markdown-preview'
" TODO: Figure out how to do indents intelligently
"Plugin 'austintaylor/vim-indentobject'
" Open a shell within vim via :ConqueTerm
"Plugin 'skwp/vim-conque'
" Syntax highlighting for .bats files
"Plugin 'rosstimson/bats.vim'
" Open up a bash shell quickly in the current window
"map <Leader>s <esc>:ConqueTermSplit bash<cr>
" Make Ctrl+w o, function with toggle niceness
"Plugin 'vim-scripts/ZoomWin'
" requires exuberant ctags
Plugin 'majutsushi/tagbar'
" A Vim Plugin for Lively Previewing LaTeX PDF Output
" Plugin 'xuhdev/vim-latex-live-preview'
" plugin taglist
" from http://www.vim.org/scripts/script.php?script_id=273`:w
" comment out for the test of vundle
"let Tlist_Show_One_File=1
"let Tlist_Exit_OnlyWindow=1
" let g:winManagerWindowLayout='FileExplorer|TagList'
"nmap wm :WMToggle<cr>
set completeopt=longest,menu
" file browser, using vim command Tlist...
Plugin 'vim-scripts/taglist.vim'
" ctags for vim
Plugin 'szw/vim-tags'
" Eclim make eclipse run in handless mode o
" visit http://eclim.org/
" Plugin 'dansomething/vim-eclim'
" java complete2
Plugin 'artur-shaik/vim-javacomplete2'
" Eclim
Plugin 'dansomething/vim-eclim'
" indentLine
Plugin 'Yggdroot/indentLine'
" tabular
Plugin 'godlygeek/tabular'
"""" END OF VUNDLE PLUGINS """""""""""""""""""""""""""""""""""""""""""""""""""""
call vundle#end()
filetype plugin indent on " required!
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
"=================== PLUGIN CONFIG ==========================================
" tagbar {{{
" 设置 tagbar 子窗口的位置出现在主编辑区的左边
let tagbar_left=1
" 设置显示/隐藏标签列表子窗口的快捷键。速记:identifier list by tag
"nnoremap <Leader>ilt :TagbarToggle<CR>
nnoremap <Leader>il :TagbarToggle<CR>
" 设置标签子窗口的宽度
let tagbar_width=32
" tagbar 子窗口中不显示冗余帮助信息
let g:tagbar_compact=1
" 设置 ctags 对哪些代码标识符生成标签
let g:tagbar_type_cpp = {
\ 'kinds' : [
\ 'c:classes:0:1',
\ 'd:macros:0:1',
\ 'e:enumerators:0:0',
\ 'f:functions:0:1',
\ 'g:enumeration:0:1',
\ 'l:local:0:1',
\ 'm:members:0:1',
\ 'n:namespaces:0:1',
\ 'p:functions_prototypes:0:1',
\ 's:structs:0:1',
\ 't:typedefs:0:1',
\ 'u:unions:0:1',
\ 'v:global:0:1',
\ 'x:external:0:1'
\ ],
\ 'sro' : '::',
\ 'kind2scope' : {
\ 'g' : 'enum',
\ 'n' : 'namespace',
\ 'c' : 'class',
\ 's' : 'struct',
\ 'u' : 'union'
\ },
\ 'scope2kind' : {
\ 'enum' : 'g',
\ 'namespace' : 'n',
\ 'class' : 'c',
\ 'struct' : 's',
\ 'union' : 'u'
\ }
\ }
" }}}
" vim-latex-live-preview {{{
"let g:livepreview_previewer = 'open -a Preview'
" }}}
" java-complete {{{
autocmd FileType java setlocal omnifunc=javacomplete#OmniCppComplete
" }}}
" drawing from altercation/vim-colors-solarized {{{
" syntax enable
" set background=dark
"colorscheme solarized
"color solarized
" }}}
" NERDTree {{{
" Reveal current file in NERDTree with <Leader>r
map <Leader>r <esc>:NERDTreeFind<cr>
" 使用 NERDTree 插件查看工程文件。设置快捷键,速记:file list
nmap <Leader>fl :NERDTreeToggle<CR>
" 设置NERDTree子窗口宽度
let NERDTreeWinSize=32
" 设置NERDTree子窗口位置
let NERDTreeWinPos="right"
" 显示隐藏文件
let NERDTreeShowHidden=1
" NERDTree 子窗口中不显示冗余帮助信息
let NERDTreeMinimalUI=1
" 删除文件时自动删除文件对应 buffer
let NERDTreeAutoDeleteBuffer=1
" }}}
" SYNTASTIC {{{
"mark syntax errors with :signs
let g:syntastic_enable_signs=1
"automatically jump to the error when saving the file
let g:syntastic_auto_jump=0
" set to 1 to show the error list automatically
let g:syntastic_auto_loc_list=0
"don't care about warnings
"let g:syntastic_quiet_warnings=0
let g:syntastic_quiet_messages = {'level': 'warnings'}
" }}}
" YCM {{{
" YCM 补全菜单配色
" 菜单
highlight Pmenu ctermfg=3 ctermbg=0 guifg=#005f87 guibg=#EEE8D5
" 选中项
highlight PmenuSel ctermfg=2 ctermbg=3 guifg=#AFD700 guibg=#106900
" 补全功能在注释中同样有效
let g:ycm_complete_in_comments=1
" 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示
let g:ycm_confirm_extra_conf=0
" 开启 YCM 标签补全引擎
let g:ycm_collect_identifiers_from_tags_files=1
" 引入 C++ 标准库tags
set tags+=/data/misc/software/misc./vim/stdcpp.tags
" YCM 集成 OmniCppComplete 补全引擎,设置其快捷键
inoremap <leader>c <C-x><C-o>
" 补全内容不以分割子窗口形式出现,只显示补全列表
set completeopt-=preview
" 从第一个键入字符就开始罗列匹配项
let g:ycm_min_num_of_chars_for_completion=1
" 禁止缓存匹配项,每次都重新生成匹配项
let g:ycm_cache_omnifunc=0
" 语法关键字补全
let g:ycm_seed_identifiers_with_syntax=1
" set python semantic completion
let g:ycm_python_binary_path = 'python'
" here: https://stackoverflow.com/questions/6361733/jump-to-next-error-code-highlighted-in-red
" and here: https://unix.stackexchange.com/questions/174738/youcompleteme-vim-extension-how-to-jump-to-next-error
" try to figure out how to jump to errors with YCM
let g:ycm_always_populate_location_list=1
" }}}
"
" javacomplete2 {{{
autocmd FileType java setlocal omnifunc=javacomplete#Complete
" }}}
" ====== Make tabs be addressable via Apple+1 or 2 or 3, etc
" Use numbers to pick the tab you want (like iTerm)
" TODO: ??
map <silent> <D-1> :tabn 1<cr>
map <silent> <D-2> :tabn 2<cr>
map <silent> <D-3> :tabn 3<cr>
map <silent> <D-4> :tabn 4<cr>
map <silent> <D-5> :tabn 5<cr>
map <silent> <D-6> :tabn 6<cr>
map <silent> <D-7> :tabn 7<cr>
map <silent> <D-8> :tabn 8<cr>
map <silent> <D-9> :tabn 9<cr>
" ctags {{{
map <Leader>tt <esc>:TagbarToggle<cr>
" TODO later, get open tag in new tab working
" http://stackoverflow.com/questions/563616/vim-and-ctags-tips-and-tricks
" map <C-\>:tab split<CR>:exec("tag ".expand("<cword>"))<CR>
" map <A-]>:vsp <CR>:exec("tag ".expand("<cword>"))<CR>
" }}}
" Support for github flavored markdown
" via https://github.com/jtratner/vim-flavored-markdown
" with .md extensions
augroup markdown
au!
au BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown
augroup END
" =========================END OF PLUGIN CONFIG=================================
" Function {{{
" Remove trailing whitespace when writing a buffer, but not for diff files.
" From: Vigil
" #see http://blog.bs2.to/post/EdwardLee/17961
function! RemoveTrailingWhitespace()
if &ft != "diff"
let b:curcol = col(".")
let b:curline = line(".")
silent! %s/\s\+$//
silent! %s/\(\s*\n\)\+\%$//
call cursor(b:curline, b:curcol)
endif
endfunction
autocmd BufWritePre * call RemoveTrailingWhitespace()
" }}}
" make vim accept per project .vimrc
set exrc
set secure
Thanks to lcd047's comment, it's a build in function of vim called tex-conceal.
Related
When I run vim . to open up a folder I get the following error:
Error detected while processing VimEnter Auto commands for "*":
E492: Not an editor command: NERDTree .
Press ENTER or type command to continue
I don't understand where this is coming from since everything was working fine. I then tried adding other plugins and then the error was thrown. However I have NERDTree in my ~/.vimrc file. Here is what the file looks like.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:plug_shallow = 0 " disable shallow cloning
call plug#begin()
Plug 'airblade/vim-gitgutter' " shows a git diff in the gutter
Plug 'altercation/vim-colors-solarized' " precision colorscheme
Plug 'godlygeek/tabular' " text filtering and alignment
Plug 'janko-m/vim-test' " test runner
Plug 'phallstrom/vim-sailfish'
Plug 'scrooloose/nerdtree' " tree explorer
Plug 'sjl/gundo.vim' " graph your vim undo tree
Plug 'tpope/vim-commentary' " comment stuff out
Plug 'tpope/vim-endwise' " wisely add 'end' in ruby, endfunction/endif/more in vim script, etc
Plug 'tpope/vim-fugitive' " git wrapper
Plug 'tpope/vim-rails', { 'for': ['ruby'] } " ruby on rails power tools
Plug 'vim-ruby/vim-ruby', { 'for': ['ruby'] } " vim/ruby configuration
Plug 'tpope/vim-projectionist' " project configuration (file jumping)
Plug 'kana/vim-textobj-user' " create your own text objects
Plug 'nelstrom/vim-textobj-rubyblock' " custom text object for selecting ruby blocks
Plug 'tpope/vim-surround' " quoting/parenthesizing made simple
Plug 'chriskempson/base16-vim' " color schemes, https://chriskempson.github.io/base16/
Plug 'w0rp/ale' " asynchronous lint engine
Plug 'editorconfig/editorconfig-vim' " editorConfig plugin
Plug 'vim-airline/vim-airline' " status/tabline
Plug 'vim-airline/vim-airline-themes' " status/tabline themes
Plug 'pangloss/vim-javascript' " Javascript syntax
Plug 'mxw/vim-jsx' " react jsx syntax
Plug 'posva/vim-vue', { 'for': ['vue'] } " Vue.js syntax
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim' " A command-line fuzzy finder written in Go
Plug 'kien/rainbow_parentheses.vim', { 'for': ['clojure'] } " Better Rainbow Parentheses
Plug 'guns/vim-clojure-static', { 'for': ['clojure'] } " Meikel Brandmeyer's excellent Clojure runtime files
Plug 'tpope/vim-unimpaired' " pairs of handy bracket mappings
Plug 'tpope/vim-abolish' " easily search for, substitute, and abbreviate multiple variants of a word
Plug 'mechatroner/rainbow_csv' " highlighting columns in csv/tsv files
Plug 'slim-template/vim-slim' " slim syntax highlighting for vim
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set t_Co=256
set nocompatible " We're running Vim, not Vi!
set synmaxcol=500 " don't try to highlight long lines
compiler ruby " Enable compiler support for ruby
filetype plugin on
set background=dark
colorscheme default
set backspace=2
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
set nowrap
set nrformats=
set backupdir=$HOME/.vimbackup,.
set directory=$HOME/.vimswap,.
au FocusLost * :wa
set ignorecase
set smartcase
set scrolloff=2
set ttyfast
set hidden
set wildmenu
set wildmode=list:longest
nnoremap <leader>nt :NERDTreeToggle<enter>
source $VIMRUNTIME/macros/matchit.vim
" fzf
nnoremap <silent> <C-p> :Files<CR>
nnoremap <silent> <Leader>b :Buffers<CR>
" https://github.com/tpope/vim-commentary/commit/4dcfc318e0b02fdbb0c2d9ff77cf3562b46eea25
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
set updatetime=250
nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>T :TestSuite<CR>
set mouse=a
vnoremap <Leader>c "*y
noremap <Leader>v "*p
set nofixeol
set formatoptions+=j " Delete comment character when joining commented lines
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g'\"" | endif
let g:omni_sql_no_default_maps = 1 " disable SQL autocompletion entirely
" To ensure that EditorConfig plugin works well with Tim Pope's fugitive
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
" ALE - Asynchronous Lint Engine
let g:ale_lint_on_enter = 0 " no checks on open
let g:ale_lint_on_save = 1 " check on save
let g:ale_lint_on_text_changed = 1 " check on text change
let g:ale_lint_delay = 300 " millisecond delay before checking
" Airline
let g:airline_theme = 'base16' " theme
set laststatus=2 " always show airline
set noshowmode " hide default mode indicator
let g:airline_powerline_fonts = 1 " use powerline font
let g:airline#extensions#wordcount#enabled = 0 " disable word counting
let g:airline#extensions#whitespace#enabled = 0 " disable detection of whitespace errors
" Rubocop
let g:vimrubocop_config = '/path/to/rubocop.yml'
if filereadable($HOME."/.vimrc_local")
source $HOME/.vimrc_local
endif
let g:jsx_ext_required = 0 " JSX syntax in .js files
" open file splits in vsplit by default
:nnoremap <C-W>f :vertical wincmd f<CR>
" https://github.com/posva/vim-vue#how-can-i-use-existing-configurationplugins-in-vue-files
" autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css
au FileType clojure exe "RainbowParenthesesLoadRound" | RainbowParenthesesActivate
" open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" https://github.com/slim-template/vim-slim/issues/38#issuecomment-23760100
autocmd BufNewFile,BufRead *.slim setlocal filetype=slim
I re-installed NERDTree but however I still that error.
This question already has answers here:
error while running "source .vimrc"
(2 answers)
Closed 4 years ago.
I'm trying to configured Vim. However when I try to source .vimrc after having edit the file I get the following error:
$ source ~/.vimrc
-bash: let g:plug_shallow = 0 : command not found
-bash: /Users/stevenaguilar/.vimrc: line 4: syntax error near unexpected token ('
-bash: /Users/stevenaguilar/.vimrc: line 4:call plug#begin()'
I don't understand where is this error coming from. It throws the error on line call plug#begin() which is closed. Here is the full .vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:plug_shallow = 0 " disable shallow cloning
call plug#begin()
Plug 'airblade/vim-gitgutter' " shows a git diff in the gutter
Plug 'altercation/vim-colors-solarized' " precision colorscheme
Plug 'godlygeek/tabular' " text filtering and alignment
Plug 'janko-m/vim-test' " test runner
Plug 'phallstrom/vim-sailfish'
Plug 'scrooloose/nerdtree' " tree explorer
Plug 'sjl/gundo.vim' " graph your vim undo tree
Plug 'tpope/vim-commentary' " comment stuff out
Plug 'tpope/vim-endwise' " wisely add 'end' in ruby, endfunction/endif/more in vim script, etc
Plug 'tpope/vim-fugitive' " git wrapper
Plug 'tpope/vim-rails', { 'for': ['ruby'] } " ruby on rails power tools
Plug 'vim-ruby/vim-ruby', { 'for': ['ruby'] } " vim/ruby configuration
Plug 'tpope/vim-projectionist' " project configuration (file jumping)
Plug 'kana/vim-textobj-user' " create your own text objects
Plug 'nelstrom/vim-textobj-rubyblock' " custom text object for selecting ruby blocks
Plug 'tpope/vim-surround' " quoting/parenthesizing made simple
Plug 'chriskempson/base16-vim' " color schemes, https://chriskempson.github.io/base16/
Plug 'w0rp/ale' " asynchronous lint engine
Plug 'editorconfig/editorconfig-vim' " editorConfig plugin
Plug 'vim-airline/vim-airline' " status/tabline
Plug 'vim-airline/vim-airline-themes' " status/tabline themes
Plug 'pangloss/vim-javascript' " Javascript syntax
Plug 'mxw/vim-jsx' " react jsx syntax
Plug 'posva/vim-vue', { 'for': ['vue'] } " Vue.js syntax
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim' " A command-line fuzzy finder written in Go
Plug 'kien/rainbow_parentheses.vim', { 'for': ['clojure'] } " Better Rainbow Parentheses
Plug 'guns/vim-clojure-static', { 'for': ['clojure'] } " Meikel Brandmeyer's excellent Clojure runtime files
Plug 'tpope/vim-unimpaired' " pairs of handy bracket mappings
Plug 'tpope/vim-abolish' " easily search for, substitute, and abbreviate multiple variants of a word
Plug 'mechatroner/rainbow_csv' " highlighting columns in csv/tsv files
Plug 'slim-template/vim-slim' " slim syntax highlighting for vim
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set t_Co=256
set nocompatible " We're running Vim, not Vi!
set synmaxcol=500 " don't try to highlight long lines
compiler ruby " Enable compiler support for ruby
filetype plugin on
set background=dark
colorscheme base16-oceanicnext
set backspace=2
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
set nowrap
set nrformats=
set backupdir=$HOME/.vimbackup,.
set directory=$HOME/.vimswap,.
au FocusLost * :wa
set ignorecase
set smartcase
set scrolloff=2
set ttyfast
set hidden
set wildmenu
set wildmode=list:longest
nnoremap <leader>nt :NERDTreeToggle<enter>
source $VIMRUNTIME/macros/matchit.vim
" fzf
nnoremap <silent> <C-p> :Files<CR>
nnoremap <silent> <Leader>b :Buffers<CR>
" https://github.com/tpope/vim-commentary/commit/4dcfc318e0b02fdbb0c2d9ff77cf3562b46eea25
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
set updatetime=250
nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>T :TestSuite<CR>
set mouse=a
vnoremap <Leader>c "*y
noremap <Leader>v "*p
set nofixeol
set formatoptions+=j " Delete comment character when joining commented lines
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g'\"" | endif
let g:omni_sql_no_default_maps = 1 " disable SQL autocompletion entirely
" To ensure that EditorConfig plugin works well with Tim Pope's fugitive
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
" ALE - Asynchronous Lint Engine
let g:ale_lint_on_enter = 0 " no checks on open
let g:ale_lint_on_save = 1 " check on save
let g:ale_lint_on_text_changed = 1 " check on text change
let g:ale_lint_delay = 300 " millisecond delay before checking
" Airline
let g:airline_theme = 'base16' " theme
set laststatus=2 " always show airline
set noshowmode " hide default mode indicator
let g:airline_powerline_fonts = 1 " use powerline font
let g:airline#extensions#wordcount#enabled = 0 " disable word counting
let g:airline#extensions#whitespace#enabled = 0 " disable detection of whitespace errors
if filereadable($HOME."/.vimrc_local")
source $HOME/.vimrc_local
endif
let g:jsx_ext_required = 0 " JSX syntax in .js files
" open file splits in vsplit by default
:nnoremap <C-W>f :vertical wincmd f<CR>
" https://github.com/posva/vim-vue#how-can-i-use-existing-configurationplugins-in-vue-files
" autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css
au FileType clojure exe "RainbowParenthesesLoadRound" | RainbowParenthesesActivate
" open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" https://github.com/slim-template/vim-slim/issues/38#issuecomment-23760100
autocmd BufNewFile,BufRead *.slim setlocal filetype=slim
It looks like you're sourcing your .vimrc from bash. It's not a bash script. Instead, you should source it from inside Vim:
:source ~/.vimrc
:source $MYVIMRC
Or just restart Vim.
It looks like you are trying to source your .vimrc from bash as you would your .bashrc, but this is a vim-specific settings file. vim will naturally source your .vimrc when you run it, if it is in the right place in your path (which it seems to be based on the error message).
If you are already in vim and have made some changes to the .vimrc or wish to load another one, you can source it from within vim by going into command mode and calling source
:source ~/.vimrc
Recently I figured out that pressing CTRL-U locks/freezes vim in insert mode. The only CTRL-C helps to get it back. Terminal version and gvim have the same behaviour. Only in virtual console mode (CTRL-ALT-F1) the C-U works properly. Here is my .vimrc:
" This must be first, because it changes other options as a side effect.
set nocompatible
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
imap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
" Options
" =========================================================
colorscheme gruvbox
let g:gruvbox_contrast_dark = 'normal'
set background=dark
set t_Co=256
" spelling
set spell spelllang=ru_yo,en_us
set spellsuggest=10
set keymap=russian-jcukenwin
set iminsert=0
set imsearch=0
" backup
set writebackup " backup on write
set nobackup " keep a backup file
set undofile " keep an undo file
set swapfile " keep a swap file
" directories
" set autochdir
set backupdir=~/.vim/tmp/backup//
set undodir=~/.vim/tmp/undo//
set directory=~/.vim/tmp/swp//
" active editor
set nowrap
set nu
set backspace=indent,eol,start " backspacing over everything in im
set ruler " show the cursor position all the time
" cmd
set history=50 " keep 50 lines of command line history
set showcmd " display incomplete commands
" search
set ignorecase " ignore case using a search pattern.
set smartcase " override 'ignorecase' when pattern has upper case.
set incsearch " do incremental searching
" tab
" set tabstop=2 shiftwidth=2 noexpandtab " n-column tab
set tabstop=2 shiftwidth=2 expandtab " n-space character tab
" window
set splitbelow
set splitright
set winminheight=0
" folding settings
set foldmethod=indent " fold based on indent
set foldnestmax=10 " deepest fold is 10 levels
set nofoldenable " dont fold by default
set foldlevel=1 " this is just what i use
" invisible chars
set list " don't show invisible characters.
set listchars=tab:.\ ,trail:~,extends:>,precedes:<,eol:\ "¬
set nohidden " unload buffer when no longer shown in window.
set laststatus=2 " Display vim-lightline
" indent, cursor, width
set cursorline " Highlight the screen line of the cursor.
set colorcolumn=72 " Columan to highlight.
set autoindent " Automatically set the indent of a new line.
set textwidth=80
set completeopt=menuone,longest ",preview prevents immediate complete
" tab
set switchbuf=usetab " use window or tabs to find selected buff
" windows
set noea " fix window size after closing others
" sessions (^blank,help)
set sessionoptions=buffers,curdir,folds,help,options,tabpages,winsize
" Autocmd
" =========================================================
au BufReadPost *.tmpl set syntax=html
" Mappings
" =========================================================
" source and update file
nmap <F5> :so ~/.vimrc<CR>
nmap <leader>e :e<CR>
" copy filepath
nmap <silent> <F4> :let #+=expand("%:p")<CR>
" buffers
nmap <F2> :ls<CR>:b
nmap <c-w><c-t> :tabnew<CR>
nmap <c-w><c-e> :tab sp<CR>
nmap <c-w><c-b>n :tabnew %<Bar>:bNext<Bar><CR>
nmap <c-w><c-b><c-b> :bw %<CR>
nmap <c-w><c-b>w :bw! %<CR>
nmap <c-w><c-b>a :tab ball<CR>
" sessions
nmap <silent> <leader>ss :wa<Bar>exe "mksession! " . v:this_session<CR>
nmap <leader>sr :so .session.vim<CR>
nmap <leader>sc :msk .session.vim<CR>
" quit
nmap <leader>qd :qa!<CR> " quit & discard changes
nmap <leader>qq :xa<CR> " quit & write if changed
nmap <leader>qs <leader>s<leader>qd
" new vertical window
nmap <c-w><c-n> :vnew<CR>
" tab movement and switching
nmap <c-l> :tabnext<CR>
nmap <c-h> :tabprevious<CR>
nmap <c-j> :tabmove -1<CR>
nmap <c-k> :tabmove +1<CR>
" search and replace
nmap <leader>c :let #/=""<CR>
" trailing spaces
nmap <silent> <leader>dt mq:%s/\s\+$//e<Bar>:let #/=""<CR>`q:delm q<CR>
" update, write
nmap <leader>u <leader>dt:update<CR>
nmap <leader>w <leader>dt:write<CR>
cmap w!! w !sudo tee > /dev/null %
" window manipulation
nmap <c-w>== :set ead=ver ea noea<CR>
nmap <c-w>=- :set ead=hor ea noea<CR>
" shell
nmap <space> :sh<CR>
" Plugins
" =========================================================
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go'
Plug 'mattn/emmet-vim'
Plug 'itchyny/lightline.vim'
Plug 'sheerun/vim-polyglot'
Plug 'scrooloose/syntastic'
call plug#end()
" Lightline.vim
let g:lightline = {
\ 'colorscheme': 'jellybeans',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'filename', 'readonly', 'modified' ] ] },
\}
" Syntastic
" let g:syntastic_sass_checkers = ["sassc"]
" Netrw
nmap <leader>tr <Plug>NetrwRefresh
map <leader>tf :Ntree<CR>
map <silent> <leader>f <S-CR>
let g:netrw_liststyle=3
let g:netrw_banner=0
let g:netrw_mousemaps=0
let g:netrw_chgwin=1 " open files in left window by default
" let g:netrw_keepdir=0
" let g:netrw_silent= 1
" fire up the sidebar
nmap <silent> <C-#> :rightbelow 25vs<CR>:e .<CR>
" vim-go
" disable fmt on save
let g:go_fmt_autosave = 0
" format with goimports instead of gofmt
let g:go_fmt_command = "goimports"
" additional highlight
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
" YouCompleteMe
let g:ycm_confirm_extra_conf=0
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_min_num_of_chars_for_completion=1
" Emmet-vim
let g:user_emmet_leader_key='<c-m>'
" Formats the statusline
" set statusline=%f " file name
" set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
" set statusline+=%{&ff}] "file format
" set statusline+=%y "filetype
" set statusline+=%h "help file flag
" set statusline+=%m "modified flag
" set statusline+=%r "read only flag
"
" set statusline+=\ %= " align left
" set statusline+=Line:%l/%L[%p%%] " line X of Y [percent of file]
" set statusline+=\ Col:%c " current column
" set statusline+=\ Buf:%n " Buffer number
" set statusline+=\ [%b][0x%B]\ " ASCII and byte code under cursor
" Miscellaneous
" =========================================================
nmap <leader>t :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
:set guioptions-=m "remove menu bar
:set guioptions-=T "remove toolbar
:set guioptions-=r "remove right-hand scroll bar
:set guioptions-=L "remove left-hand scroll bar
It's quite big, but the only one mapping related with C-U: imap <C-U> <C-G>u<C-U>. What's going on?
I've copied your vimrc and used it. Same effect. It's this line:
imap <C-U> <C-G>u<C-U>
which apparently causes a recursion. When commented out, <C-u> erases back to start-of-line.
Given the problem that #Jens found... you, Timur, might want to try
inoremap <c-u> <c-g>u<c-u>
That will prevent remapping (ie. an infinite recursion) from taking place.
I am using vim with YouCompleteMe plugin, which is awesome except the fact it has no support of unicode completion as is written here and here.
I switched to vim from sublime text and i am completely excited with vim. But the fact i dont get autocompletion of words which contains (or wholly constructed) with non latin characters drives me crazy because i am writing a lot of documents in latex and use russian keyboard layout with vim's langmap option.
I dont know if there is any way to get autocompletion of my native locale (russian) words.
I played a little with encodings and tried cp1251 as fileencoding and encoding but get no result.
Could you tell me if it is possible ?
The default vim's complete (which is triggered by pressing <C-x> <C-n>) is working but it is very inconvenient to press such a long combination when you need to complete several hundreds words in a day.
I dont want any complicated completion as i understand that it is nearly impossible with the current implementation of vim. I want identifier based completion -- complete with words that were already typed in current document.
I googled but found nothing.
I would greatly appreciate any information related to my problem.
Here is my .vimrc:
set nocompatible " be iMproved, required
filetype off " required
if &diff
" no options at all for vimdiff
else
"=====================================================
" Vundle settings
"=====================================================
" set the runtime path to include Vundle and initialize
"
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim' " let Vundle manage Vundle, required
"---------=== Code/project navigation ===-------------
Plugin 'scrooloose/nerdtree' " Project and file navigation
Plugin 'majutsushi/tagbar' " Class/module browser
"------------------=== Other ===----------------------
Plugin 'tpope/vim-surround' " Parentheses, brackets, quotes, XML tags, and more
Plugin 'kien/ctrlp.vim' " Convenient navigation
Plugin 'vim-scripts/diffchanges.vim' " difchanges in file
"--------------=== Snippets support ===---------------
Plugin 'SirVer/ultisnips' " Track the engine.
Plugin 'honza/vim-snippets' " snippets repo
"--------------=== Completion ===---------------
" Plugin 'Shougo/neocomplete' " completion
Plugin 'Valloric/YouCompleteMe' " completion
Plugin 'shvechikov/vim-keymap-russian-jcukenmac' " alternative keymap for mac
Plugin 'ervandew/supertab' " man c-n to tab for compatibility YCM with UltiSnips
"------------------=== Latex ===---------------------
Plugin 'lervag/vim-latex' " latex module
"------------------=== Colors ===---------------------
Plugin 'altercation/vim-colors-solarized' " solarized colors
"---------------=== Languages support ===-------------
" --- Python ---
Plugin 'klen/python-mode' " Python mode (docs, refactor, lints, highlighting, run and ipdb and more)
" Plugin 'mitsuhiko/vim-jinja' " Jinja support for vim
" Plugin 'mitsuhiko/vim-python-combined' " Combined Python 2/3 for Vim
call vundle#end() " required
"====================================================
" YouCompleteMe and UltiSnip fix settings
"=====================================================
" show completion even in comments
let g:ycm_complete_in_comments = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_collect_identifiers_from_tags_files = 1
" set omnifunc=syntaxcomplete#Complete
let g:ycm_filetype_blacklist = {}
" add language keywords to list of autocomplete
let g:ycm_seed_identifiers_with_syntax = 1
" if one want to use ctags he should assure oneself that
" >> ctags --version print Exuberant Ctags, see :help YouCompleteMe
let g:ycm_key_list_select_completion=['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion=['<C-p>', '<Up>']
let g:UltiSnipsExpandTrigger="<Tab>"
let g:UltiSnipsJumpForwardTrigger="<Tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"
let g:UltiSnipsSnippetsDir = "~/.vim/bundle/vim-snippets/UltiSnips"
"====================================================
" Latex settings
"=====================================================
" Enable latex
let g:latex_enabled = 1
" complete closing brace on label editing
" let g:latex_complete_close_braces = 1
" jump to the first error on quickfix window is open
let g:latex_quickfix_autojump = 1
" ignore any warnings
let g:latex_quickfix_ignore_all_warnings = 1
" which warnings should be ignored
let g:latex_quickfix_ignored_warnings = [ ]
" \ 'Underfull',
" \ 'Overfull',
" \ 'specifier changed to',
" \ ]
" callback
let g:latex_latexmk_callback = 1
" set viewer and configure forward search with <leader>ls combination
let g:latex_view_general_viewer = 'open -a Skim'
let g:latex_view_general_viewer = '/Applications/Skim.app/Contents/MacOS/Skim'
"====================================================
" General settings
"=====================================================
" do not close files when type :e filename
set hidden
filetype on
filetype plugin on
filetype plugin indent on
set backspace=indent,eol,start
" aunmenu Help.
" aunmenu Window.
let no_buffers_menu=1
set mousemodel=popup
set ruler
set completeopt-=preview
set gcr=a:blinkon0
if has("gui_running")
set cursorline
endif
set ttyfast
syntax on
if has("gui_running")
" GUI? Устанавливаем тему и размер окна
set background=dark
set lines=40 columns=125
let g:solarized_termcolors=256
colorscheme solarized
if has("mac")
set guifont=Consolas:h16
set fuoptions=maxvert,maxhorz
else
set guifont=Ubuntu\ Mono\ derivative\ Powerline\ 15
endif
else
" colorscheme solarized
endif
set switchbuf=useopen
set enc=utf-8 " utf-8 по дефолту в файлах
set ls=2 " всегда показываем статусбар
set incsearch " инкреминтируемый поиск
set hlsearch " подсветка результатов поиска
set nu " показывать номера строк
set relativenumber " относительная нумерация строк
" autocmd InsertEnter * :set number
" autocmd InsertLeave * :set relativenumber
set scrolloff=5 " 5 строк при скролле за раз
set ignorecase
set smartcase " case searching tunning
" hide panels
set guioptions-=m " меню
set guioptions-=T " тулбар
set guioptions-=r " скроллбары
" tab tunning
set tabstop=4
set shiftwidth=4
set expandtab
set showmatch " set show matching parenthesis
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
" disable colorcolumn that is set up nowhere ??
highlight ColorColumn ctermbg=DarkGray
" all spaces at the end of lines highlight with DarkGray color
highlight WhitespaceEOL ctermbg=8 guibg=#073642
match WhitespaceEOL /\s\+$/
" delete all spaces at the end of lines
autocmd BufWritePre * :%s/\s\+$//e
"----------========= Folding ==========------------
" remap keys zj an zk to jump to next closed fold
nnoremap <silent> <leader>zj :call NextClosedFold('j')<cr>
nnoremap <silent> <leader>zk :call NextClosedFold('k')<cr>
function! NextClosedFold(dir)
let cmd = 'norm!z' . a:dir
let view = winsaveview()
let [l0, l, open] = [0, view.lnum, 1]
while l != l0 && open
exe cmd
let [l0, l] = [l, line('.')]
let open = foldclosed(l) < 0
endwhile
if open
call winrestview(view)
endif
endfunction
"folding settings
" set foldmethod=indent "fold based on indent
" set foldnestmax=10 "deepest fold is 10 levels
" set nofoldenable "dont fold by default
" set foldlevel=1 "this is just what i use
" toggle fold with space rather then inconvenient za
"nnoremap <space> za
" highlight text on dark when exceeding 80 column
augroup vimrc_autocmds
autocmd!
autocmd FileType ruby,python,javascript,c,cpp highlight Excess ctermbg=DarkGrey guibg=Black
autocmd FileType ruby,python,javascript,c,cpp match Excess /\%80v.*/
autocmd FileType ruby,python,javascript,c,cpp set nowrap
augroup END
" show NERDTree on F1 pressed
map <F1> :NERDTreeToggle<CR>
" ignore theese extensions
let NERDTreeIgnore=['\~$', '\.pyc$', '\.pyo$', '\.class$', 'pip-log\.txt$', '\.o$']
" set switching to Russian keyboard by pressing C-^
" the combination is awful but it is default and we will use it
" set keymap=russian-jcukenmac
" " the option for being able to press CTRL-N or CTRL-P to complete from
" set iminsert=0
" set imsearch=0
" highlight lCursor guifg=NONE guibg=Cyan
" задаём проверку правописания
set langmap=йq,цw,уe,кr,еt,нy,гu,шi,щo,зp,х[,ъ],фa,ыs,вd,аf,пg,рh,оj,лk,дl,э'
set langmap+=яz,чx,сc,мv,иb,тn,ьm,ю.,ЙQ,ЦW,УE,КR,ЕT,НY,ГU,ШI,ЩO,ЗP,Х{,Ъ},ФA,ЫS
set langmap+=ВD,АF,ПG,РH,ОJ,ЛK,ДL,ЯZ,ЧX,СC,МV,ИB,ТN,ЬM,Ж:,Б<,Ю>,]`,[~
set langmap+=\\;*,\\,^
set spelllang=ru_ru,en_us
" get suggestions on spelling
set complete+=kspell
" check spell by default
set spell
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :nohl<CR><C-l>
" wrap long lines to the new lines
set wrap
" do not break words in the middle
set linebreak
"====================================================
" Here would be useful comments on how vim executes,
" behaves, some useful features, links, etc.
"=====================================================
"
" 1. To see where all keymaps appears to be on the FS:
" :echo globpath(&rtp, "keymap/*.vim")
" 2. See all mappings: :help index
"
"
endif
I'm really eager to include the following in my .vimrc file:
inoremap <Tab> <C-x><C-u>
If I set it within a buffer (via :inoremap <Tab> <C-x><C-u>) it works exactly as I'd hoped.
But, if I place it in my .vimrc, it doesn't seem to be acknowledged at all.
I've attached my .vimrc below. A few things:
Other changes to the .vimrc file are picked up, so it's not the wrong file
Have tried adding at the very bottom of the .vimrc & still doesn't work, so it's not being overwritten
Any ideas appreciated. Many thanks.
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Word complete
" :autocmd BufEnter * call DoWordComplete()
" let g:WC_min_len = 4
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
map j gj
map k gk
set showmatch " Show matching brackets
set mat=5 " Bracket blinking
set noerrorbells " No noise
" Ruby autocomplete
" Autocomplete behaviour
set completeopt=longest,menuone
open omni completion menu closing previous if open and opening new menu without changing the text
inoremap <expr> <C-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') .
\ '<C-x><C-o><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>'
" open user completion menu closing previous if open and opening new menu without changing the text
inoremap <expr> <S-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') .
\ '<C-x><C-u><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>'
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
" highlight Pmenu ctermbg=238 gui=bold "improve autocomplete menu color
" Colours
highlight Pmenu ctermfg=6 ctermbg=238 guibg=grey30
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" if has("vms")
" set nobackup " do not keep a backup file, use versions instead
" else
" set backup " keep a backup file
" endif
" Set backupdir to tmp
" Do not let vim create <filename>~ backup files
set nobackup
" set nowritebackup
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" Set tab to 2 spaces
set ts=2
set shiftwidth=2
" Ignore case
set ignorecase
set smartcase
" Menu autocomplete
set wildmode=longest,list
set wildmenu
" Call pathogen
call pathogen#infect()
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Turn syntax highlighting on (Added by John Bayne, 18/08/2012)
syntax on
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
" My customisations
" No backup files
set nobackup
set nowritebackup
set noswapfile
" Whitespace identifier
:highlight ExtraWhitespace ctermbg=darkgreen guibg=lightgreen
:match ExtraWhitespace /\s\+$/
" Colour options
" color codeschool
" set guifont=Monaco:h12
" let g:NERDTreeWinPos = "right"
" set guioptions-=T " Removes top toolbar
" set guioptions-=r " Removes right hand scroll bar
" set go-=L " Removes left hand scroll bar
" autocmd User Rails let b:surround_{char2nr('-')} = "<% \r %>" " displays <% %> correctly
" :set cpoptions+=$ " puts a $ marker for the end of words/lines in cw/c$ commands
" Tab behaviour for ultisnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
inoremap <Tab> <C-x><C-u>
In this case, :scriptnames, while useful, is not the best way to see where a mapping was last set.
:verbose map <tab>
is a lot more precise.
Maybe another script is overwriting it after your .vimrc is read.
You can use :scriptnames to see what files are read on startup.