Skip to content

Instantly share code, notes, and snippets.

@eugene-babichenko
Created August 20, 2018 21:14
Show Gist options
  • Save eugene-babichenko/27b4f1e1848cae9d6c95c48dd214a787 to your computer and use it in GitHub Desktop.
Save eugene-babichenko/27b4f1e1848cae9d6c95c48dd214a787 to your computer and use it in GitHub Desktop.
" BASIC SETTINGS BEGIN
set backspace=indent,eol,start " backspace everything
set number " enable line numbering
set noerrorbells " disable beeps
set title " show the current filename in the window title
set cursorline " highlight current line
" remove underline
hi CursorLine cterm=none
set wildmenu " visual autocomplete for commands
set wildignore=*.swp " ignore list for wildmenu
set lazyredraw " optimize for drawing speed
set showmatch " highlight brackets matches
set incsearch " search as characters are entered
set hlsearch " highlight search matches
set nobackup " disable native backups
set noswapfile " disable swap files
set mouse=a " enable mouse (yeah, I'm a fucking newbie)
set showtabline=2 " always show tabline
" Make line numbers distinct from code
hi LineNr ctermfg=grey ctermbg=black
" Enable bi-directional integration with the OS clipboard
set clipboard=unnamed
" Tabs settings
set tabstop=4 " Show 4 spaces per <TAB>
set softtabstop=4
set expandtab " convert tabs to spaces
" Customize netrw
let g:netrw_banner = 0
let g:netrw_winsize = 25 " width of vertical split
let g:netrw_list_hide = &wildignore " use ignorelist
" Custom mappings
" disable search highlight when , is pressed
nnoremap <leader><space> :nohlsearch<CR>
" easier window navigation
nnoremap <C-H> <C-W>h
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-L> <C-W>l
" BASIC SETTINGS END
" PLUGIN SETUP BEGIN
call plug#begin('~/.local/share/nvim/plugged')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh', }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive'
Plug 'ekalinin/Dockerfile.vim'
Plug 'cespare/vim-toml'
Plug 'tpope/vim-sleuth'
Plug 'xolox/vim-misc'
Plug 'xolox/vim-session'
Plug 'mhinz/vim-signify'
Plug 'sodapopcan/vim-twiggy'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'terryma/vim-multiple-cursors'
call plug#end()
" PLUGIN SETUP END
" LanguageClient setup
set hidden
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
\ 'python': ['/usr/local/bin/pyls'],
\ }
" Use deoplete.
let g:deoplete#enable_at_startup = 1
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
highlight SignifySignAdd cterm=bold ctermbg=none ctermfg=119
highlight SignifySignDelete cterm=bold ctermbg=none ctermfg=167
highlight SignifySignChange cterm=bold ctermbg=none ctermfg=227
let g:signify_update_on_bufenter = 1
let g:vim_markdown_folding_disabled = 1
" Remove all detached buffers
function! Wipeout()
" list of *all* buffer numbers
let l:buffers = range(1, bufnr('$'))
" what tab page are we in?
let l:currentTab = tabpagenr()
try
" go through all tab pages
let l:tab = 0
while l:tab < tabpagenr('$')
let l:tab += 1
" go through all windows
let l:win = 0
while l:win < winnr('$')
let l:win += 1
" whatever buffer is in this window in this tab, remove it from
" l:buffers list
let l:thisbuf = winbufnr(l:win)
call remove(l:buffers, index(l:buffers, l:thisbuf))
endwhile
endwhile
" if there are any buffers left, delete them
if len(l:buffers)
execute 'bwipeout' join(l:buffers)
endif
finally
" go back to our original tab page
execute 'tabnext' l:currentTab
endtry
endfunction
function! CheckNewPlugins()
if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
PlugInstall --sync | q | PlugClean! | q
endif
endfunction
autocmd! bufwritepost init.vim source % | :call CheckNewPlugins()
autocmd VimEnter * :call CheckNewPlugins()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment