2020-10-22 20:51:47 +00:00
|
|
|
set encoding=utf-8 " Use UTF-8
|
|
|
|
set showmatch " Show matching brackets
|
|
|
|
set ignorecase " Do case insensitive matching
|
|
|
|
set incsearch " Show partial matches for a search phrase
|
|
|
|
set number " Show numbers
|
|
|
|
set relativenumber " Show relative numbersi
|
|
|
|
set undolevels=999 " Lots of these
|
2021-05-10 17:03:35 +00:00
|
|
|
set history=1000 " More history
|
2020-10-22 20:51:47 +00:00
|
|
|
set hlsearch " Highlight Search
|
2021-05-10 22:40:56 +00:00
|
|
|
set expandtab " Expand tabs to spaces (inverse: noexpandtab)
|
2021-05-10 17:03:35 +00:00
|
|
|
set tabstop=4 " Tab size
|
2020-10-22 20:51:47 +00:00
|
|
|
set shiftwidth=4 " Indentation size
|
|
|
|
set softtabstop=4 " Tabs/Spaces interrop
|
2021-05-10 17:03:35 +00:00
|
|
|
set tabpagemax=50 " More tabs
|
2020-10-22 20:51:47 +00:00
|
|
|
set autoindent " Enable autoindent
|
|
|
|
set ruler " Show cursor position
|
|
|
|
set cursorline " Highlight cursor line
|
|
|
|
set backspace=indent,eol,start " Delete everything
|
|
|
|
set laststatus=2 " Always show status line
|
|
|
|
set wildmode=longest,list,full " Enable autocompletion
|
|
|
|
set splitbelow splitright " Split in more natural way
|
2021-05-10 17:03:35 +00:00
|
|
|
set formatoptions+=j " Delete comment character when joining commented lines
|
|
|
|
set autoread " Reload files on change
|
2021-05-10 22:40:56 +00:00
|
|
|
set mouse=a " Enable mouse mode
|
|
|
|
set encoding=utf-8 " Use UTF-8, not ASCII (May cause issues on TTY)
|
|
|
|
"set termguicolors " Use true colors (256) (May cause issues on TTY)
|
2021-05-10 17:03:35 +00:00
|
|
|
syntax enable " Turn on syntax highlighting
|
2020-10-22 20:51:47 +00:00
|
|
|
|
2021-03-23 21:20:23 +00:00
|
|
|
" XDG Support
|
2021-05-10 17:03:35 +00:00
|
|
|
" Avoid using this with root, sudo causes issues with this
|
2021-03-23 21:20:23 +00:00
|
|
|
if empty($MYVIMRC) | let $MYVIMRC = expand('<sfile>:p') | endif
|
|
|
|
|
|
|
|
if empty($XDG_CACHE_HOME) | let $XDG_CACHE_HOME = $HOME."/.cache" | endif
|
|
|
|
if empty($XDG_CONFIG_HOME) | let $XDG_CONFIG_HOME = $HOME."/.config" | endif
|
|
|
|
if empty($XDG_DATA_HOME) | let $XDG_CONFIG_HOME = $HOME."/.local/share" | endif
|
|
|
|
|
2021-03-09 20:44:08 +00:00
|
|
|
set runtimepath^=$XDG_CONFIG_HOME/vim
|
|
|
|
set runtimepath+=$XDG_DATA_HOME/vim
|
|
|
|
set runtimepath+=$XDG_CONFIG_HOME/vim/after
|
|
|
|
|
2021-03-23 21:20:23 +00:00
|
|
|
set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim
|
2021-03-09 20:44:08 +00:00
|
|
|
set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after
|
|
|
|
|
|
|
|
let g:netrw_home = $XDG_DATA_HOME."/vim"
|
|
|
|
call mkdir($XDG_DATA_HOME."/vim/spell", 'p')
|
|
|
|
set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p')
|
|
|
|
|
|
|
|
set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p')
|
|
|
|
set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p')
|
|
|
|
set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
|
|
|
|
|
2020-10-22 20:51:47 +00:00
|
|
|
" Have Vim jump to the last position when reopening a file
|
|
|
|
if has("autocmd")
|
|
|
|
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\""
|
|
|
|
endif
|
|
|
|
|
2021-05-10 17:03:35 +00:00
|
|
|
" Automatically deletes all trailing whitespace on save
|
|
|
|
autocmd BufWritePre * %s/\s\+$//e
|
2020-10-22 20:51:47 +00:00
|
|
|
|
2021-05-10 17:03:35 +00:00
|
|
|
" Remap splits navigation to just CTRL + hjkl
|
|
|
|
nnoremap <C-h> <C-w>h
|
|
|
|
nnoremap <C-j> <C-w>j
|
|
|
|
nnoremap <C-k> <C-w>k
|
|
|
|
nnoremap <C-l> <C-w>l
|
2020-10-22 20:51:47 +00:00
|
|
|
|
2021-05-10 17:03:35 +00:00
|
|
|
" Make adjusing split sizes a bit more friendly
|
|
|
|
noremap <silent> <C-Left> :vertical resize +3<CR>
|
|
|
|
noremap <silent> <C-Right> :vertical resize -3<CR>
|
|
|
|
noremap <silent> <C-Up> :resize +3<CR>
|
|
|
|
noremap <silent> <C-Down> :resize -3<CR>
|
|
|
|
|
2021-05-10 22:40:56 +00:00
|
|
|
" System clipboard interractions
|
2021-05-10 21:15:09 +00:00
|
|
|
map <C-c> "+y
|
|
|
|
vnoremap <C-v> "+p
|
|
|
|
|
2021-05-10 22:40:56 +00:00
|
|
|
" Vim-Plug (Plugins)
|
2021-05-10 21:15:09 +00:00
|
|
|
call plug#begin('~/.local/share/vim/plugged')
|
2020-10-22 20:51:47 +00:00
|
|
|
|
2021-05-10 22:40:56 +00:00
|
|
|
Plug 'airblade/vim-gitgutter' " Shows Git diff
|
|
|
|
Plug 'jiangmiao/auto-pairs' " Quote and bracket completion
|
|
|
|
Plug 'neomake/neomake' " Syntax checking
|
|
|
|
Plug 'zchee/deoplete-jedi' " Pyhon jedi autocompletion
|
|
|
|
Plug 'davidhalter/jedi-vim' " Python implementation check
|
|
|
|
Plug 'preservim/nerdcommenter' " Comment plugin
|
|
|
|
Plug 'preservim/nerdtree' " File manager
|
|
|
|
Plug 'joshdick/onedark.vim' " OneDark theme
|
|
|
|
Plug 'vim-airline/vim-airline' " AirLine statusline
|
|
|
|
Plug 'vim-airline/vim-airline-themes' " AirLine statusline themes
|
|
|
|
if has('nvim')
|
|
|
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Auto-completion
|
|
|
|
else
|
|
|
|
Plug 'Shougo/deoplete.nvim'
|
|
|
|
Plug 'roxma/nvim-yarp'
|
|
|
|
Plug 'roxma/vim-hug-neovim-rpc'
|
|
|
|
endif
|
2021-05-10 17:03:35 +00:00
|
|
|
|
2021-05-10 21:15:09 +00:00
|
|
|
call plug#end()
|
2020-10-22 20:51:47 +00:00
|
|
|
|
2021-05-10 17:03:35 +00:00
|
|
|
" User interface / Theme
|
|
|
|
colorscheme onedark
|
|
|
|
set guioptions-=m " remove menubar
|
|
|
|
set guioptions-=T " remove toolbar
|
|
|
|
set guioptions-=r " remove right-hand scrollbar
|
|
|
|
set guioptions-=L " remove left-hand scrollbar
|
|
|
|
|
|
|
|
" Airline
|
|
|
|
let g:airline_theme='onedark'
|
|
|
|
let g:airline#extensions#tabline#enabled = 1
|
|
|
|
let g:airline#tabline#formatter = 'unique_tail'
|
2021-05-10 22:52:55 +00:00
|
|
|
if empty($DISPLAY) " Automatically apply ASCII only config if we don't have DISPLAY (TTY)
|
|
|
|
let g:airline_left_sep = '►'
|
|
|
|
let g:airline_right_sep = '◄'
|
|
|
|
let g:airline_symbols_ascii = 1
|
|
|
|
else
|
|
|
|
let g:airline_left_sep = "\uE0B0"
|
|
|
|
let g:airline_right_sep = "\uE0B2"
|
|
|
|
endif
|
2020-10-22 20:51:47 +00:00
|
|
|
|
2021-05-10 22:40:56 +00:00
|
|
|
" Neomake
|
|
|
|
let g:neomake_python_enabled_makers = ['flake8']
|
|
|
|
let g:neomake_python_flake8_maker = {'args': ['--ignore=E501', '--format=default']}
|
|
|
|
call neomake#configure#automake('nrwi', 500)
|
|
|
|
|
|
|
|
" Deoplete
|
|
|
|
let g:deoplete#enable_at_startup = 1
|
|
|
|
|
|
|
|
" Jedi-vim
|
|
|
|
let g:jedi#completions_enabled = 0 " disable completions, since we use deoplete
|
|
|
|
let g:jedi#use_splits_not_buffers = "right"
|
|
|
|
|
|
|
|
" NERDTree
|
|
|
|
map <C-n> :NERDTreeToggle<CR>
|
2021-05-10 22:52:55 +00:00
|
|
|
let g:NERDTreeDirArrowExpandable = '►'
|
|
|
|
let g:NERDTreeDirArrowCollapsible = '▼'
|
2021-05-10 22:40:56 +00:00
|
|
|
let NERDTreeShowLineNumbers=1
|
|
|
|
let NERDTreeShowHidden=1
|
|
|
|
let NERDTreeMinimalUI = 1
|
|
|
|
let g:NERDTreeWinSize=38
|
2021-05-10 17:03:35 +00:00
|
|
|
|