Ai
1 Star 0 Fork 0

南寻/vim

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.vimrc 6.78 KB
一键复制 编辑 原始数据 按行查看 历史
南寻 提交于 2017-04-16 21:51 +08:00 . 更新 .vimrc
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
"
" " Add all your plugins here (note older versions of Vundle used Bundle
" instead of Plugin)
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
set shortmess=atI " 启动的时候不显示那个援助乌干达儿童的提示
winpos 5 5
set go=
set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离
autocmd InsertLeave * se nocul " 用浅色高亮当前行
set cursorline " 突出显示当前行
set magic " 设置魔术
set syntax=on
set autoindent
set tabstop=4
set softtabstop=4
set history=1000
set langmenu=zh_CN.UTF-8
colorscheme monokai
autocmd BufNewFile *.py,*.cc,*.sh,*.java exec ":call SetTitle()"
"新建.py,.cc,.java,.sh,
""定义函数SetTitle,自动插入文件头
function SetTitle()
"如果文件类型为.sh文件
if &filetype == 'python'
call setline(1,"\#!/usr/bin/python")
call setline(2, "\#coding=utf8")
call setline(3, "\"\"\"")
call setline(4, "\# Author: cb")
call setline(5, "\# Created Time : ".strftime("%c"))
call setline(6, "")
call setline(7, "\# File Name: ".expand("%"))
call setline(8, "\# Description: Life is too short,Python as a song!")
call setline(9, "")
call setline(10, "\"\"\"")
call setline(11,"")
endif
if &filetype == 'java'
call setline(1, "//coding=utf8")
call setline(2, "/*************************************************************************")
call setline(3, "\ @Author: cb")
call setline(4, "\ @Created Time : ".strftime("%c"))
call setline(5, "")
call setline(6, "\ @File Name: ".expand("%"))
call setline(7, "\ @Description:")
call setline(8, "")
call setline(9, " ************************************************************************/")
call setline(10,"")
endif
if &filetype == 'sh'
call setline(1, "#!/bin/bash")
call setline(2, "#/*************************************************************************")
call setline(3, "\# @Author: cb")
call setline(4, "\# @Created Time : ".strftime("%c"))
call setline(5, "")
call setline(6, "\# @File Name: ".expand("%"))
call setline(7, "\# @Description: Life is too short!")
call setline(8, "")
call setline(9, "#************************************************************************/")
call setline(10,"")
endif
endfunc
" modify the last modified time of a file
"function SetLastModifiedTime(lineno)
" let modif_time = strftime("%c")
" if a:lineno == "-1"
" let line = getline(6)
" else
" let line = getline(a:lineno)
" endif
" if line =~ '^////\sLast Modified'
" let line = substitute( line,':\s\+.*\d\{4\}', ':'.modif_time, "" )
" else
" let line = '# Last Modified: '.modif_time
" endif
" if a:lineno == "-1"
" call setline(5, line)
" else
" call append(a:lineno, line)
" endif
"endfunction
map <F5> :Autopep8<CR> :w<CR> :call RunPython()<CR>
function RunPython()
let mp = &makeprg
let ef = &errorformat
let exeFile = expand("%:t")
setlocal makeprg=python\ -u
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
silent make %
copen
let &makeprg = mp
let &errorformat = ef
endfunction
" map the SetLastModifiedTime command automatically
"au BufWrite *.py,*.java call SetLastModifiedTime(-1)
set number
Plugin 'vim-scripts/indentpython.vim'
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
Plugin 'scrooloose/syntastic'
let python_highlight_all=1
Plugin 'nvie/vim-flake8'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'Valloric/YouCompleteMe'
Plugin 'Lokaltog/vim-powerline'
Plugin 'Yggdroot/indentLine'
Plugin 'jiangmiao/auto-pairs'
Plugin 'tell-k/vim-autopep8'
Plugin 'scrooloose/nerdcommenter'
"默认配置文件路径"
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
""打开vim时不再询问是否加载ycm_extra_conf.py配置"
let g:ycm_confirm_extra_conf=0
set completeopt=longest,menu
"python解释器路径"
let g:ycm_path_to_python_interpreter='/usr/bin/python'
""是否开启语义补全"
let g:ycm_seed_identifiers_with_syntax=1
"是否在注释中也开启补全"
let g:ycm_complete_in_comments=1
let g:ycm_collect_identifiers_from_comments_and_strings = 0
""开始补全的字符数"
let g:ycm_min_num_of_chars_for_completion=2
"补全后自动关机预览窗口"
let g:ycm_autoclose_preview_window_after_completion=1
"" 禁止缓存匹配项,每次都重新生成匹配项"
let g:ycm_cache_omnifunc=0
"字符串中也开启补全"
let g:ycm_complete_in_strings = 1
""离开插入模式后自动关闭预览窗口"
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
"回车即选中当前项"
inoremap <expr> <CR> pumvisible() ? '<C-y>' : '<CR>'
""上下左右键行为"
inoremap <expr> <Down> pumvisible() ? '\<C-n>' : '\<Down>'
inoremap <expr> <Up> pumvisible() ? '\<C-p>' : '\<Up>'
inoremap <expr> <PageDown> pumvisible() ? '\<PageDown>\<C-p>\<C-n>' : '\<PageDown>'
inoremap <expr> <PageUp> pumvisible() ? '\<PageUp>\<C-p>\<C-n>' : '\<PageUp>'
"F2开启和关闭树"
map <F2> :NERDTreeToggle<CR>
let NERDTreeChDirMode=1
"显示书签"
let NERDTreeShowBookmarks=1
"设置忽略文件类型"
let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
""窗口大小"
let NERDTreeWinSize=25
""
"缩进指示线"
let g:indentLine_char='┆'
let g:indentLine_enabled = 1
"autopep8设置"\\
let g:autopep8_disable_show_diff=1
let mapleader=','
map <F4> <leader>ci <CR>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/nanxun/vim.git
git@gitee.com:nanxun/vim.git
nanxun
vim
vim
master

搜索帮助