My buffers are not working for some reason. When I click <leader>b it says
Not an editor command: Buffers
This is my .vimrc file:
set nocompatible " required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" required
Plugin 'VundleVim/Vundle.vim'
" General
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-commentary'
" User Interface
Plugin 'altercation/vim-colors-solarized'
Plugin 'JarrodCTaylor/vim-256-color-schemes'
Plugin 'JarrodCTaylor/vim-reflection'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'bling/vim-airline'
" Programming
Plugin 'mattn/emmet-vim'
Plugin 'tpope/vim-surround'
Plugin 'leafgarland/typescript-vim'
" Languages
Plugin 'pangloss/vim-javascript'
Plugin 'davidhalter/jedi-vim'
" all plugins must be above this line!!
call vundle#end() " required
filetype plugin indent on " required
" non-plugin stuff after this line!!
" Map leader to ,
let mapleader=','
set t_Co=256
syntax on
set nobackup " Don't constantly write backup files
set noswapfile " Ain't nobody got time for swap files
set noerrorbells " Don't beep
set nowrap " Do not wrap lines
set shiftwidth=4 " Number of spaces to use for each step of indent
set showcmd " Display incomplete commands in the bottom line of the screen
set tabstop=4 " Number of spaces that a <Tab> counts for
set undolevels=1000 " Never can be too careful when it comes to undoing
set hidden " Don't unload the buffer when we switch between them. Saves undo history
set visualbell " Visual bell instead of beeping
set wildmenu " Command-line completion in an enhanced mode
set shell=bash " Required to let zsh know how to run things on the command line
set ttimeoutlen=50 " Fix delay when escaping from insert with Esc
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
set showbreak=↪\
set synmaxcol=256
set scrolloff=3
set clipboard=unnamed
au BufNewFile,BufRead *.json set ft=javascript
" Status line / visual configuration
syntax enable
set t_Co=256
set t_ut=
hi clear
hi String ctermfg=81 ctermbg=NONE cterm=NONE guifg=#5fd7ff guibg=NONE gui=NONE
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white
set laststatus=2 " Make the second to last line of vim our status line
let g:airline_theme='understated' " Use the custom theme I wrote
let g:airline_left_sep='' " No separator as they seem to look funky
let g:airline_right_sep='' " No separator as they seem to look funky
let g:airline#extensions#branch#enabled = 0 " Do not show the git branch in the status line
let g:airline#extensions#syntastic#enabled = 1 " Do show syntastic warnings in the status line
let g:airline#extensions#tabline#show_buffers = 0 " Do not list buffers in the status line
let g:airline_section_x = '' " Do not list the filetype or virtualenv in the status line
let g:airline_section_y = '[R%04l,C%04v] [LEN=%L]' " Replace file encoding and file format info with file position
let g:airline_section_z = '' " Do not show the default file position info
let g:airline#extensions#virtualenv#enabled = 0
autocmd BufReadPost quickfix nnoremap <buffer> <CR> :.cc<CR>
autocmd BufReadPost quickfix nnoremap <buffer> o :.cc<CR>
nnoremap <Leader>W :%s/\s\+$//<CR>:let #/=''<CR>
let g:syntastic_check_on_open=1 " check for errors when file is loaded
let g:syntastic_loc_list_height=5 " the height of the error list defaults to 10
let g:syntastic_python_checkers = ['flake8'] " sets flake8 as the default for checking python files
let g:syntastic_javascript_checkers = ['jshint'] " sets jshint as our javascript linter
let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' }
let g:syntastic_mode_map={ 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['html', 'handlebars'] }
set tags=./.ctags,.ctags;
let g:NERDTreeMapJumpNextSibling = ''
let g:NERDTreeMapJumpPrevSibling = ''
let g:gundo_preview_bottom = 1
let g:markdown_fold_style = 'nested'
let g:markdown_fenced_languages = ['python', 'sh', 'vim', 'javascript', 'html', 'css', 'c', 'sql']
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
let g:indent_guides_exclude_filetypes = ['help', 'nerdtree']
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=238
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=249
function! s:DeleteBuffer()
let line = getline('.')
let bufid = line =~ '\[\d\+\*No Name\]$' ? str2nr(matchstr(line, '\d\+'))
\ : fnamemodify(line[2:], ':p')
exec "bd" bufid
exec "norm \<F5>"
endfunction
" NERDTree configuration
let g:NERDTreeChDirMode=2
let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let g:NERDTreeShowBookmarks=1
let g:nerdtree_tabs_focus_on_files=1
let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
let g:NERDTreeWinSize = 50
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite
nnoremap <silent> <F2> :NERDTreeFind<CR>
nmap <F3> :NERDTreeToggle<CR>
" buffer configuration
nnoremap <silent> <leader>b :Buffers<CR>
" close buffer
nnoremap <leader>c :bd<CR>
Can someone tell me if I missed something? I will also accept tips on upgrading my vimrc file so feel free to give any tips :) But I mainly want to fix this problem. So please tell me what I should remove or add to get this working again. It was working before. This really appeared suddenly.
Maybe a typo, see :h buffers
Please change following line (lowercase the B in :Buffers)
nnoremap <silent> <leader>b :Buffers<CR>
to
nnoremap <silent> <leader>b :buffers<CR>
Related
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
So I am using the omnisharp-vim plugin along with syntastic to show my errors in my web project. When I load a cs file up it is reporting all these errors. When I open the same project up in VS 2015 I do not see the same errors
MyProject.Web\Controllers\DashboardController.cs|11 col 52 error| 'MyProjectAuthorizeAttribute' is not a known identifier
MyProject.Web\Controllers\DashboardController.cs|11 col 54 error| Error: ?
MyProject.Web\Controllers\DashboardController.cs|12 col 51 error| 'BaseController' is not a known identifier
MyProject.Web\Controllers\DashboardController.cs|14 col 27 error| 'ILogger' is not a known identifier
MyProject.Web\Controllers\DashboardController.cs|15 col 44 error| 'ILoggerFactory' is not a known identifier
Maybe I am missing some configuration in my .vimrc file?
" General -----------------------
set nocompatible " Makes vim better
scriptencoding utf-8 " Setting everything to UTF-8
set encoding=utf-8
set history=256
set timeoutlen=250
set clipboard+=unnamed
let g:autotagTagsFile = ".git/tags"
set tags=./.git/tags,tags,./.git/coffeetags,coffeetags;$HOME
set nobackup
set nowritebackup
set noswapfile
set hlsearch
set ignorecase
set smartcase
set incsearch
" turn off search highlight
nnoremap <leader><space> :nohlsearch<CR>
let mapleader = ','
let maplocalleader = ' '
let g:netrw_banner = 0
" Formatting --------------------
set nowrap
set tabstop=4
set softtabstop=4
set shiftwidth=4
set backspace=indent
set backspace+=eol
set backspace+=start
set autoindent
set cindent
set indentkeys-=0#
set cinkeys-=0#
set cinoptions=:s,ps,ts,cs
set cinwords=if,else,while,do
set cinwords+=for,switch,case
set linespace=4
set listchars=tab:>.,trail:.,extends:\#,nbsp:.
set list
" Plugins ------------------------
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'OmniSharp/omnisharp-vim'
Plugin 'tpope/vim-dispatch'
Plugin 'scrooloose/syntastic'
Plugin 'Shougo/unite.vim'
Plugin 'xero/sourcerer.vim'
Plugin 'bling/vim-airline'
Plugin 'airblade/vim-gitgutter'
Plugin 'ap/vim-css-color'
Plugin 'groenewege/vim-less'
Plugin 'hail2u/vim-css3-syntax'
Plugin 'kien/ctrlp.vim'
Plugin 'jasoncodes/ctrlp-modified.vim'
Plugin 'kaneshin/ctrlp-git-log'
Plugin 'jiangmiao/auto-pairs'
Plugin 'lokaltog/vim-easymotion'
Plugin 'majutsushi/tagbar'
Plugin 'mattn/ctrlp-git'
Plugin 'tacahiroy/ctrlp-funky'
Plugin 'mattn/emmet-vim'
Plugin 'mtscout6/rainbow_parentheses.vim'
Plugin 'mtscout6/vim-ctags-autotag'
Plugin 'mtscout6/vim-tagbar-css'
Plugin 'scrooloose/nerdtree'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-git'
Plugin 'tpope/vim-markdown'
Plugin 'tpope/vim-surround'
call vundle#end()
filetype plugin indent on
" Rainbow
map <leader>rt :RainbowParenthesesToggle<CR>
map <leader>r( :RainbowParenthesesLoadRound<CR>
map <leader>r[ :RainbowParenthesesLoadSquare<CR>
map <leader>r{ :RainbowParenthesesLoadBraces<CR>
map <leader>r< :RainbowParenthesesLoadChevrons<CR>
" File Type Settings --------------------
" Markdown editing
autocmd Filetype markdown setlocal wrap
autocmd Filetype markdown setlocal linebreak
autocmd Filetype markdown setlocal nolist
autocmd Filetype markdown setlocal columns=80
autocmd Filetype markdown setlocal tw=80
autocmd Filetype markdown setlocal wm=4
" GVIM Options -----------------------
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
" Visual ------------------------
syntax on
set showmatch
if has('gui_running')
set guifont=InputMono:h14
colorscheme sourcerer
if has('mac')
set noantialias
endif
endif
set novisualbell
set noerrorbells
set vb t_vb=
set laststatus=2
" Airline Settings
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" Default
let g:airline#extensions#tmuxline#enabled = 0
" Presentation
"let g:airline#extensions#tmuxline#enabled = 1
" Ctrl-P settings
let g:ctrlp_working_path_mode = 'r'
let g:ctrlp_extensions = ['tag', 'buffertag', 'line', 'funky']
", 'git-log', 'git_branch', 'git_files', 'modified']
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git|bower_components'
map <leader>t :CtrlP<CR>
map <leader>gs :CtrlPGitFiles<CR>
map <leader>gb :CtrlPGitBranch<CR>
map <leader>gl :CtrlPGitLog<CR>
map <leader>gm :CtrlPModified<CR>
" ctrlp-modified
map <Leader>m :CtrlPModified<CR>
map <Leader>M :CtrlPBranch<CR>
" Tagbar settings
map <F8> :TagbarToggle<CR>
" Emmet settings
imap <C-e> <C-y>,
" Multiple Cursor Settings
let g:multi_cursor_use_default_mapping=0
let g:multi_cursor_start_key='<leader>m'
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" Git Gutter Settings
highlight clear SignColumn
map ]h <Plug>GitGutterNextHunk
map [h <Plug>GitGutterPrevHunk
map <leader>hv <Plug>GitGutterPreviewHunk
map <Leader>hs <Plug>GitGutterStageHunk
map <Leader>hr <Plug>GitGutterRevertHunk
" NERD Tree Settings
map <TAB> :NERDTreeToggle<CR>
map <leader>ff :NERDTreeFind<CR>
let NERDTreeShowHidden=1
let NERDTreeIgnore=[]
" Syntastic Settings
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
"let g:syntastic_<filetype>_checkers = ['omnisharp']
let g:syntastic_cs_checkers = ['syntax', 'semantic', 'issues']
" Omnisharp settings
let g:OmniSharp_server_type = 'roslyn'
let g:OmniSharp_selector_ui = 'unite'
let g:OmniSharp_selector_ui = 'ctrlp'
let g:OmniSharp_timeout = 1
set noshowmatch
set completeopt=longest,menuone,preview
set splitbelow
augroup omnisharp_commands
autocmd!
"Set autocomplete function to OmniSharp (if not using YouCompleteMe completion plugin)
autocmd FileType cs setlocal omnifunc=OmniSharp#Complete
" Synchronous build (blocks Vim)
"autocmd FileType cs nnoremap <F5> :wa!<cr>:OmniSharpBuild<cr>
" Builds can also run asynchronously with vim-dispatch installed
autocmd FileType cs nnoremap <leader>b :wa!<cr>:OmniSharpBuildAsync<cr>
" automatic syntax check on events (TextChanged requires Vim 7.4)
autocmd BufEnter,TextChanged,InsertLeave *.cs SyntasticCheck
" Automatically add new cs files to the nearest project on save
autocmd BufWritePost *.cs call OmniSharp#AddToProject()
"show type information automatically when the cursor stops moving
autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation()
"The following commands are contextual, based on the current cursor position.
autocmd FileType cs nnoremap gd :OmniSharpGotoDefinition<cr>
autocmd FileType cs nnoremap <leader>fi :OmniSharpFindImplementations<cr>
autocmd FileType cs nnoremap <leader>ft :OmniSharpFindType<cr>
autocmd FileType cs nnoremap <leader>fs :OmniSharpFindSymbol<cr>
autocmd FileType cs nnoremap <leader>fu :OmniSharpFindUsages<cr>
"finds members in the current buffer
autocmd FileType cs nnoremap <leader>fm :OmniSharpFindMembers<cr>
" cursor can be anywhere on the line containing an issue
autocmd FileType cs nnoremap <leader>x :OmniSharpFixIssue<cr>
autocmd FileType cs nnoremap <leader>fx :OmniSharpFixUsings<cr>
autocmd FileType cs nnoremap <leader>tt :OmniSharpTypeLookup<cr>
autocmd FileType cs nnoremap <leader>dc :OmniSharpDocumentation<cr>
"navigate up by method/property/field
autocmd FileType cs nnoremap <C-K> :OmniSharpNavigateUp<cr>
"navigate down by method/property/field
autocmd FileType cs nnoremap <C-J> :OmniSharpNavigateDown<cr>
augroup END
nnoremap <leader><space> :OmniSharpGetCodeActions<cr>
vnoremap <leader><space> :call OmniSharp#GetCodeActions('visual')<cr>
" rename with dialog
nnoremap <leader>nm :OmniSharpRename<cr>
nnoremap <F2> :OmniSharpRename<cr>
" rename without dialog - with cursor on the symbol to rename... ':Rename newname'
command! -nargs=1 Rename :call OmniSharp#RenameTo("<args>")
" Force OmniSharp to reload the solution. Useful when switching branches etc.
nnoremap <leader>rl :OmniSharpReloadSolution<cr>
nnoremap <leader>cf :OmniSharpCodeFormat<cr>
" Load the current .cs file to the nearest project
nnoremap <leader>tp :OmniSharpAddToProject<cr>
" (Experimental - uses vim-dispatch or vimproc plugin) - Start the omnisharp server for the current solution
nnoremap <leader>ss :OmniSharpStartServer<cr>
nnoremap <leader>sp :OmniSharpStopServer<cr>
" Add syntax highlighting for types and interfaces
nnoremap <leader>th :OmniSharpHighlightTypes<cr>
"Don't ask to save when changing buffers (i.e. when jumping to a type definition)
set hidden
probably VS dont use the same checkers as syntastic ,
run the comand :SyntasticInfo
and it will return what checker it is using them you can find why is those errors comming up and how to make you program pass the syntax checker
obs i dont know visual studio but most of your error are is not a known identifier
maybe is because it is defined in other file and VS checks it but not syntastic checker
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 know this has already been discussed, but the proposed solution is not working for me.
I have this in my .vimrc:
autocmd! BufWritePost .vimrc nested source $MYVIMRC
Since I read that the correct way to source .vimrc inside an autocmd is using autocmd-nested.
Still, everytime I save it I lose colors in powerline
Edit:
here is my .vimrc
filetype off
set rtp+=~/.vim/vundle.git/
call vundle#rc()
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1
let g:ctrlp_working_path_mode = 'ra'
" Bundles
"
" original repos on github
"Bundle 'vim-scripts/taglist.vim'
Bundle 'majutsushi/tagbar'
"Bundle 'joonty/vim-phpqa.git'
"Bundle 'joonty/vim-phpunitqf'
Bundle 'joonty/vdebug'
" Php
Bundle 'sumpygump/php-documentor-vim'
Bundle 'sophacles/vim-processing'
Bundle 'nelstrom/vim-visual-star-search'
Bundle 'Lokaltog/powerline'
Bundle 'spolu/dwm.vim'
Bundle 'tpope/vim-unimpaired'
Bundle 'airblade/vim-gitgutter'
Bundle 'kien/ctrlp.vim'
Bundle 'wikitopian/hardmode'
Bundle 'tpope/vim-fugitive'
Bundle 'sbl/scvim'
Bundle 'vim-scripts/bufexplorer'
Bundle 'aaronbieber/quicktask'
Bundle 'vim-scripts/The-NERD-Commenter'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-surround'
Bundle 'vim-scripts/HTML-AutoCloseTag'
Bundle 'scrooloose/nerdtree'
"Bundle 'scrooloose/syntastic'
Bundle 'vim-scripts/css_color.vim'
" Color schemes
Bundle 'tomasr/molokai'
Bundle 'altercation/vim-colors-solarized'
Bundle 'vim-scripts/OOP-javascript-indentation'
let g:gitgutter_enabled = 0
set nocompatible "Don't be compatible with vi
" Enable filetype plugin
filetype indent on
filetype plugin on
" Set to auto read when a file is changed from the outside
set autoread
set t_Co=16
set background=dark
set number "Show line numbering
set numberwidth=1 "Use 1 col + 1 space for numbers
" With a map leader it's possible to do extra key combinations
let mapleader = ","
let g:mapleader = ","
" Toggle NERDTree
map <leader>n :NERDTreeToggle<CR>
set backupdir=~/.vim/backup " where to put backup files
set directory=~/.vim/temp " where to put swap files
" Fast saving
nmap <leader>w :w!<cr>
" Fast editing of the .vimrc
map <leader>e :e $MYVIMRC<cr>
" When .vimrc is edited, reload it
augroup MyAutoCmd
autocmd!
augroup END
autocmd MyAutoCmd BufWritePost $MYVIMRC nested source $MYVIMRC
"au! BufWritePost .vimrc nested source %
set title
" Remap esc key
inoremap jk <esc>
" work more logically with wrapped lines
noremap j gj
noremap k gk
set smartcase " search case sensitive if caps on
set showcmd " Display what command is waiting for an operator
autocmd BufNewFile,BufRead /*apache* setfiletype apache
autocmd BufNewFile,BufRead /*lighttpd*.conf setfiletype lighty
autocmd BufNewFile,BufRead {.,_}vimrc set foldmethod=marker
" PhpDocumentor
au BufRead,BufNewFile *.php inoremap <buffer> <leader>p :call PhpDoc()<CR>
au BufRead,BufNewFile *.php nnoremap <buffer> <leader>p :call PhpDoc()<CR>
au BufRead,BufNewFile *.php vnoremap <buffer> <leader>p :call PhpDocRange()<CR>
" Nicer highlighting of completion popup
highlight Pmenu guibg=brown gui=bold
set scrolloff=7 "Set 7 lines to the cursors when moving vertical
set wildmenu "Autocomplete features in the status bar
set ruler "Always show current position
set cmdheight=2 "The commandbar height
set hidden "Change buffer without saving
" Backspae config
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
set ignorecase "Search is case insensitive
set hlsearch "Highlight matches to the search
set incsearch "Show best match so far
set magic "Set magic on for regular expressions
set showmatch "Show matching bracets when text indicator is over them
set mat=2 "How many tenths of a second to blink
" No sound on errors
set noerrorbells
set novisualbell
set t_vb=
" Colors and fonts {{{1
set term=screen-256color
syntax enable "Enable syntax hl
syntax on "Enable syntax hl
"colorscheme molokai
"let g:solarized_termcolors=256
colorscheme solarized
set guifont=Envy\ Code\ R\ for\ Powerline
set encoding=utf-8
filetype plugin on
"set guifont=Inconsolata\ for\ Powerline\
let g:Powerline_symbols="fancy"
" Text, tab and indent related {{{1
set expandtab "Transform tabs into spaces
set shiftwidth=4 "sw 4 spaces (used on auto indent)
set shiftwidth=4 "sw 4 spaces (used on auto indent)
set tabstop=4 "4 spaces as a tab for bs/del
set smarttab
set wrap linebreak tw=80 wm=0 "Wrap lines
set ai "Auto indent
set si "Smart indent
" }}}1
" Moving around, tabs and buffers {{{1
" Move to previous and next buffer
:nmap <C-n> :bnext<CR>
:nmap <C-p> :bprev<CR>
" Map space to / (search) and c-space to ? (backwards search)
map <space> /
map <c-space> ?
map <silent> <leader><cr> :noh<cr>
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Mappings to access buffers (don't use "\p" because a
" delay before pressing "p" would accidentally paste).
" ,l : list buffers
" ,b ,f ,g : go back/forward/last-used
" ,1 ,2 ,3 : go to buffer 1/2/3 etc
nnoremap <Leader>l :ls<CR>
nnoremap <Leader>b :bp<CR>
nnoremap <Leader>f :bn<CR>
nnoremap <Leader>g :e#<CR>
nnoremap <Leader>1 :1b<CR>
nnoremap <Leader>2 :2b<CR>
nnoremap <Leader>3 :3b<CR>
nnoremap <Leader>4 :4b<CR>
nnoremap <Leader>5 :5b<CR>
nnoremap <Leader>6 :6b<CR>
nnoremap <Leader>7 :7b<CR>
nnoremap <Leader>8 :8b<CR>
nnoremap <Leader>9 :9b<CR>
nnoremap <Leader>0 :10b<CR>
" Close the current buffer. Bclose defined below.
" dovrebbe già esistere in bufkill.vim
" map <leader>bd :Bclose<cr>
" Use the arrows to do something useful
map <right> :bn<cr>
map <left> :bp<cr>
" MiniBufExplorer settings
let g:miniBufExplModSelTarget = 1
let g:miniBufExplorerMoreThanOne = 2
let g:miniBufExplModSelTarget = 0
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplMapWindowNavVim = 1
" Change directory to the file I'm editing
"autocmd BufEnter * lcd %:p:h
" When pressing <leader>cd switch to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>
" Function to close buffer?
command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")
if buflisted(l:alternateBufNum)
buffer #
else
bnext
endif
if bufnr("%") == l:currentBufNum
new
endif
if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
endfunction
" Specify the behavior when switching between buffers
try
set switchbuf=usetab
set stal=2
catch
endtry
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" Always hide the statusline
set laststatus=2
" Format the statusline
set statusline=\ %F%m%r%h\ %w\ \ [%Y]\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c
"set statusline=%F%m%w\ Line:\ %l\/%L[%p%%]\ Col:\ %c\ Buf:\ #%n\ [%Y]\ [\%03.3b]\[\%02.2B]
function! CurDir()
let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")
return curdir
endfunction
" tab labels show the filename without path(tail)
set guitablabel=%N/\ %t\ %M
""" Windows
if exists(":tab") " Try to move to other windows if changing buf
set switchbuf=useopen,usetab
else " Try other windows & tabs if available
set switchbuf=useopen
endif
"""" Messages, Info, Status
set shortmess+=a " Use [+] [RO] [w] for modified, read-only, modified
set report=0 " Notify me whenever any lines have changed
set confirm " Y-N-C prompt if closing with unsaved changes
" we don't want to edit these type of files
set wildignore=*.o,*.obj,*.bak,*.exe,*.pyc,*.swp
"""" Coding
set history=1000 " 1000 Lines of history
set showfulltag " Show more information while completing tags
" taglist plugin settings
"nnoremap <silent> <F8> :TlistToggle<CR>
let Tlist_Exit_OnlyWindow = 1 "exit if taglist is last window open
let Tlist_Show_One_File = 1 "only show tags for current buffer
let Tlist_Enable_Fold_Column = 0 "no fold column (only showing one file)
" OmniCppComplete
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
let OmniCpp_MayCompleteDot = 1 " autocomplete after .
let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menuone,menu,longest,preview
let g:sparkupNextMapping = '<c-x>'
" SuperTab settings
let g:SuperTabDefaultCompletionType = '<c-x><c-o>'
""""" Folding
set foldmethod=syntax " By default, use syntax to determine folds
set foldlevelstart=99 " All folds open by default
" Function to highlight character beyond column 79
" activate it with ,h
nnoremap <leader>h :call ToggleOverLengthHighlight()<CR>
let g:overlength_enabled = 0
" set the highlight color
highlight OverLength ctermbg=red guibg=red
function! ToggleOverLengthHighlight()
if g:overlength_enabled == 0
match OverLength /\%79v.*/
let g:overlength_enabled = 1
echo 'OverLength highlighting turned on'
else
match
let g:overlength_enabled = 0
echo 'OverLength highlighting turned off'
endif
endfunction
" in visual mode press Ctrl r to start substituting text
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
" PHP Code Sniffer binary (default = "phpcs")
let g:phpqa_codesniffer_cmd='vendor/bin/phpcs'
" PHP Mess Detector binary (default = "phpmd")
let g:phpqa_messdetector_cmd='vendor/bin/phpmd'
set relativenumber
" important
" moving around, searching and patterns
" tags
" displaying text
" syntax, highlighting and spelling
" multiple windows
" multiple tab pages
" terminal
" using the mouse
" printing
" messages and info
" selecting text
" editing text
" tabs and indenting
" folding
" diff mode
" mapping
" toggle the tag list
nmap <Leader>tl :TlistToggle<CR>
" reading and writing files
" the swap file
" command line editing
" executing external commands
" running make and jumping to errors
" language specific
" multi-byte characters
" various
" TagList options
" set the names of flags
let tlist_php_settings = 'php;c:class;f:function;d:constant;p:property'
" close all folds except for current file
let Tlist_File_Fold_Auto_Close = 1
" make tlist pane active when opened
let Tlist_GainFocus_On_ToggleOpen = 1
" width of window
let Tlist_WinWidth = 60
" close tlist when a selection is made
let Tlist_Close_On_Select = 1
" show the prototype
let Tlist_Display_Prototype = 1
" show tags only for current buffer
let Tlist_Show_One_File = 1
" Taglist variables
" Display function name in status bar:
let g:ctags_statusline=1
" Automatically start script
let generate_tags=1
" Displays taglist results in a vertical windows:
let Tlist_Use_Horiz_Window=0
" Shorter commands to toggle Taglist display
nnoremap TT :TlistToggle<CR>
map <F4> :TlistToggle<CR>
" Various Taglist display config:
let Tlist_Use_Right_Windows = 1
let Tlist_Compact_Format = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_File_Fold_Auto_Close = 1
" Ctags options
nmap <Leader>tf :call CtagsFind(expand('<cword>'))<CR>
com! -nargs=+ Tf :call CtagsFind("<args>")
" split window and search for tag
nmap <Leader>ts :exe('stj '.expand('<cword>'))<CR>
set tags=tags;/
" open new tab and search for tag
"
fun! CtagsFind(keyword)
tabe
exe "tj ".a:keyword
endfunction
" TagBar
nmap <F8> :TagbarToggle<CR>
" CtrlP
let g:ctrlp_map = ',t'
nnoremap <silent> ,t :CtrlP<CR>
Your autocmd will be appended to your vim events.
You need handle reload with using augroup.
augroup MyAutoCmd
autocmd!
autocmd MyAutoCmd BufWritePost $MYVIMRC nested source $MYVIMRC
augroup END
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.