Skip to content

Commit

Permalink
Update for python and go, also update several plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyho committed Dec 28, 2017
1 parent 5dbe6a7 commit 5374be6
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 16 deletions.
65 changes: 59 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Vim/Gvim/MacVim
1. Clone this repo. eg:

`mkdir ~/github`

`cd ~/github`

`git clone https://github.com/tonyho/VIM.git`

2. Install the vim(or gvim) using the proper commands, for example in Ubuntu:
Expand All @@ -27,9 +29,11 @@ Vim/Gvim/MacVim

`sudo apt-get install ctags cscope`

4. Move the _vimrc file to you home directory, and rename it to .vimrc. Or make a soft link to it:
4.Symbol link the .vimrc and .gvimrc. Or make a soft link to it:

`cd ~ && ln -s ~/github/VIM/_vimrc ~/.vimrc`

`cd ~ && ln -s ~/github/VIM/_vimrc .vimrc`
`cd ~ && ln -s ~/github/VIM/_gvimrc ~/.gvimrc`

5. Move the vimfiles directory to you home directory, and rename it to .vim,or make a soft link to it:

Expand Down Expand Up @@ -79,30 +83,63 @@ If error occurs, use the `l` to see the logs, or save it the a file. Usually, th
1. Git repo not existed anymore: for this situation, we need to search in github to a new repo, see the _vimrc content for reference.
2. Plugin directory already existed in vimfiles/vundle, so just delete it.

##Install Fonts
Install fonts placed in user_fonts directory
## Install Fonts
Install fonts placed in user_fonts directory, or install all the powerline fonts:

```shell
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
```

About the vundle, you can refer this artcle: [How To Use Vundle to Manage Vim Plugins on a Linux VPS](https://www.digitalocean.com/community/tutorials/how-to-use-vundle-to-manage-vim-plugins-on-a-linux-vps)

## Install YouCompeleteMe
If you have golang installled use following:
` ~/.vim/bundle/YouCompleteMe/install.py --go-completer`

Otherwise, install it without golang support:
` ~/.vim/bundle/YouCompleteMe/install.py`

# Some plugins' KeyBinding: #
##SrcExpl:
## SrcExpl:

1. F5--> Open the source explorer window
1. F3--> Previous Definition
1. F4--> Next Definition
1. F6--> Goto definition
1. SPACE --> Back from the Definition

##TagList and Tagbar
## TagList and Tagbar
1. tl--> taglist, list the tag generated by ctags
1. tb--> tagbar, like the taglist

## NerdTree
1. F2--> Nerd Tree sidebar

## Switch buffers
### In Gvim
1. Ctrl+Tab--> Switch to next buffer
1. Ctrl+Shift+Tab--> Switch back to previous buffer

### In vim
1. :bnext--> Switch to next buffer
1. :bprev--> Switch back to previous buffer

## Python indent
1. =--> indent the selected(visual mode) python code

## CtrlP
1. Ctrl + p--> Ctrlp plugin for search

## Others
1. cM--> Remove the ^M string at the end of line
1. cS--> Remove the space string at the end of line
1. :ToggleWhitespace: Display or hide the highlight for the training space
1. :StripWhitespace--> Remove the space string at the end of line


## tabular
See the [tabular plugin vimcast](http://vimcasts.org/episodes/aligning-text-with-tabular-vim/)
Expand All @@ -115,3 +152,19 @@ A MacVim screenshot:

----------

## Reference
[tabular plugin vimcast](http://vimcasts.org/episodes/aligning-text-with-tabular-vim/)
[Reference config](https://github.com/ashfinal/vimrc-config)
[PowerLine Fonts](hhttps://github.com/powerline/font)
[Markdown cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)

## ChangeLog
### 2017-12-28
1. Change the PowerLine to airline with buffer file list at status bar
1. Add Gvim rc
1. Change fonts to RobotoMono
1. Replace Syntastic with YouCompelteMe
1. Add python relatives
1. Using PaperColor color theme for Gvim/VIM, for this theme support many other plugins
1. Add golang plugin: 'fatih/vim-go'
1. Add ctrlp plugin
6 changes: 6 additions & 0 deletions _gvimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
" set gfn=Fantasque\ Sans\ Mono\ 13
set gfn=Roboto\ Mono\ for\ Powerline\ 12

" move among buffers with CTRL, only works on gvim
map <C-Tab> :bnext<CR>
map <C-S-Tab> :bprev<CR>
144 changes: 134 additions & 10 deletions _vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -139,25 +139,147 @@ Bundle 'Shougo/neocomplcache'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/nerdtree'
Bundle 'vim-scripts/OmniCppComplete'
Bundle 'Lokaltog/vim-powerline'
" Change to use AirLine
" Bundle 'Lokaltog/vim-powerline'
Bundle 'repeat.vim'
Bundle 'msanders/snipmate.vim'
" Symbol definations like the source insight
Bundle 'wesleyche/SrcExpl'
" Bundle 'ervandew/supertab'
Bundle 'std_c.zip'
Bundle 'tpope/vim-surround'
Bundle 'vim-scripts/Syntastic'
" Bundle 'vim-scripts/Syntastic'
Bundle 'majutsushi/tagbar'
Bundle 'vim-scripts/taglist.vim'
Bundle 'TxtBrowser'
" Bundle 'winmanager'
Bundle 'ZoomWin'
" Align multiple line or colomn with special symbol, such as the 'Tabularize \='
Bundle 'godlygeek/tabular'
Bundle 'vivien/vim-addon-linux-coding-style'
" Disable for the tab is 8B
" Bundle 'vivien/vim-addon-linux-coding-style'
" C Call for functions like the source insight
Bundle 'hari-rangarajan/CCTree'
Bundle 'Valloric/YouCompleteMe'
" Lint for many language
Bundle 'w0rp/ale'
" Yet another python formater
Bundle 'google/yapf'
" Bundle 'python-mode/python-mode'
" For the python indent
Bundle 'vim-scripts/indentpython.vim'
Bundle 'kien/ctrlp.vim'
" Python Virtual Env
Bundle 'jmcantrell/vim-virtualenv'

let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
"execute pathogen#infect()
syntax on
"filetype plugin indent on

"it would be nice to set tag files by the active virtualenv here
":set tags=~/mytags "tags for ctags and taglist
"omnicomplete
autocmd FileType python set omnifunc=pythoncomplete#Complete

"------------Start Python PEP 8 stuff----------------
" Number of spaces that a pre-existing tab is equal to.
au BufRead,BufNewFile *py,*pyw,*.c,*.h set tabstop=4

"spaces for indents
au BufRead,BufNewFile *.py,*pyw set shiftwidth=4
au BufRead,BufNewFile *.py,*.pyw set expandtab
au BufRead,BufNewFile *.py set softtabstop=4

" Keep indentation level from previous line:
autocmd FileType python set autoindent

" Format for python
" au BufNewFile,BufRead *.py
" \ set tabstop=4 |
" \ set softtabstop=4 |
" \ set shiftwidth=4 |
" \ set textwidth=79 |
" \ set expandtab |
" \ set autoindent |
" \ set fileformat=unix |
" \ set encoding=utf-8 |

" High light the space at the end of line
hi BadWhitespace guifg=gray guibg=red ctermfg=gray ctermbg=red
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h,*.go match BadWhitespace /\s\+$/

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


if executable('ag')
Bundle 'gabesoft/vim-ags'
end

Bundle 'bling/vim-airline'
Bundle 'bling/vim-bufferline'

" Display the buffer list at airline status bar
if filereadable(expand("~/.vim/plugged/vim-airline/plugin/airline.vim"))
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#fnamemod = ':t'
endif

if version >= 704 || version ==703 && has('patch005')
Bundle 'mbbill/undotree'
endif

Bundle 'ashfinal/vim-one'
Bundle 'cseelus/vim-colors-lucid'
Bundle 'NLKNguyen/papercolor-theme'
if has("gui_running") || has("gui_vimr")
" colorscheme one
colorscheme PaperColor
set background=dark " for the dark version
" set background=light " for the light version
else
"colorscheme Tomorrow-Night-Eighties "终端配色方案
"colorscheme one
"set t_Co=256 " This is may or may not needed.
"set background=light
colorscheme PaperColor
set background=dark
endif

" Ref: https://github.com/ashfinal/vimrc-config
function! ToggleBackground()
if &background == "light"
set background=dark
else
set background=light
endif
endfunction
nnoremap <silent> <Leader>a :call ToggleBackground()<CR>
" Toggle showing softwarpped continuing line
nnoremap <silent> <Leader>k :call ToggleShowbreak()<CR>
function! ToggleShowbreak()
if &showbreak == ""
set showbreak=+++
else
set showbreak=
endif
endfunction


Bundle 'ntpeters/vim-better-whitespace'
" :ToggleWhitespace
" :StripWhitespace

let g:airline_theme='one'
"let g:airline_theme='papercolor'

Bundle 'fatih/vim-go'


" nnoremap <F1> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>

Expand Down Expand Up @@ -237,7 +359,9 @@ set cmdheight=2 "设置命令行的高度
set cursorline "突出显示当前行
" set guifont=YaHei_Consolas_Hybrid:h10 "设置字体:字号(字体名称空格用下划线代替)
" For macvim, the default font size is too small
set guifont=Monaco:h14
" set guifont=Monaco:h14
set guifont=Roboto_Mono_for_Powerline:h12

" For MacVim, enter full screen mode
" :set fu
set nowrap "设置不自动换行
Expand All @@ -246,12 +370,12 @@ set shortmess=atI "去掉欢迎界面
winpos 20 10 "指定窗口出现的位置,坐标原点在屏幕左上角
set lines=60 columns=230 "指定窗口大小,lines为高度,columns为宽度

" 设置代码配色方案
if g:isGUI
colorscheme Tomorrow-Night-Eighties "Gvim配色方案
else
colorscheme Tomorrow-Night-Eighties "终端配色方案
endif
" " 设置代码配色方案
" if g:isGUI
" colorscheme Tomorrow-Night-Eighties "Gvim配色方案
" else
" colorscheme Tomorrow-Night-Eighties "终端配色方案
" endif

" 个性化状栏(这里提供两种方式,要使用其中一种去掉注释即可,不使用反之)
" let &statusline=' %t %{&mod?(&ro?"*":"+"):(&ro?"=":" ")} %1*|%* %{&ft==""?"any":&ft} %1*|%* %{&ff} %1*|%* %{(&fenc=="")?&enc:&fenc}%{(&bomb?",BOM":"")} %1*|%* %=%1*|%* 0x%B %1*|%* (%l,%c%V) %1*|%* %L %1*|%* %P'
Expand Down

0 comments on commit 5374be6

Please sign in to comment.