Created
December 17, 2018 13:20
-
-
Save akhenakh/07b5ac85903a7c4edc54665905003cce to your computer and use it in GitHub Desktop.
curent plugins and config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" install vim-plug | |
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ | |
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
call plug#begin('~/.vim/plugged') | |
Plug 'Shougo/deoplete.nvim' | |
Plug 'roxma/nvim-yarp' | |
Plug 'roxma/vim-hug-neovim-rpc' | |
Plug 'zchee/deoplete-go', { 'do': 'make'} | |
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } | |
Plug 'Shougo/deoplete.nvim' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'majutsushi/tagbar' | |
Plug 'kien/ctrlp.vim' | |
Plug 'godlygeek/tabular' | |
Plug 'plasticboy/vim-markdown' | |
Plug 'mhinz/vim-grepper' | |
Plug 'scrooloose/nerdtree' | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'altercation/vim-colors-solarized' | |
Plug 'tpope/vim-fugitive' | |
Plug 'w0rp/ale' | |
call plug#end() | |
" 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,*html,*js 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,*.html,*.js set shiftwidth=4 | |
au BufRead,BufNewFile *.py,*.pyw,*.html,*.js 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\+$/ | |
au BufRead,BufNewFile *.py,*.pyw set softtabstop=4 | |
au BufNewFile,BufRead *.m,*.h set ft=objc | |
" 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 <Enter> 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 | |
set nocompatible " choose no compatibility with legacy vi | |
" For full syntax highlighting: | |
let python_highlight_all=1 | |
syntax on | |
set encoding=utf-8 | |
set showcmd " display incomplete commands | |
filetype plugin indent on " load file type plugins + indentation | |
set ruler " show line and column number | |
"" Whitespace | |
set nowrap " don't wrap lines | |
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4) | |
set expandtab " use spaces, not tabs (optional) | |
set backspace=indent,eol,start " backspace through everything in insert mode | |
"" Searching | |
set hlsearch " highlight matches | |
set incsearch " incremental searching | |
set ignorecase " searches are case insensitive... | |
set smartcase " ... unless they contain at least one capital letter | |
" do not show mode on command line since we have airline | |
set noshowmode | |
" Automatically indent based on file type: | |
filetype indent on | |
filetype plugin on | |
" " Keep indentation level from previous line: | |
set autoindent | |
" remember position in files with .viminfo | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif | |
endif | |
" 256 colors | |
set t_Co=256 | |
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*.so " Linux/MacOSX | |
" pip3 install --user pynvim | |
let g:deoplete#enable_at_startup = 1 | |
let g:deoplete#sources#go#gocode_binary = '/Users/akh/dev/go/bin/gocode' | |
let g:deoplete#sources#go#package_dot = 1 | |
nmap <silent> <A-Up> :wincmd k<CR> | |
nmap <silent> <A-Down> :wincmd j<CR> | |
nmap <silent> <A-Left> :wincmd h<CR> | |
nmap <silent> <A-Right> :wincmd l<CR> | |
" | |
"" visual line number | |
" set number | |
" mouse support: this can be annoying, use shift for select then copy with your term use alt on mac | |
" prefer the command v or V for whole line, move the cursor, y for copy or d for cut, then p for paste | |
set mouse=a | |
" toggle paste for paste no indent | |
nnoremap <F2> :set invpaste paste?<CR> | |
set pastetoggle=<F2> | |
set background=dark | |
let g:solarized_contrast = "high" | |
colorscheme solarized | |
" Python completion should work as is in recent vim, to check for it vim --version | grep python | |
" then use Ctrl x Ctrl o after obj. | |
" TextMate like escape completion for known words simply use Ctrl p in insert mode | |
" If you prefer the Omni-Completion tip window to close when a selection is | |
" made, these lines close it on movement in insert mode or when leaving | |
" insert mode | |
autocmd CompleteDone * pclose | |
" turn off preview window | |
set completeopt-=preview | |
" http://majutsushi.github.io/tagbar/ | |
nmap <F3> :TagbarToggle<CR> | |
" vim-go | |
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 | |
au FileType go nmap <leader>r <Plug>(go-run) | |
au FileType go nmap <leader>b <Plug>(go-build) | |
au FileType go nmap <leader>t <Plug>(go-test) | |
au FileType go nmap <leader>c <Plug>(go-coverage) | |
au FileType go nmap <Leader>gd <Plug>(go-doc) | |
au FileType go nmap <Leader>dv <Plug>(go-def-vertical) | |
au FileType go nmap <Leader>dt <Plug>(go-def-tab) | |
au FileType go nmap <Leader>d <Plug>(go-def) | |
au FileType go nmap <Leader>gb <Plug>(go-doc-browser) | |
au FileType go nmap <Leader>gr <Plug>(go-rename) | |
au FileType go nmap <Leader>gc <Plug>(go-callers) | |
au FileType go nmap <Leader>gr <Plug>(go-rename) | |
au FileType go nmap <Leader>gi <Plug>(go-implements) | |
autocmd FileType go nmap <Leader>i <Plug>(go-info) | |
let g:go_list_type = "quickfix" | |
let g:go_fmt_command = "goimports" | |
let g:go_highlight_functions = 1 | |
let g:go_highlight_methods = 1 | |
let g:go_highlight_extra_types = 1 | |
let g:go_highlight_interfaces = 1 | |
let g:go_auto_type_info = 1 | |
let g:go_auto_sameids = 1 | |
set guifont=Monaco:h12 | |
set mousefocus | |
set laststatus=2 | |
set nu | |
set cursorline | |
" update time useful for vim git gutter & vim-go | |
set updatetime=200 | |
" unnamed on OSX unnampedplus on Linux | |
set clipboard=unnamed | |
" disable folding with vim-markdown | |
let g:vim_markdown_folding_disabled = 1 | |
map <C-n> :NERDTreeToggle<CR> | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
" Mimic :grep and make ag the default tool. | |
let g:grepper = { | |
\ 'tools': ['pt', 'git', 'grep'], | |
\ } | |
nnoremap <leader>g :Grepper -tool pt -noswitch<cr> | |
map <F5> :ls<CR>:e # | |
" autoclose parentheses for code | |
autocmd FileType c,go,py inoremap " ""<left> | |
autocmd FileType c,go,py inoremap ' ''<left> | |
autocmd filetype c,go,py inoremap ( ()<left> | |
autocmd filetype c,go,py inoremap [ []<left> | |
autocmd filetype c,go,py inoremap { {}<left> | |
autocmd filetype c,go,py inoremap {<CR> {<CR>}<ESC>O | |
autocmd filetype c,go,py inoremap {;<CR> {<CR>};<ESC>O | |
" show errors ale with Airline | |
let g:airline#extensions#ale#enabled = 1 | |
highlight ALEError ctermbg=DarkMagenta | |
highlight ALEWarning ctermbg=DarkMagenta | |
let g:ale_linters = {'go': ['gobuild', 'gofmt', 'goimports', 'remove_trailing_lines', 'trim_whitespace', 'gometalinter' ]} | |
let g:ale_go_gometalinter_options = '--fast' | |
let g:ale_lint_on_enter = 'always' | |
let g:ale_sign_error = '⚠️' | |
let g:ale_sign_warning = '❓' | |
" autowrite on build and make | |
set autowrite | |
" for golang ctrl g to work add this to .ctags | |
" --langdef=Go | |
" --langmap=Go:.go | |
" --regex-Go=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/d,func/ | |
" --regex-Go=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,var/ | |
" --regex-Go=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,type/ | |
" invoke via Ctrl p, ctrl b to switch between buffers, mru, files | |
" populate tags with go | |
let g:ctrlp_buftag_types = {'go' : '--language-force=go --golang-types=ftv'} | |
nmap <C-b> :CtrlPBuffer<cr> | |
nmap <C-g> :CtrlPBufTag<cr> | |
" 1gt 2gt 3gt swtich tabs, open tab in nerdtree with t next tab gt previous gT | |
" ^w s, split horizontally , ^w v vertically, ^w o, unsplit all, ^w q close current split, | |
" ^w t, go back to the left top, ^w w | |
" | |
" ^w s = partage l'écran en deux horizontalement | |
" ^w v = partage l'écran en deux verticalement | |
" | |
" Se déplacer dans les splits : | |
" ^w j fleche = sélectionne le split d'en bas | |
" ^w k fleche = sélectionne le split d'en haut | |
" ^w + fleche = agrandit le split actif d'une ligne | |
" ^w - fleche = réduit le split actif d'une ligne | |
" | |
" Et dans les vsplits : | |
" ^w h = sélectionne le vsplit de gauche | |
" ^w l = sélectionne le vsplit de droite | |
" ^w > = agrandit le vsplit actif d'une colonne | |
" ^w < = réduit le vsplit actif d'une colonne | |
" open vi with 2 files on the cmd line then switch with :bn (buffer next) :bp (buffer previous) :bd (buffer delete) | |
" comment code \cl uncomment \cu | |
" ctr + o go back ctr + i go fwd go to last change `. | |
" go back to the last edited lines : '' | |
" :ccl[ose] close quick fix, :cope[n] open quick fix | |
" multiple selection & modification ala visual code | |
" /pattern enter cgn then . to replace n to skip | |
" :terminal open a shell | |
" Rotates the current focused window with the closest window to the right. | |
" Ctrl W + x OR Ctrl W + Ctrl x" | |
" Ctrl W + L - Move the current window to the far right | |
" Ctrl W + H - Move the current window to the far left | |
" Ctrl W + J - Move the current window to the very bottom | |
" Ctrl W + K - Move the current window to the very top | |
" K display go doc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment