Last active
January 26, 2018 13:12
-
-
Save yun-cloud/6dbc2a115a502514dc8323bf9bf227db to your computer and use it in GitHub Desktop.
neovim on megumin server: doing llvm
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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" dependency " | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" 1. neovim | |
" 2. python3 | |
" 3. pip install neovim | |
" 4. devicons: nerd font | |
" 5. clang-format: clang | |
" | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" vim-plug " | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
call plug#begin() | |
"""""""""" | |
" Misc " | |
"""""""""" | |
Plug 'vim-airline/vim-airline' | |
Plug 'jiangmiao/auto-pairs' | |
Plug 'mhinz/vim-startify' | |
Plug 'tpope/vim-surround' | |
"Plug 'tpope/vim-repeat' | |
Plug 'w0rp/ale' | |
""""""""""""" | |
" Utility " | |
""""""""""""" | |
Plug 'junegunn/vim-easy-align' | |
Plug 'scrooloose/nerdtree' | |
Plug 'tpope/vim-abolish' | |
Plug 'vim-scripts/VisIncr' | |
Plug 'rhysd/vim-clang-format' | |
"Plug 'tpope/vim-commentary' | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'mattn/gist-vim' | Plug 'mattn/webapi-vim' | |
""""""""" | |
" fzf " | |
""""""""" | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
"""""""""""""" | |
" Snippets " | |
"""""""""""""" | |
Plug 'SirVer/ultisnips' | |
Plug 'honza/vim-snippets' | |
""""""""""""""""""" | |
" Auto Complete " | |
""""""""""""""""""" | |
Plug 'Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'} | |
Plug 'Shougo/neco-syntax' | |
Plug 'tweekmonster/deoplete-clang2' | |
"Plug 'vim-scripts/AutoComplPop' | |
"Plug 'vim-scripts/OmniCppComplete' | |
"""""""""""" | |
" Denite " | |
"""""""""""" | |
"Plug 'Shougo/denite.nvim', {'do': ':UpdateRemotePlugins'} | |
""""""""" | |
" git " | |
""""""""" | |
Plug 'airblade/vim-gitgutter' | |
Plug 'tpope/vim-fugitive' | |
""""""""""""""""" | |
" Text Object " | |
""""""""""""""""" | |
Plug 'wellle/targets.vim' | |
Plug 'michaeljsmith/vim-indent-object' | |
""""""""""""""""" | |
" Colorscheme " | |
""""""""""""""""" | |
"Plug 'chriskempson/base16-vim' | |
Plug 'morhetz/gruvbox' | |
""""""""""""""" | |
" Highlight " | |
""""""""""""""" | |
Plug 'octol/vim-cpp-enhanced-highlight', {'for': 'cpp'} | |
Plug 'sheerun/vim-polyglot' | |
Plug 'kien/rainbow_parentheses.vim' | |
Plug 'arakashic/chromatica.nvim', {'for': 'cpp'} | |
"""""""""""""" | |
" devicons " | |
"""""""""""""" | |
" need to be loaded after NerdTree, startify, airline, denite... | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
call plug#end() | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Settings " | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set number | |
set cursorline | |
set showmatch | |
set ignorecase | |
set smartcase | |
set splitbelow | |
set clipboard+=unnamedplus | |
set completeopt-=preview | |
" fileformat = dot (unix) | |
" Β·: middle-dot by pressing CTRL-K then .M | |
" Β»: right-angle-quote by pressing CTRL-K then >> | |
set list | |
set listchars=tab:»·,trail:·,nbsp:+,precedes:<,extends:> | |
colo desert | |
" terminal true color support | |
"if has('nvim') || has('termguicolors') | |
"set termguicolors | |
"endif | |
"let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
autocmd Filetype vim setlocal expandtab sw=2 ts=2 tw=78 nowrap | |
autocmd FileType c,cpp setlocal expandtab sw=2 ts=2 tw=80 wrap | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Mapping " | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" leader key | |
let g:mapleader = "\<Space>" | |
nnoremap <Space> <Nop> | |
" habbit | |
inoremap jk <ESC> | |
inoremap j: <ESC>: | |
inoremap kj <ESC> | |
nnoremap ; : | |
nnoremap : ; | |
xnoremap ; : | |
" move up/down not linewise when wrap | |
nnoremap j gj | |
nnoremap k gk | |
" remove trailing whitespace | |
nnoremap <silent> <Leader>rtw :%s/\s\+$//e<CR>:noh<CR>'' | |
" toggle mapping | |
nnoremap <silent> 0 :call ToggleMovement('^', '0')<CR> | |
function! ToggleMovement(firstOp, thenOp) | |
let pos = getpos('.') | |
execute "normal! " . a:firstOp | |
if pos == getpos('.') | |
execute "normal! " . a:thenOp | |
endif | |
endfunction | |
" Spacemacs style | |
nnoremap <Leader><TAB> <C-^> | |
nnoremap <Leader>sc :noh<CR> | |
nnoremap <Leader>j= mogg=G`ozz | |
" operation of config file | |
nnoremap <Leader>fed :e $MYVIMRC<CR> | |
nnoremap <Leader>fer :w<CR>:source $MYVIMRC<CR> | |
nnoremap <Leader>feR :w<CR>:source $MYVIMRC<CR> | |
nnoremap <Leader>feu :w<CR>:source $MYVIMRC<CR>:PlugUpdate<CR> | |
nnoremap <Leader>fei :w<CR>:source $MYVIMRC<CR>:PlugInstall<CR> | |
" window navigation | |
nnoremap <Leader>wh <C-W>h | |
nnoremap <Leader>wj <C-W>j | |
nnoremap <Leader>wk <C-W>k | |
nnoremap <Leader>wl <C-W>l | |
nnoremap <Leader>ww <C-W><C-W> | |
nnoremap <Leader>ws <C-W>s | |
nnoremap <Leader>wv <C-W>v | |
nnoremap <Leader>w= <C-W>= | |
nnoremap <Leader>wm :only<CR> | |
" Quickfix and Location list | |
nnoremap <Leader>cc :cc<CR> | |
nnoremap <Leader>cn :cn<CR> | |
nnoremap <Leader>cp :cp<CR> | |
nnoremap <Leader>cw :cw 10<CR> | |
nnoremap <Leader>cx :cclose<CR> | |
nmap [q :cp<CR> | |
nmap ]q :cn<CR> | |
nmap [Q :cfirst<CR> | |
nmap ]Q :clast<CR> | |
"nnoremap <Leader>ll :ll<CR> | |
"nnoremap <Leader>ln :lne<CR> | |
"nnoremap <Leader>lp :lp<CR> | |
"nnoremap <Leader>lw :lw 10<CR> | |
"nnoremap <Leader>lx :lclose<CR> | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Plugin Configuration " | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""" | |
" vim-easy-align " | |
"""""""""""""""""""" | |
nmap ga <Plug>(EasyAlign) | |
xmap ga <Plug>(EasyAlign) | |
""""""""""""" | |
" gruvbox " | |
""""""""""""" | |
colo gruvbox | |
""""""""""""" | |
" fzf.vim " | |
""""""""""""" | |
nnoremap <Leader>ff :Files<CR> | |
nnoremap <Leader>bb :Buffers<CR> | |
nnoremap <Leader>l :BLines<CR> | |
nnoremap <Leader>h :Helptags<CR> | |
nnoremap <Leader>t :Tags<CR> | |
command! -bang -nargs=* Rg | |
\ call fzf#vim#grep( | |
\ 'rg --column --line-number --no-heading --color= always --ignore-case '.shellescape(<q-args>), 1, | |
\ <bang>0 ? fzf#vim#with_preview('up:60%') | |
\ : fzf#vim#with_preview('right:50%:hidden ', '?'), | |
\ <bang>0) | |
if executable("rg") | |
nnoremap <Leader>sw :Rg <C-R><C-W><CR> | |
nnoremap <Leader>ss :Rg<Space> | |
endif | |
"""""""""""""""""" | |
" vim-devicons " | |
"""""""""""""""""" | |
set encoding=utf8 | |
" Use Nerd Font | |
" Guifont! Knack Nerd Font:h14 in ginit.vim | |
let g:airline_powerline_fonts = 1 | |
""""""""""""""" | |
" ultisnips " | |
""""""""""""""" | |
let g:UltiSnipsEditSplit='horizontal' | |
"let g:UltiSnipsExpandTrigger="<Tab>" | |
"let g:UltiSnipsListSnippets="<C-Tab>" | |
"let g:UltiSnipsJumpForwardTrigger="<C-J>" | |
"let g:UltiSnipsJumpBackwardTrigger="<C-K>" | |
""""""""""""""""""" | |
" deoplete.nvim " | |
""""""""""""""""""" | |
let g:deoplete#enable_at_startup = 1 | |
""""""""""""""""""" | |
" nerdcommenter " | |
""""""""""""""""""" | |
let g:NERDTrimTrailingWhitespace = 1 | |
nmap <Leader>;; <plug>NERDCommenterInvert | |
xmap <Leader>; <plug>NERDCommenterInvert | |
"""""""""""""" | |
" nerdtree " | |
"""""""""""""" | |
let g:NERDTreeIgnore=[ | |
\ '\~$', | |
\ '*.o', | |
\ '^node_modules$[[dir]]', | |
\ ] | |
nnoremap <F5> :NERDTreeToggle<CR> | |
"""""""""""""""""""""""""""""""" | |
" vim-cpp-enhanced-highlight " | |
"""""""""""""""""""""""""""""""" | |
let g:cpp_class_scope_highlight = 1 | |
let g:cpp_member_variable_highlight = 1 | |
let g:cpp_class_decl_highlight = 1 | |
""""""""""""""""""" | |
" vim-gitgutter " | |
""""""""""""""""""" | |
let g:gitgutter_map_keys = 0 | |
" hunk or change | |
nmap <Leader>ghs <Plug>GitGutterStageHunk | |
nmap <Leader>ghu <Plug>GitGutterUndoHunk | |
nmap <Leader>ghp <Plug>GitGutterPreviewHunk | |
omap ic <Plug>GitGutterTextObjectInnerPending | |
omap ac <Plug>GitGutterTextObjectOuterPending | |
xmap ic <Plug>GitGutterTextObjectOuterVisual | |
xmap ac <Plug>GitGutterTextObjectOuterVisual | |
nmap ]c <Plug>GitGutterNextHunk | |
nmap [c <Plug>GitGutterPrevHunk | |
"""""""""""""" | |
" fugitive " | |
"""""""""""""" | |
nnoremap <Leader>ga :Git add %:p<CR><CR> | |
nnoremap <Leader>gs :Gstatus<CR> | |
nnoremap <Leader>gc :Gcommit -v -q<CR> | |
nnoremap <Leader>gt :Gcommit -v -q %:p<CR> | |
nnoremap <Leader>gd :Gdiff<CR> | |
nnoremap <Leader>ge :Gedit<CR> | |
nnoremap <Leader>gr :Gread<CR> | |
nnoremap <Leader>gw :Gwrite<CR><CR> | |
nnoremap <Leader>gl :silent! Glog<CR>:bot copen<CR> | |
nnoremap <Leader>gp :Ggrep<Space> | |
nnoremap <Leader>gb :Git branch<Space> | |
nnoremap <Leader>go :Git checkout<Space> | |
""""""""""""""""" | |
" vim-airline " | |
""""""""""""""""" | |
let g:airline_powerline_fonts = 1 | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
" unicode symbols | |
let g:airline_symbols.crypt = 'π' | |
" powerline symbols | |
let g:airline_left_sep = 'ξ°' | |
let g:airline_left_alt_sep = 'ξ±' | |
let g:airline_right_sep = 'ξ²' | |
let g:airline_right_alt_sep = 'ξ³' | |
let g:airline_symbols.branch = 'ξ ' | |
let g:airline_symbols.readonly = 'ξ’' | |
let g:airline_symbols.linenr = 'β°' | |
let g:airline_symbols.maxlinenr = 'ξ‘' | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#show_tab_nr = 0 | |
let g:airline#extensions#whitespace#mixed_indent_algo = 2 | |
let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing', 'long' ] | |
nmap <leader>1 <Plug>AirlineSelectTab1 | |
nmap <leader>2 <Plug>AirlineSelectTab2 | |
nmap <leader>3 <Plug>AirlineSelectTab3 | |
nmap <leader>4 <Plug>AirlineSelectTab4 | |
nmap <leader>5 <Plug>AirlineSelectTab5 | |
nmap <leader>6 <Plug>AirlineSelectTab6 | |
nmap <leader>7 <Plug>AirlineSelectTab7 | |
nmap <leader>8 <Plug>AirlineSelectTab8 | |
nmap <leader>9 <Plug>AirlineSelectTab9 | |
"""""""""""""""""""""" | |
" vim-clang-format " | |
"""""""""""""""""""""" | |
let g:clang_format#code_style='llvm' | |
""""""""""""""""""""" | |
" chromatica.nvim " | |
""""""""""""""""""""" | |
let g:chromatica#libclang_path='/usr/lib/llvm-3.8/lib/libclang.so.1' | |
let g:chromatica#enable_at_startup=1 | |
""""""""" | |
" ale " | |
""""""""" | |
let g:ale_sign_error = 'Γ' | |
let g:ale_sign_warning = 'β ' | |
let g:ale_linters = { | |
\ 'javascript': ['standard'], | |
\} | |
nmap <silent> [e <Plug>(ale_previous_wrap) | |
nmap <silent> ]e <Plug>(ale_next_wrap) | |
""""""""""""""""""""""""" | |
" rainbow_parentheses " | |
""""""""""""""""""""""""" | |
let g:rbpt_colorpairs = [ | |
\ ['brown', 'RoyalBlue3'], | |
\ ['Darkblue', 'SeaGreen3'], | |
\ ['darkgray', 'DarkOrchid3'], | |
\ ['darkgreen', 'firebrick3'], | |
\ ['darkcyan', 'RoyalBlue3'], | |
\ ['darkred', 'SeaGreen3'], | |
\ ['darkmagenta', 'DarkOrchid3'], | |
\ ['brown', 'firebrick3'], | |
\ ['gray', 'RoyalBlue3'], | |
\ ['black', 'SeaGreen3'], | |
\ ['darkmagenta', 'DarkOrchid3'], | |
\ ['Darkblue', 'firebrick3'], | |
\ ['darkgreen', 'RoyalBlue3'], | |
\ ['darkcyan', 'SeaGreen3'], | |
\ ['darkred', 'DarkOrchid3'], | |
\ ['red', 'firebrick3'], | |
\ ] | |
let g:rbpt_max = 16 | |
let g:rbpt_loadcmd_toggle = 0 | |
au VimEnter * RainbowParenthesesToggle | |
au Syntax * RainbowParenthesesLoadRound | |
au Syntax * RainbowParenthesesLoadSquare | |
au Syntax * RainbowParenthesesLoadBraces | |
"""""""""""""""""" | |
" vim-startify " | |
"""""""""""""""""" | |
"let g:startify_custom_header = [] | |
"gen by: http://www.patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Neovim-qt | |
let g:ascii = [ | |
\ 'ββββ βββββββββββ βββββββ βββ ββββββββββ ββββ βββββββ βββββββββ', | |
\ 'βββββ βββββββββββββββββββββββ βββββββββββ βββββ ββββββββββββββββββ', | |
\ 'ββββββ βββββββββ βββ ββββββ ββββββββββββββββββββββββββ βββ βββ ', | |
\ 'ββββββββββββββββ βββ βββββββ βββββββββββββββββββββββββββββ βββ βββ ', | |
\ 'βββ βββββββββββββββββββββββ βββββββ ββββββ βββ βββ βββββββββ βββ ', | |
\ 'βββ βββββββββββββ βββββββ βββββ ββββββ βββ βββββββ βββ ', | |
\ ] | |
" center the header | |
function! s:filter_header(lines) abort | |
let longest_line = max(map(copy(a:lines), 'strwidth(v:val)')) | |
let centered_lines = map(copy(a:lines), | |
\ 'repeat(" ", (&columns / 2) - (longest_line / 2)) . v:val') | |
return centered_lines | |
endfunction | |
let g:startify_custom_header = s:filter_header(g:ascii) | |
let g:startify_list_order = [ | |
\ [' Bookmarks'], | |
\ 'bookmarks', | |
\ [' MRU directories'], | |
\ 'dir', | |
\ [' MRU files'], | |
\ 'files', | |
\ ] | |
let g:startify_bookmarks = [ | |
\ {'c': '~/AppData/Local/nvim/init.vim'}, | |
\ ] | |
let g:startify_custom_footer = | |
\ ['', " Vim is charityware. Please read ':help uganda'.", ''] | |
let g:startify_skiplist = [ | |
\ 'COMMIT_EDITMSG', | |
\ '/data/repo/neovim/runtime/doc', | |
\ '/Users/mhi/local/vim/share/vim/vim74/doc', | |
\ '~/AppData/Local/nvim/plugged', | |
\ ] | |
let g:startify_enable_special = 0 | |
let g:startify_files_number = 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment