" _ " _ __ ___ _____ _(_)_ __ ___ " | '_ \ / _ \/ _ \ \ / / | '_ ` _ \ " | | | | __/ (_) \ V /| | | | | | | " |_| |_|\___|\___/ \_/ |_|_| |_| |_| " "=========================== " Load vim-plug for plugins "=========================== if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) echo "Downloading junegunn/vim-plug to manage plugins..." silent !mkdir -p ~/.config/nvim/autoload/ silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim autocmd VimEnter * PlugInstall endif call plug#begin('~/.config/nvim/bundle') " Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug '~/.fzf' Plug 'junegunn/fzf.vim' Plug 'scrooloose/nerdtree' Plug 'dense-analysis/ale' Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' } Plug 'Shougo/deoplete-clangx' " Plug 'https://github.com/Shougo/neco-vim' " Plug 'https://github.com/Shougo/neoinclude.vim' Plug 'deoplete-plugins/deoplete-jedi' Plug 'deoplete-plugins/deoplete-zsh' Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'} Plug 'ervandew/supertab' Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' Plug 'mattn/emmet-vim' Plug 'airblade/vim-gitgutter' Plug 'tpope/vim-fugitive' Plug '~/.config/nvim/bundle/vim-trailing-whitespace' Plug 'tpope/vim-surround' Plug 'tpope/vim-commentary' Plug 'jiangmiao/auto-pairs' Plug 'itchyny/lightline.vim' "Plug '~/.config/nvim/bundle/lightline-simple/' Plug 'sheerun/vim-polyglot' Plug 'luochen1990/rainbow' Plug 'christoomey/vim-tmux-navigator' Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } Plug 'tpope/vim-fugitive' Plug 'junegunn/gv.vim' Plug 'matze/vim-move' call plug#end() "============= " Basic stuff "============= syntax on filetype plugin indent on set scrolloff=5 set pumheight=10 set autoindent set smarttab set number number set clipboard=unnamedplus set inccommand=nosplit set tabstop=4 set shiftwidth=4 set ignorecase set smartcase set undofile set background=light set mouse=a set splitright set splitbelow " Restore cursor position function! ResCur() if line("'\"") <= line("$") normal! g`" return 1 endif endfunction augroup resCur autocmd! autocmd BufWinEnter * call ResCur() augroup END "============= " Colorscheme "============= hi LineNr ctermfg=6 cterm=NONE hi CursorLineNr ctermfg=5 cterm=bold hi ColorColumn ctermbg=0 ctermfg=1 cterm=undercurl hi SignColumn ctermfg=7 hi VertSplit ctermbg=8 ctermfg=0 hi Comment ctermfg=4 hi String ctermfg=1 hi Visual ctermbg=8 hi Search ctermbg=8 cterm=bold,reverse hi MatchParen ctermbg=0 ctermfg=3 cterm=bold hi Statement ctermfg=3 hi ErrorMsg ctermbg=0 ctermfg=1 hi Error ctermbg=1 ctermfg=0 cterm=undercurl hi SpellBad ctermbg=1 ctermfg=0 cterm=undercurl hi SpellCap ctermbg=2 ctermfg=0 cterm=undercurl hi SpellRare ctermbg=3 ctermfg=0 cterm=undercurl hi SpellLocal ctermbg=5 ctermfg=0 cterm=undercurl hi DiffAdd ctermbg=2 ctermfg=0 hi DiffChange ctermbg=4 ctermfg=0 hi DiffDelete ctermbg=1 ctermfg=0 hi DiffText ctermbg=4 ctermfg=0 hi Folded ctermbg=8 hi FoldColumn ctermbg=8 hi Pmenu ctermbg=0 ctermfg=4 hi PmenuSel ctermbg=8 ctermfg=4 hi PmenuThumb ctermbg=8 ctermfg=8 hi PmenuSbar ctermbg=0 ctermfg=0 " Highlight current line hi CursorLine ctermbg=8 cterm=NONE hi CursorColumn ctermbg=8 cterm=NONE augroup CursorLine au! "au VimEnter,WinEnter,BufWinEnter * setlocal cursorcolumn au VimEnter,WinEnter,BufWinEnter * setlocal cursorline au WinLeave * setlocal nocursorline augroup END " Statusline set laststatus=2 hi StatusLine ctermbg=8 ctermfg=blue cterm=NONE hi StatusLineNC ctermbg=8 ctermfg=blue cterm=NONE hi User1 ctermbg=NONE ctermfg=blue hi User2 ctermbg=NONE ctermfg=blue hi User3 ctermbg=NONE ctermfg=blue hi User4 ctermbg=8 ctermfg=blue set statusline+=\ %y " File type set statusline+=\ %1*\ " Padding & switch colour set statusline+=%t\ " File name set statusline+=%M " Modified flag set statusline+=\ %2*\ " Padding & switch colour set statusline+=%= " Switch to right-side set statusline+=\ %3*\ " Padding & switch colour set statusline+=%p%% " Current line set statusline+=\ %4*\ " Padding & switch colour set statusline+=%{&fileencoding?&fileencoding:&encoding}\ " File coding " Lightline - statusline hi StatusLine ctermbg=8 ctermfg=4 cterm=NONE hi StatusLineNC ctermbg=8 ctermfg=4 cterm=NONE set noshowmode let g:lightline = { \ 'colorscheme': 'seoul256', \ 'active': { \ 'left': [ [ 'mode' ], \ [ 'readonly', 'filename', 'gitbranch' ], \ [ 'modified' ] ], \ 'right': [ [ 'filetype', 'fileencoding' ], \ [ 'percent' ] ] \ }, \ 'component_function': { \ 'gitbranch': 'fugitive#head' \ }, \ } "================ " Plugin configs "================ let g:move_key_modifier = 'S' " ALE - Asynchronous Lint Engine hi ALEWarning cterm=undercurl hi ALEError cterm=undercurl hi ALEWarningSign ctermbg=0 ctermfg=3 cterm=bold hi ALEErrorSign ctermbg=0 ctermfg=1 cterm=bold let g:ale_linters = { \ 'c': ['ccls', 'clang'], \ 'cpp': ['ccls', 'clang'], \ 'javascript': ['eslint'], \ 'php': ['php'], \ 'python': ['pyls', 'flake8'], \ 'sh': ['language_server', 'shellcheck', 'shell'], \ 'zsh': ['language_server', 'shellcheck', 'shell'], \ 'go': ['gofmt'], \} let g:ale_fixers = { \ '*': ['trim_whitespace', 'remove_trailing_lines'], \ 'c': ['clang-format'], \ 'cpp': ['clang-format'], \ 'css': ['prettier'], \ 'go': ['gofmt'], \ 'html': ['prettier'], \ 'javascript': ['prettier'], \ 'json': ['prettier'], \ 'php': ['prettier'], \ 'python': ['black'], \ 'scss': ['prettier'], \ 'yaml': ['prettier'], \} " fzf colors let g:fzf_colors = \ { 'fg': ['fg', 'Normal'], \ 'bg': ['bg', 'Normal'], \ 'hl': ['fg', 'Comment'], \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'Statement'], \ 'info': ['fg', 'PreProc'], \ 'border': ['fg', 'Ignore'], \ 'prompt': ['fg', 'Conditional'], \ 'pointer': ['fg', 'Exception'], \ 'marker': ['fg', 'Keyword'], \ 'spinner': ['fg', 'Label'], \ 'header': ['fg', 'Comment'] } " Default fzf layout let g:fzf_layout = { 'down': '~50%' } " Python paths, needed for virtualenvs let g:python3_host_prog = '/usr/bin/python3' let g:python_host_prog = '/usr/bin/python2' " Go - $ go get -u github.com/stamblerre/gocode let g:deoplete#sources#go#gocode_binary = "$HOME/go/bin/gocode" " LaTeX let g:livepreview_previewer = 'zathura' " Enable "Rainbow Parentheses Improved" let g:rainbow_active = 1 " Whitspace let g:extra_whitespace_ignored_filetypes = [ 'help', 'vim-plug' ] " GitGutter set updatetime=1000 hi GitGutterChange ctermbg=0 ctermfg=3 cterm=bold hi GitGutterAdd ctermbg=0 ctermfg=2 cterm=bold hi GitGutterDelete ctermbg=0 ctermfg=1 cterm=bold hi GitGutterChangeDelete ctermbg=0 ctermfg=5 cterm=bold " Open Nerd Tree if no files were specified autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " Emmet settings let g:user_emmet_mode='a' let g:user_emmet_leader_key=',' let g:user_emmet_install_global = 0 autocmd FileType html,css EmmetInstall " Deoplete - autocompletion let g:deoplete#enable_at_startup = 1 set completeopt-=preview call deoplete#custom#source('ultisnips', 'rank', 1000) " AutoPairs let g:AutoPairs={'(':')', '[':']', '{':'}', "'":"'", '"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''"} "'<':'>', "On startup, go to the last changes "au BufEnter * :'. " If you want :UltiSnipsEdit to split your window. " let g:UltiSnipsEditSplit="vertical" "=================== " Language-specific "=================== augroup langindentation autocmd Filetype c setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype cpp setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype css setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype javascript setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype html setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype json setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype scss setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype php setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype yaml setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 augroup END "============== " Key Bindings "============== " Leader key let mapleader = ' ' " enable/disable deoplete map d :call deoplete#toggle() " gitgutter maping map gt :GitGutterToggle nmap gn (GitGutterNextHunk) nmap gN (GitGutterPrevHunk) nmap gs (GitGutterStageHunk) nmap gu (GitGutterUndoHunk) nmap gp (GitGutterPreviewHunk) " Disable hlsearch map :noh " Go to last change map l :'. " Complete with " inoremap pumvisible()?"\":"\" " inoremap pumvisible()?"\":"\" " When line overflows, it will go " one _visual_ line and not actual map j gj map k gk " fzf, fuzzy finder nnoremap :Files nnoremap :GFiles let g:fzf_action = { \ 'ctrl-t': 'tab split', \ 'ctrl-x': 'split', \ 'ctrl-v': 'vsplit' } imap (fzf-complete-word) imap (fzf-complete-path) imap (fzf-complete-file-ag) imap (fzf-complete-line) map :NERDTreeToggle " SuperTab let g:SuperTabMappingTabLiteral = '' let g:SuperTabDefaultCompletionType = 'context' let g:SuperTabContextDefaultCompletionType = '' " LaTeX map l :LLPStartPreview " ALE - Asynchronous Lint Engine map fw :FixWhitespace map af :ALEFix map an :ALENext map aN :ALEPrevious map ad :ALEDetail map ag :ALEGoToDefinitionInSplit map aG :ALEGoToDefinition " Tab Managment map :tabnew map :tabclose nnoremap gT nnoremap gt " Split Managment nnoremap nnoremap nnoremap nnoremap " Spell-check (English US and Polish) map :setlocal spell! spelllang=en_us map :setlocal spell! spelllang=pl " Sudo read-only file cnoremap sudow w !sudo tee % >/dev/null " Open terminal map :vsplit term://zsh " Exit from terminal mode tnoremap " UltiSnips let g:UltiSnipsExpandTrigger='' let g:UltiSnipsJumpForwardTrigger='' let g:UltiSnipsJumpBackwardTrigger='' let g:UltiSnipsListSnippets='' "==Encoding== scriptencoding utf-8