shenlian/poll_dev
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
"==================================================
" Filename: vimrc " Ubuntu下路径为/etc/vim/vimrc
" Author: shenlian
" Email: myswirl@163.com
" Created: 2014-3-24 21:12
"==================================================
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936 " 打开文件时会根据fileencodings选项来识别文件编码
set fileencoding=utf-8 " 保存新建文件时会根据fileencoding的设置编码来保存
set encoding=utf-8 " Vim的内部使用编码
set termencoding=utf-8 " Vim终端所使用的编码
"set encoding=prc
set guifont=Luxi\ Mono\ 14 " 设置字体,字体名称和字号
set tabstop=4 " 设置tab键的宽度
set backspace=2 " 设置退格键可用
set scrolloff=3 "设置光标上下保留的最小的行数
set nu " 显示行号
set nocompatible " 去掉兼容性bug,上下左右可以使用
"set vbt_vb= " vim进行编辑时,如果命令错误,会发出一个响声,该设置去掉响声
set wrap " 自动换行
"set nowrap " 不自动换行
set linebreak " 整词换行
set whichwrap=b,s,<,>,[,] " 光标从行首和行末时可以跳到另一行去
"set list " 显示制表符
"set listchars = tab:>-,trail:- " 将制表符显示为'>---',将行尾空格显示为'-'
"set listchars=tab:.\ ,trail:. " 将制表符显示为'. '
"set autochdir " 自动设置目录为正在编辑的文件所在的目录
set hidden " 没有保存的缓冲区可以自动被隐藏
set scrolloff=5 " scrolloff
set mouse=a
set cursorcolumn
set cursorline
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=blue guifg=white
"搜索忽略大小写
set ignorecase
" 在处理未保存或只读文件的时候,弹出确认
set confirm
"--------------------------------------------------------------------------------
" 查找/替换相关的设置
"--------------------------------------------------------------------------------
set hlsearch " 高亮显示搜索结果
set incsearch " 查询时非常方便,如要查找book单词,当输入到/b时,会自动找到
" 第一个b开头的单词,当输入到/bo时,会自动找到第一个bo开头的
" 单词,依次类推,进行查找时,使用此设置会快速找到答案,当你
" 找要匹配的单词时,别忘记回车
set gdefault " 替换时所有的行内匹配都被替换,而不是只有第一个
"--------------------自动查找----------------------------------"
"自动补全配置
" " 载入文件类型插件
filetype plugin on
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript 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
set nocp
set ofu=syntaxcomplete#Complete
runtime macros/matchit.vim
let b:match_words = &matchpairs
set completeopt=longest,menu
let g:SuperTabRetainCompletionType=2
let g:SuperTabDefaultCompletionType="<C-X><C-O>"
source /usr/share/vim/vim73/macros/matchit.vim
let g:pydiction_location = '~/.vim/after/complete-dict'
"defalut g:pydiction_menu_height == 15
"let g:pydiction_menu_height = 20
"-----------------------------------------------------"
"#######中括号 大括号 小括号 自动补全
: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 > <c-r>=ClosePair('>')<CR>
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
" "#######中括号 大括号 小括号 自动补全
"--------------------------------------------------------------------------------
" 状态栏相关的设置
"--------------------------------------------------------------------------------
set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]
set laststatus=2 " 总是显示状态行
set ruler " 在编辑过程中,在右下角显示光标位置的状态行
"--------------------------------------------------------------------------------
" 编程相关的设置
"--------------------------------------------------------------------------------
set completeopt=longest,menu " 关掉智能补全时的预览窗口
filetype plugin indent on " 加了这句才可以用智能补全
set tags=/home/server/workspace/tags
syn on " 打开语法高亮
set showmatch " 设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号
set smartindent " 智能对齐方式
set shiftwidth=4 " 换行时行间交错使用4个空格
set autoindent " 自动对齐
set ai! " 设置自动缩进
colorscheme molokai " 配色方案/usr/share/vim/vim73/colors
"--------------------------------------------------------------------------------
" 代码折叠
"--------------------------------------------------------------------------------
set foldmarker={,}
set foldmethod=syntax " maker syntax
set foldlevel=100 " Don't autofold anything (but I can still fold manually)
"set foldopen-=search " don't open folds when you search into them
"set foldopen-=undo " don't open folds when you undo stuff
"set foldcolumn=4 "
"--------------------------------------------------------------------------------
" 模仿MS Windows中的快捷键
"--------------------------------------------------------------------------------
vmap <C-c> "yy
vmap <C-x> "yd
"nmap <C-v> "yp
"vmap <C-v> "yp
nmap <C-a> ggvG$ "
"--------------------------------------------------------------------------------
" 窗口操作的快捷键
"--------------------------------------------------------------------------------
nmap wv <C-w>v " 垂直分割当前窗口
nmap wc <C-w>c " 关闭当前窗口
nmap ws <C-w>s " 水平分割当前窗口
"--------------------------------------------------------------------------------
" 模仿MS Windows中的保存命令: Ctrl+S
"--------------------------------------------------------------------------------
nmap <C-s> :w<CR>
imap <C-s> <Esc>:w<CR>
"----------taglist--------------"
"------------------------------------------------------------------------"
map <silent> <F2> :TlistToggle<cr>
let Tlist_Ctags_Cmd = '/usr/bin/ctags' "设定Linux系统中ctags程序的位置
let Tlist_Show_One_File=1 "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow=1 "如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Sort_Type = "name"
"let Tlist_Use_Right_Window = 0 "在右侧窗口中显示taglist窗口
"let Tlist_Use_SingleClick= 1 "
"缺省情况下,在双击一个tag时,才会跳到该tag定义的位置
"
"let Tlist_Auto_Open=1 "在启动VIM后,自动打开taglist窗口
"let Tlist_Process_File_Always=1
""taglist始终解析文件中的tag,不管taglist窗口有没有打开
"let Tlist_File_Fold_Auto_Close=1 "同时显示多个文件中的tag时,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来
"-------------ctags----------------------"
if has("ctags")
if filereadable("tags")
set tags=tags
endif
endif
nmap <F5> <Esc>:!ctags -R *<CR>
"------------------------------------------------------------------"
"----------------winManager----------------------------"
"""""""""""""""""""""""""""""""
"" winManager setting
"""""""""""""""""""""""""""""""
"设置界面分割
"
let g:winManagerWindowLayout = 'FileExplorer,BufExplorer|TagList'
let g:AutoOpenWinManager = 1
"设置winmanager的宽度,默认为25
let g:winManagerWidth = 30
"let g:winManagerMinHeight = 100
"定义打开关闭winmanager按键
let g:defaultExplorer = 0
nmap <C-W><C-F> :FirstExplorerWindow<cr>
nmap <C-W><C-B> :BottomExplorerWindow<cr>
nmap <silent> <F9> :WMToggle<cr>
"--------------------------------------------------------------"
"---------------MinBufExplorer-----------------------"
let g:bufExplorerMaxHeight=200
let g:bufExplorerMinHeight=150
let g:miniBufExplorerMoreThanOne=0
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:SuperTabDefaultCompletionType="context"
"-----------------------------------------------------
"----------------------zencoding 快捷键----------------------------"
"imap <silent> <C-e> <C-y>, "开启 不能用F8会有冲突
"-----------------------------------------------"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""新文件标题
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java,*.py exec ":call SetMyTitle()"
""定义函数SetTitle,自动插入文件头
func SetMyTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1,"\#!/bin/bash")
call append(line("."), "")
elseif &filetype == 'python'
call setline(1,"#!/usr/bin/env python")
call append(line("."),"# coding=utf-8")
call append(line(".")+1, "'''")
call append(line(".")+2, " File Name: ".expand("%"))
call append(line(".")+3, " Author: shenlian")
call append(line(".")+4, " Created Time: ".strftime("%c"))
call append(line(".")+5, "'''")
call append(line(".")+6, "")
" elseif &filetype == 'mkd'
" call setline(1,"<head><meta charset=\"UTF-8\"></head>")
else
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: ma6174")
call append(line(".")+2, " > Mail: ma6174@163.com ")
call append(line(".")+3, " > Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
if &filetype == 'cpp'
call append(line(".")+6, "#include<iostream>")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if &filetype == 'c'
call append(line(".")+6, "#include<stdio.h>")
call append(line(".")+7, "")
endif
" if &filetype == 'java'
" call append(line(".")+6,"public class ".expand("%"))
" call append(line(".")+7,"")
" endif
"新建文件后,自动定位到文件末尾
endfunc
"---------quickfix------------------"
nmap <F7> :cn<cr>
nmap <F6> :cp<cr>
"-------------------------------------------"
"---------------Enhanced Commentify--------------"
"Set mapleader
let mapleader = ","
let g:mapleader = ","
nmap <silent> <F3> ,x
vmap <silent> <F3> ,x
imap <silent> <F3> ,x
"----------------------------------------------------"
安装
sudo pip install -r requirements.txt