"====== Plug Required Block and plugins set nocompatible filetype off call plug#begin('~/.vim/bundle') " Auto completion Plug 'prabirshrestha/vim-lsp' Plug 'mattn/vim-lsp-settings' Plug 'prabirshrestha/asyncomplete.vim' Plug 'prabirshrestha/asyncomplete-lsp.vim' Plug 'dense-analysis/ale' Plug 'andreypopp/asyncomplete-ale.vim' " Essential plugins Plug 'editorconfig/editorconfig-vim' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-endwise' Plug 'tpope/vim-surround' Plug 'vim-scripts/bufexplorer.zip' Plug 'Valloric/MatchTagAlways' Plug 'scrooloose/nerdcommenter' Plug 'preservim/nerdtree' Plug 'ctrlpvim/ctrlp.vim' Plug 'godlygeek/tabular' " Languages Plug 'sheerun/vim-polyglot' Plug 'hashivim/vim-terraform' Plug 'juliosueiras/vim-terraform-completion' Plug 'https://bitbucket.org/sw-samuraj/vim-gradle' Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } Plug 'ap/vim-css-color' " Snippets " Plug 'SirVer/ultisnips' " Plug 'honza/vim-snippets' " Themes Plug 'w0ng/vim-hybrid' " Plug 'sainnhe/everforest' " Plug 'NLKNguyen/papercolor-theme' " Editor styling Plug 'junegunn/gv.vim' Plug 'junegunn/limelight.vim' Plug 'junegunn/goyo.vim' " UI Styling Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'airblade/vim-gitgutter' " Plug 'majutsushi/tagbar' call plug#end() syntax on filetype plugin indent on "====== End of Plug Required Block and plugins let mapleader = ';' """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Colorscheme """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set background=dark colorscheme hybrid " Use darker backgrounnd 233, the default is 234, lighter color 235 (for color columns) highlight Normal ctermbg=233 highlight ColorColumn ctermbg=234 let &colorcolumn="80,".join(range(121,125),",") " Highlight the 80, 121-> columns " let &colorcolumn="80" " Highlight the 80th column only """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Vim variables """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set encoding=utf-8 " set the encoding to utf-8 set t_Co=256 " set terminal color 265 set clipboard=unnamedplus,unnamed " fix not copying between clipboard and vim if !empty($WAYLAND_DISPLAY) && executable('wl-copy') autocmd TextYankPost * silent! call system('wl-copy', @") endif set backspace=indent,eol,start " fix backspace not deleteing existing text set number " set numbers column on the left set complete-=i " Faster vim completion set complete+=k " Dictionary word completion using Ctrl+N set nrformats-=octal " Increment numbers decimally using Ctrl+A and Ctrl+X set autoindent " Auto indent " set smartindent " Smart indet (causes problems having differnt files indentation) set smarttab set softtabstop=2 " indentation set tabstop=2 " indentation set shiftwidth=2 " indentation set expandtab " convert tabs to spaces set ttyscroll=3 " speed up scrolling set ttyfast " Optimize for fast terminal connections set lazyredraw " to avoid scrolling problems " set ttimeout " less timeout for faster navigation " set ttimeoutlen=100 " time out for faster navigation set incsearch " Make search act like search in modern browsers set ignorecase " Ignore case when searching shortend ic " set noignorecase " Case Senetive searching shortend noic set smartcase " case-sensitive search if any caps set hlsearch " Highlight search things shortend hls or nohls set laststatus=2 " Always show the status line set ruler " Always show current position set showcmd " display incomplete commands set wildmenu " Turn on Wild menu set wildmode=longest:full,full set wildignore=*.o,*~,*.pyc " Ignore compiled files set wildoptions+=fuzzy " Allow fuzzy completion set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ set undofile " Save undo's after file closes set undodir=$HOME/.vim/undo " where to save undo histories set undolevels=200 " How many undos set undoreload=200 " number of lines to save for undo set fileformats+=mac " correct mac file format set tabpagemax=50 " Set the maximum number of tabs allowed set modeline " enable # vim: comments at file beginnings set modelines=1 " enable # vim: filetype=filetype comments in files " set nomodeline " disable the modelines set linebreak " Vim to wrap existing text as desired set nowrap " let Vim Wrap lines or leave them as long as they get set noeb vb t_vb= " set cursorline " highlight current line " set nocursorline " don't highlight current line set splitbelow " position the preview window below current windows set mouse=a " enable mouse movements, default set mouse= " set vim startup faster if !empty(&viminfo) set viminfo^=! endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "Fast saving and quiting nmap w :w nmap q :q "Use to clear the highlighting of :set hlsearch. nnoremap :nohlsearch "toggle folding set foldmethod=indent set foldlevelstart=20 nnoremap za "Easier window movement" "======================= nnoremap h :wincmd h nnoremap j :wincmd j nnoremap k :wincmd k nnoremap l :wincmd l nnoremap H 20< nnoremap J 10- nnoremap K 10+ nnoremap L 20> nnoremap mh H nnoremap mj J nnoremap mk K nnoremap ml L """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Specific FileTypes configurations """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" autocmd BufNewFile,BufRead *.html.erb set filetype=html " for ruby erb template files autocmd BufNewFile,BufRead *.json.jbuilder set filetype=ruby " for ruby json template files autocmd BufNewFile,BufRead,BufReadPost *.tsx set syntax=javascript " better tsx highlighting than polyglot defaults autocmd BufNewFile,BufRead *.yaml.gotmpl set filetype=yaml " for highlighting YAML go templates as yaml files autocmd BufNewFile,BufRead *.toml.j2 set filetype=toml.jinja2 " for highlighting TOML jinja2 templates autocmd BufNewFile,BufRead *.service.j2 set filetype=systemd.jinja2 " for highlighting systemd jinja2 templates autocmd BufNewFile,BufRead *.sh.j2 set filetype=sh.jinja2 " for highlighting shell jinja2 templates autocmd BufNewFile,BufRead *.conf.j2 set filetype=nginx.jinja2 " for highlighting nginx jinja2 templates autocmd BufNewFile,BufRead *.yml.j2 set filetype=yaml.jinja2 " for highlighting YAML jinja2 templates autocmd FileType gitcommit,markdown setlocal spell " spell check commits and markdown files autocmd FileType gitcommit,markdown set complete+=spell " spell complete with CTRL+N/CTRL+P autocmd FileType ruby setlocal nospell " disable spell checking for ruby documentation autocmd FileType json nnoremap :%!jq . """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugin maps """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "Ale "=== set completeopt=menu,menuone,popup,noselect,noinsert " show documentation in popups let g:ale_floating_preview = 1 " use popupwin feature instead of virtual text let g:ale_virtualtext_single = 0 " show one error at a time in the virutal text let g:ale_virtualtext_cursor = 0 " disable virtual text let g:ale_echo_cursor = 1 " echo the (error/warning) message to the hover section let g:ale_cursor_detail = 1 " preview window will open automatically on cursor " let g:ale_completion_max_suggestions = -1 " Increase suggestions let g:ale_linters = { \ 'go': ['gopls'], \} let g:go_fmt_command="gopls" let g:go_gopls_gofumpt=1 let g:ale_completion_enabled = 1 let g:ale_disable_lsp = 0 nmap :ALEHover nmap (ale_next_wrap) nmap (ale_previous_wrap) "Asyncomplete "============ " inoremap pumvisible() ? "\" : "\" " inoremap pumvisible() ? "\" : "\" " inoremap pumvisible() ? asyncomplete#close_popup() : "\" let g:asyncomplete_auto_popup = 0 function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~ '\s' endfunction inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ asyncomplete#force_refresh() inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? asyncomplete#close_popup() : "\" "vim-lsp "======= let g:lsp_diagnostics_enabled = 0 let g:lsp_document_highlight_enabled = 0 let g:lsp_document_code_action_signs_enabled = 0 "polyglot" "============= " let g:polyglot_disabled = ['typescript'] "NerdTree" "========= nnoremap nt :NERDTreeToggle nnoremap nn :NERDTree let g:NERDTreeMinimalMenu=1 "NerdCommenter" "============= let NERDSpaceDelims = 1 " add a space after comment delimiter "BufExp" "====== let g:bufExplorerShowRelativePath=1 " Show relative paths. let g:bufExplorerSortBy='fullpath' " Sort by file path. "Vim-airline "=========== let g:airline_theme='wombat' let g:airline_powerline_fonts = 0 let g:airline_symbols_ascii = 1 "seperators let g:airline_left_sep = '' let g:airline_right_sep = '' "modes " let g:airline_section_b="" let g:airline_section_x="" let g:airline_section_y="" " let g:airline_section_gutter="" "extensions let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#whitespace#enabled = 0 let g:airline#extensions#tabline#enabled = 0 let g:airline#extensions#ale#enabled = 1 "Gitgutter "========= set signcolumn=yes set updatetime=100 let g:gitgutter_map_keys = 0 let g:gitgutter_realtime = 0 let g:gitgutter_eager = 0 " let g:gitgutter_async = 0 highlight SignColumn ctermbg=233 highlight GitGutterAdd ctermfg=2 ctermbg=233 highlight GitGutterChange ctermfg=3 ctermbg=233 highlight GitGutterDelete ctermfg=1 ctermbg=233 "UltiSnips "========= let g:UltiSnipsExpandTrigger = "" let g:UltiSnipsJumpForwardTrigger = '' let g:UltiSnipsJumpBackwardTrigger = '' "CtrlP "===== let g:ctrlp_custom_ignore = '\v[\/](coverage|doc|vendor|tmp|.tmp|bower_components|node_modules|dist|spec/fixtures/vcr_cassettes)$' "MatchTagAlways "============== let g:mta_filetypes = { 'html' : 1 } "RuboCop "======= let g:vimrubocop_keymap = 0 let g:vimrubocop_rubocop_cmd = 'bundle exec rubocop ' "Limelight "========= nmap f :Limelight!! "Goyo "==== " nmap g :Goyo "Tagbar "====== " nmap tt :TagbarToggle