我的vim 配置(ycm没有生效)备注以后研究

Posted 情愿为你,画地为牢。

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了我的vim 配置(ycm没有生效)备注以后研究相关的知识,希望对你有一定的参考价值。

" An example for a vimrc file.
" author holen
" data     2016-6

" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

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

" In many terminal emulators the mouse works just fine, thus enable it.
set mouse=a

" 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
set incsearch
endif

" detection filetype
filetype off
" loading filetype plugin
"filetype plugin on
" load indent files, to automatically do language-dependent indenting.
" filetype indent on
" python utomatic insufficiency
":inoremap ( ()<ESC>i
":inoremap ) <c-r>=ClosePair())<CR>
":inoremap { {}<ESC>i
":inoremap } <c-r>=ClosePair(})<CR>
":inoremap [ []<ESC>i
"":inoremap ] <c-r>=ClosePair(])<CR>
"":inoremap " ""<ESC>i
"":inoremap  ‘‘<ESC>i
function! ClosePair(char)
    if getline(".")[col(.)-1] == a:char
        return "\<Right>"
    else
        return a:char
    endif
endfunction

" auto add file header
autocmd BufNewFile *.py 0r ~/.vim/.vim_head_template/vim_python
autocmd BufNewFile *.py ks|call FileName()|s
autocmd BufNewFile *.py ks|call CreatedTime()|s
autocmd BufNewFile * normal G

fun FileName()
    if line("$") > 10
        let l = 10
    else
        let l = line("$")
    endif
    exe "1,".l."g/File Name:.*/s/File Name:.*/File Name: ".expand("%")
endfun
 
fun CreatedTime()
    if line("$") > 10
        let l = 10
    else
        let l = line("$")
    endif
    exe "1,".l."g/Created Time:.*/s/Created Time:.*/Created Time: ".strftime("%Y-%m-%d %T")
endfun

" other general settings
set nu
color elflord
winpos 225 225
set lines=35 columns=115
colo peachpuff
set autoindent 
" set guifont=Lucida_Console:h12
set tabstop=4
set shiftwidth=4
set autoindent
set showmatch
set autowrite
set magic
set confirm
set history=500
set noswapfile
set whichwrap+=<,>,h,l
set clipboard+=unnamed
set noautoindent
set nosmartindent
set nocindent


"allow folder
set foldenable
set foldmethod=manual

" set encode
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,GB18030,cp936,big5,euc-jp,euc-kr,latin1"

" moved window mapping
nmap <C-H> <C-W>h "control+h to left 
nmap <C-J> <C-W>j  "control+j to down 
nmap <C-K> <C-W>k "control+k to up 
nmap <C-L> <C-W>l  "control+l to right 
" Keyboard mapping
" None

" vundle Plug-in settings
" filetype off   " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle, required


" original repos on github(On Github repository site non-vim-scripts plugins)
"                Bundle tpope/vim-fugitive
"  vim-scripts repos(vim-scripts plugins)
"                  Bundle FuzzyFinder 
"  other
"                  Bundle git://git.wincent.com/command-t.git

" folder views
Bundle scrooloose/nerdtree.git
" html and css
Bundle mattn/emmet-vim.git
" code completion
Bundle Valloric/YouCompleteMe
" right tagbar
Bundle majutsushi/tagbar
"YouComplete use jedi to Completion python
Bundle davidhalter/jedi-vim
" like sourceInsight
" Bundle wesleyche/SrcExpl

filetype plugin indent on

let NERDTreeWinPos=left
"mapping open or close  nerdteree
map <silent> <F2> :NERDTreeToggle<CR> 
" mapping tagbarToggle
map <silent> <F3> :TagbarToggle<CR>
" let TagbarToggleWinWidth=1
" mapping SrcExplToggle
"map <silent> <F4> :SrcExplToggle<CR>
" Brief help
 " :BundleList - list configured plugins " :PluginInstall(!)
 " :BundleSearch(!) foo - search(or refresh cache first) for foo
 " :BundleInstall (update) plugins
 " :BundleClean(!)      - confirm (or auto-approve) removal of unused


" hide .pyc
let NERDTreeIgnore=[\.pyc$, \~$] "ignore files in NERDTree

" Ycm
let mapleader = ","
let g:mapleader = ","
autocmd FileType python set omnifunc=pythoncomplete#Complete  
autocmd FileType python setlocal completeopt-=preview
autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS  
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags  
autocmd FileType css set omnifunc=csscomplete#CompleteCSS  
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags  
autocmd FileType php set omnifunc=phpcomplete#CompletePHP  
autocmd FileType c set omnifunc=ccomplete#Complete  

 

以上是关于我的vim 配置(ycm没有生效)备注以后研究的主要内容,如果未能解决你的问题,请参考以下文章

vim安装 YCM 过程记录

为啥我的vim配置文件(.vimrc)只有添加sudo的情况下才生效。我的系统是Ubuntu的

Ubuntu18.04安装Vim-plu与YCM

YCM安装与配置

youcompleteme 自动补全

VIM 代码自动补全, YouCompleteMe安装及配置