From 58b3f8beb5b2707a08c8cf2dfc09e25f8829e688 Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Wed, 1 Mar 2017 23:56:47 +0800 Subject: [PATCH] Fix vimrc - remove windows support - fix vundle url - add molokai plugin Signed-off-by: Ein Verne --- .vim/bundle/Vundle.vim | 2 +- .vim/startup/vundle_vimrc | 3 +- .vimrc | 21 +-- README.md | 25 +-- _vimrc | 310 -------------------------------------- python_vimrc | 90 ----------- vundle_vimrc | 45 ------ 7 files changed, 12 insertions(+), 484 deletions(-) delete mode 100644 _vimrc delete mode 100644 python_vimrc delete mode 100644 vundle_vimrc diff --git a/.vim/bundle/Vundle.vim b/.vim/bundle/Vundle.vim index 0ee36b2..f6cc062 160000 --- a/.vim/bundle/Vundle.vim +++ b/.vim/bundle/Vundle.vim @@ -1 +1 @@ -Subproject commit 0ee36b26e127cda512a8f2852a59e5a5f374c87f +Subproject commit f6cc06238d5ac888ddfc514f80392f44cb2e21ac diff --git a/.vim/startup/vundle_vimrc b/.vim/startup/vundle_vimrc index a50eab1..fb9064f 100644 --- a/.vim/startup/vundle_vimrc +++ b/.vim/startup/vundle_vimrc @@ -13,7 +13,7 @@ endif "call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required -Plugin 'gmarik/Vundle.vim' +Plugin 'VundleVim/Vundle.vim' " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. @@ -26,6 +26,7 @@ Plugin 'scrooloose/nerdtree' Plugin 'davidhalter/jedi-vim' Plugin 'ervandew/supertab' Plugin 'Raimondi/delimitMate' +Plugin 'tomasr/molokai' "show tabs Plugin 'nathanaelkane/vim-indent-guides' Plugin 'vim-scripts/taglist.vim' diff --git a/.vimrc b/.vimrc index 0e0465d..db34b1d 100644 --- a/.vimrc +++ b/.vimrc @@ -1,11 +1,4 @@ -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Judge current OS is Windows or Linux -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -if(has("win32") || has("win64") || has("win95") || has("win16")) - let g:iswindows = 1 -else - let g:iswindows = 0 -endif +let g:iswindows = 0 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Judge current process is vim or gvim @@ -23,10 +16,10 @@ if g:iswindows source $VIM/vundle_vimrc source $VIM/python_vimrc else - source ~/.vim/startup/vundle_vimrc - source ~/.vim/startup/python_vimrc - source ~/.vim/startup/map_vimrc - source ~/.vim/startup/plugin_vimrc + source $HOME/.vim/startup/vundle_vimrc + source $HOME/.vim/startup/python_vimrc + source $HOME/.vim/startup/map_vimrc + source $HOME/.vim/startup/plugin_vimrc endif source $VIMRUNTIME/vimrc_example.vim @@ -147,8 +140,8 @@ if g:iswindows set guifont=Courier\ New\:h12 " set guifont=Droid\ Sans\ Mono\ for\ Powerline\:h12 set guifontwide=NSimsun\:h12 -else - set guifont=Monaco:h12 +elseif has("gui_gtk2") + set guifont=Consolas\ 12 endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/README.md b/README.md index c8e0bc4..ecd651f 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,8 @@ -This is my vim dot file. +This is my vim conf file. vundle相关配置在vundle_vimrc中,用vundle管理插件,插件列表`:PluginList`查看 python相关配置在python_vimrc中 -## Instruction under windows -Windows下,在vim目录下 - -``` -git init -git remote add origin https://github.com/einverne/dotfile.git -git fetch - -git checkout -t origin/master -``` - -然后在vim目录下安装Vundle - - git clone https://github.com/gmarik/Vundle.vim.git vimfiles/bundle/Vundle.vim - -进入vim,运行 `:PluginInstall` 安装剩余插件 - -将 https://github.com/tomasr/molokai 工程中的配色下载到 /vimfile/colors/ 目录下 - -将 ctags58.zip 压缩包中的 ctags.exe 解压到 vim74/ 目录下 - ## Instruction under Linux Just run `./install.sh`, everything is done. Then Enter the vim run `:PluginInstall` to install all plugins. @@ -32,7 +11,7 @@ Or, you can do it manually follow the step: Install Vundle to `~/.vim/` directory. - git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim + git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim Enter vim, run `:PluginInstall`, after install all plugin, you will meet an error, diff --git a/_vimrc b/_vimrc deleted file mode 100644 index 2bc230b..0000000 --- a/_vimrc +++ /dev/null @@ -1,310 +0,0 @@ -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Judge current OS is Windows or Linux -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -if(has("win32") || has("win64") || has("win95") || has("win16")) - let g:iswindows = 1 -else - let g:iswindows = 0 -endif - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Judge current process is vim or gvim -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -if has("gui_running") - let g:isGUI = 1 -else - let g:isGUI = 0 -endif - - -" 引用vundle_vimrc -" 引用python_vimrc配置文件 -if g:iswindows - source $VIM/vundle_vimrc - source $VIM/python_vimrc -else - source ~/.vim/startup/vundle_vimrc - source ~/.vim/startup/python_vimrc -endif - -source $VIMRUNTIME/vimrc_example.vim -source $VIMRUNTIME/mswin.vim - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => General -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Sets how many lines of history VIM has to remember -set history=1000 - -" set to auto read when a file is changed outside -set autoread - -" with a map leader it's possible to do extra key combinations -" like w saves the current file -let mapleader = "," -let g:mapleader = "," - -" fast saving -nmap w :w! - -"编辑vimrc之后,重新加载 -if g:iswindows - autocmd! bufwritepost _vimrc source $VIM/_vimrc -else - autocmd! bufwritepost *.vimrc source $HOME/.vimrc -endif - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => VIM user interface -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" set 8 lines to the cursor - when moving vertically using j/k -" j/k移动时光标距离文件上下n行 缩写 set so = 8 -set scrolloff=8 - -" gVim automatically maximize when it open -" 启动时最大化gVim -" http://superuser.com/questions/140419/how-to-start-gvim-maximized -if g:iswindows - au GUIEnter * simalt ~x -endif - -" 如下命令使鼠标用起来象微软 Windows -behave mswin - -" 高亮整行 -set cursorline - -" always show current position -set ruler - -" height of the command bar -set cmdheight=2 - -" in many terminal emulators the mouse works just fine, thus enable it -if has('mouse') - set mouse=a -endif - -" Ignore case when searching 忽略大小写 -set ignorecase - -" When searching try to be smart about cases -set smartcase - -" Highlight search results -set hlsearch - -" Makes search act like search in modern browsers -set incsearch - -" for regular expressions turn magic on -set magic - -set showcmd - -if has('multi_byte_ime') - "未开启IME时光标背景色 - hi Cursor guifg=bg guibg=Orange gui=NONE - "开启IME时光标背景色 - hi CursorIM guifg=NONE guibg=Skyblue gui=NONE - " 关闭Vim的自动切换IME输入法(插入模式和检索模式) - set iminsert=0 imsearch=0 - " 插入模式输入法状态未被记录时,默认关闭IME - "inoremap :set iminsert=0 -endif - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Colors and Fonts -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -"语法高亮 -syntax on - -" using monokai color -" there should be molokai.vim file under ~/vimfile/colors/ -" https://github.com/tomasr/molokai -colorscheme molokai - -"vim内部编码 -set encoding=utf-8 -" set current file encoding -set fileencoding=utf-8 -"按照utf-8 without bom,utf-8,顺序识别打开文件 -set fileencodings=ucs-bom,utf-8,gbk,gb2312,cp936,big5,gb18030,shift-jis,latin1 - -"防止菜单乱码 -if(g:iswindows && g:isGUI) - source $VIMRUNTIME/delmenu.vim - source $VIMRUNTIME/menu.vim - language messages zh_CN.utf-8 -endif -"默认以双字节处理那些特殊字符 -if v:lang =~? '^\(zh\)\|\(ja\)\|\(ko\)' - set ambiwidth=double -endif - -set nobomb "不自动设置字节序标记 - -if g:iswindows - set guifont=Courier\ New\:h12 - " set guifont=Droid\ Sans\ Mono\ for\ Powerline\:h12 - set guifontwide=NSimsun\:h12 -else - set guifont=Monaco:h12 -endif - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Files, backups and undo -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Turn backup off, since most stuff is in SVN, git et.c anyway... -" no backup file, no write backup file, no swap file -set nobackup -set nowb -set noswapfile - -" Turn off undo file, keep annoying "un~" file away -set noundofile - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Text, tab and indent related -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -"去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限 -set nocompatible -"设置自动缩进 -set autoindent - -"C语言自动缩进 -set cindent -"设置Tab缩进4格 -set tabstop=4 - -" 设置">"操作符 缩进,增加的缩进量是使用'shiftwidth'指定,默认是8 -set shiftwidth=4 - -"显示行号 -set nu - -" set smart indent -set si -" wrap lines -set wrap - -" YAML -autocmd Filetype yaml setlocal tabstop=2 shiftwidth=2 - -" Web -autocmd Filetype json setlocal tabstop=2 shiftwidth=2 -autocmd Filetype javascript setlocal tabstop=2 shiftwidth=2 -autocmd Filetype html setlocal tabstop=2 shiftwidth=2 -autocmd Filetype css setlocal tabstop=2 shiftwidth=2 - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Moving around, tabs, windows and buffers -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Treat long lines as break lines (useful when moving around in them) -map j gj -map k gk - - - -"""""""""""""""""""""""""""""" -" => Status line -"""""""""""""""""""""""""""""" -"状态栏显示内容 -"define 3 custom highlight groups -hi User1 ctermbg=green ctermfg=red guibg=green guifg=red -hi User2 ctermbg=gray ctermfg=blue guibg=gray guifg=blue -hi User3 ctermbg=blue ctermfg=green guibg=blue guifg=green - -" always show the status line -set laststatus=2 -set statusline= -" full filename modified flag read only flag help file flag Preview -set statusline=%1*%F%m%r%h%w\ -set statusline+=%2*[%{strlen(&fenc)?&fenc:'none'}, "file encoding -set statusline+=%{&ff}] "file format -set statusline+=%y "file type -set statusline+=%= "divider left/right separator" -set statusline+=%3*%c, "column -set statusline+=%l/%L "line no/all line" -set statusline+=\ %P - - - -" Plugin settings -" Normal mode F2 to call NERDTree -nmap :NERDTreeToggle - -" plasticboy/vim-markdown -" disable folding -let g:vim_markdown_folding_disabled=1 -" Highlight YAML frontmatter as used by Jekyll -let g:vim_markdown_frontmatter=1 - -" intend guides -let g:indent_guides_enable_on_vim_startup = 1 - -" jedi-vim plugin config -let g:jedi#completions_command = "" -let g:jedi#popup_on_dot = 0 - -" powerline -" hide the default mode text (e.g. -- INSERT -- below the statusline) -" set t_Co=256 -" let g:Powerline_symbols='fancy' - - -" general mapping -" no ddkP -" no ddp - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" =>Others -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Delete trailing white space on save, useful for Python and CoffeeScript ;) -func! DeleteTrailingWS() - exe "normal mz" - %s/\s\+$//ge - exe "normal `z" -endfunc -autocmd BufWrite *.py :call DeleteTrailingWS() -autocmd BufWrite *.coffee :call DeleteTrailingWS() - -" smart way to move between windows -map j -map k -map h -map l - -set diffexpr=MyDiff() -function! MyDiff() - let opt = '-a --binary ' - if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif - if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif - let arg1 = v:fname_in - if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif - let arg2 = v:fname_new - if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif - let arg3 = v:fname_out - if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif - let eq = '' - if $VIMRUNTIME =~ ' ' - if &sh =~ '\ ' . arg3 . eq -endfunction - -function! Xml() - set filetype=xml - :%s/>\r<替换成>回车< - :normal gg=G -endfunction -map xml :call Xml() diff --git a/python_vimrc b/python_vimrc deleted file mode 100644 index 5578631..0000000 --- a/python_vimrc +++ /dev/null @@ -1,90 +0,0 @@ -" vimrc file for following the coding standards specified in PEP 7 & 8. -" -" To use this file, source it in your own personal .vimrc file (``source -" ``) or, if you don't have a .vimrc file, you can just symlink to it -" (``ln -s ~/.vimrc``). All options are protected by autocmds -" (read below for an explanation of the command) so blind sourcing of this file -" is safe and will not affect your settings for non-Python or non-C files. -" -" -" All setting are protected by 'au' ('autocmd') statements. Only files ending -" in .py or .pyw will trigger the Python settings while files ending in *.c or -" *.h will trigger the C settings. This makes the file "safe" in terms of only -" adjusting settings for Python and C files. -" -" Only basic settings needed to enforce the style guidelines are set. -" Some suggested options are listed but commented out at the end of this file. - -" Number of spaces that a pre-existing tab is equal to. -" For the amount of space used for a new tab use shiftwidth. -au BufRead,BufNewFile *py,*pyw,*.c,*.h set tabstop=8 - -" What to use for an indent. -" This will affect Ctrl-T and 'autoindent'. -" Python: 4 spaces -" C: tabs (pre-existing files) or 4 spaces (new files) -au BufRead,BufNewFile *.py,*pyw set shiftwidth=4 -au BufRead,BufNewFile *.py,*.pyw set expandtab -fu! Select_c_style() - if search('^\t', 'n', 150) - set shiftwidth=8 - set noexpandtab - el - set shiftwidth=4 - set expandtab - en -endf -au BufRead,BufNewFile *.c,*.h call Select_c_style() -au BufRead,BufNewFile Makefile* set noexpandtab - -" Use the below highlight group when displaying bad whitespace is desired. -highlight BadWhitespace ctermbg=red guibg=red - -" Display tabs at the beginning of a line in Python mode as bad. -au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/ -" Make trailing whitespace be flagged as bad. -au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ - -" Wrap text after a certain number of characters -" Python: 79 -" C: 79 -au BufRead,BufNewFile *.py,*.pyw,*.c,*.h set textwidth=79 - -" Turn off settings in 'formatoptions' relating to comment formatting. -" - c : do not automatically insert the comment leader when wrapping based on -" 'textwidth' -" - o : do not insert the comment leader when using 'o' or 'O' from command mode -" - r : do not insert the comment leader when hitting in insert mode -" Python: not needed -" C: prevents insertion of '*' at the beginning of every line in a comment -au BufRead,BufNewFile *.c,*.h set formatoptions-=c formatoptions-=o formatoptions-=r - -" Use UNIX (\n) line endings. -" Only used for new files so as to not force existing files to change their -" line endings. -" Python: yes -" C: yes -au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix - -" auto add #! /usr/bin/env python -autocmd BufNewfile *.py call append(0,'#!/usr/bin/env python') -autocmd BufNewfile *.py call append(1,'# -*- coding: UTF-8 -*-') - -" ---------------------------------------------------------------------------- -" The following section contains suggested settings. While in no way required -" to meet coding standards, they are helpful. - -" Set the default file encoding to UTF-8: ``set encoding=utf-8`` - -" Puts a marker at the beginning of the file to differentiate between UTF and -" UCS encoding (WARNING: can trick shells into thinking a text file is actually -" a binary file when executing the text file): ``set bomb`` - -" For full syntax highlighting: -"``let python_highlight_all=1`` -"``syntax on`` - -" Automatically indent based on file type: ``filetype indent on`` -" Keep indentation level from previous line: ``set autoindent`` - -" Folding based on indentation: ``set foldmethod=indent`` diff --git a/vundle_vimrc b/vundle_vimrc deleted file mode 100644 index 39ac25b..0000000 --- a/vundle_vimrc +++ /dev/null @@ -1,45 +0,0 @@ -set nocompatible " be iMproved, required -filetype off " required - -" set the runtime path to include Vundle and initialize -if has("win32") - set rtp+=$VIM/vimfiles/bundle/Vundle.vim - call vundle#begin('$VIM/vimfiles/bundle') -else - set rtp+=~/.vim/bundle/Vundle.vim - call vundle#begin() -endif -" alternatively, pass a path where Vundle should install plugins -"call vundle#begin('~/some/path/here') - -" let Vundle manage Vundle, required -Plugin 'gmarik/Vundle.vim' - -" The following are examples of different formats supported. -" Keep Plugin commands between vundle#begin/end. -" plugin on GitHub repo -Plugin 'tpope/vim-fugitive' -Plugin 'vim-perl/vim-perl' -Plugin 'godlygeek/tabular' -Plugin 'plasticboy/vim-markdown' -Plugin 'scrooloose/nerdtree' -Plugin 'davidhalter/jedi-vim' -Plugin 'ervandew/supertab' -Plugin 'Raimondi/delimitMate' -"show tabs -Plugin 'nathanaelkane/vim-indent-guides' -Plugin 'vim-scripts/taglist.vim' -" Plugin 'powerline/powerline', {'rtp': 'powerline/bindings/vim/'} -" Plugin 'Lokaltog/vim-powerline' -" Plugin 'bling/vim-airline' - -" plugin from http://vim-scripts.org/vim/scripts.html -Plugin 'L9' -Plugin 'perl-support.vim' - -" Git plugin not hosted on GitHub -Plugin 'git://git.wincent.com/command-t.git' - -call vundle#end() " required -filetype plugin indent on " required -