mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Restructure vimrc
This commit is contained in:
parent
1d065a9a77
commit
c08116ae5e
|
@ -1,31 +1,3 @@
|
||||||
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
|
|
||||||
set history=1000 " More history
|
|
||||||
set hlsearch " Highlight Search
|
|
||||||
set expandtab " Expand tabs to spaces (inverse: noexpandtab)
|
|
||||||
set tabstop=4 " Tab size
|
|
||||||
set shiftwidth=4 " Indentation size
|
|
||||||
set softtabstop=4 " Tabs/Spaces interrop
|
|
||||||
set tabpagemax=50 " More tabs
|
|
||||||
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
|
|
||||||
set formatoptions+=j " Delete comment character when joining commented lines
|
|
||||||
set autoread " Reload files on change
|
|
||||||
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)
|
|
||||||
syntax enable " Turn on syntax highlighting
|
|
||||||
|
|
||||||
" XDG Support
|
" XDG Support
|
||||||
" Avoid using this with root, sudo causes issues with this
|
" Avoid using this with root, sudo causes issues with this
|
||||||
if empty($MYVIMRC) | let $MYVIMRC = expand('<sfile>:p') | endif
|
if empty($MYVIMRC) | let $MYVIMRC = expand('<sfile>:p') | endif
|
||||||
|
@ -49,11 +21,66 @@ set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p')
|
||||||
set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p')
|
set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p')
|
||||||
set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
|
set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
|
||||||
|
|
||||||
" Have Vim jump to the last position when reopening a file
|
" Install plugins automatically
|
||||||
if has("autocmd")
|
if ! filereadable(system('echo -n "${HOME}/.local/share/vim/autoload/plug.vim"'))
|
||||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\""
|
echo "Downloading junegunn/vim-plug to manage plugins..."
|
||||||
|
silent !mkdir -p ~/.local/share/vim/autoload
|
||||||
|
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.local/share/vim/autoload/plug.vim
|
||||||
|
autocmd VimEnter * PlugInstall
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Vim-Plug (Plugins)
|
||||||
|
call plug#begin('~/.local/share/vim/plugged')
|
||||||
|
Plug 'airblade/vim-gitgutter' " Shows Git diff
|
||||||
|
Plug 'preservim/nerdcommenter' " Language based comment syntax
|
||||||
|
Plug 'preservim/nerdtree' " File manager (nerdtree)
|
||||||
|
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " Highlighting for nerdtree
|
||||||
|
Plug 'joshdick/onedark.vim' " OneDark theme
|
||||||
|
Plug 'ryanoasis/vim-devicons' " Icons for nerdtree and airline
|
||||||
|
Plug 'vim-airline/vim-airline' " AirLine statusline
|
||||||
|
Plug 'vim-airline/vim-airline-themes' " AirLine statusline themes
|
||||||
|
Plug 'jiangmiao/auto-pairs' " Quote and bracket completion
|
||||||
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Auto-completion [NVIM only]
|
||||||
|
Plug 'neomake/neomake' " Syntax checking
|
||||||
|
Plug 'zchee/deoplete-jedi' " Python jedi autocompletion
|
||||||
|
Plug 'davidhalter/jedi-vim' " Python implementation check
|
||||||
|
Plug 'vim-python/python-syntax' " Autodetect python syntax
|
||||||
|
Plug 'PotatoesMaster/i3-vim-syntax' " Autodetect i3 config syntax
|
||||||
|
Plug 'wakatime/vim-wakatime' " Wakatime integration for coding stats
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
" Some basics
|
||||||
|
filetype plugin on " Enable filetype detection
|
||||||
|
syntax on " Turn on syntax highlighting
|
||||||
|
set number relativenumber " Show relative line numbers
|
||||||
|
set wildmode=longest,list,full " Enable autocompletion
|
||||||
|
set undolevels=999 " Lots of these
|
||||||
|
set history=1000 " More history
|
||||||
|
set expandtab " Expand tabs to spaces (inverse: noexpandtab)
|
||||||
|
set tabstop=4 " Tab size
|
||||||
|
set shiftwidth=4 " Indentation size
|
||||||
|
set softtabstop=4 " Tabs/Spaces interrop
|
||||||
|
set tabpagemax=50 " More tabs
|
||||||
|
set autoindent " Enable autoindent
|
||||||
|
set cursorline " Highlight cursor line
|
||||||
|
set noruler " Don't show ruler, line is highlighted by above
|
||||||
|
set showmatch " Show matching brackets
|
||||||
|
set ignorecase " Do case insensitive matching
|
||||||
|
set incsearch " Show partial matches for a search phrase
|
||||||
|
set hlsearch " Highlight Search
|
||||||
|
set laststatus=2 " Always show status line
|
||||||
|
set splitbelow splitright " Split in more natural way
|
||||||
|
set autoread " Reload files on change
|
||||||
|
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)
|
||||||
|
|
||||||
|
" Disable automatic commenting on newline
|
||||||
|
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
||||||
|
|
||||||
|
" Have Vim jump to the last position when reopening a file
|
||||||
|
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\""
|
||||||
|
|
||||||
" Automatically deletes all trailing whitespace on save
|
" Automatically deletes all trailing whitespace on save
|
||||||
autocmd BufWritePre * %s/\s\+$//e
|
autocmd BufWritePre * %s/\s\+$//e
|
||||||
|
|
||||||
|
@ -63,39 +90,18 @@ nnoremap <C-j> <C-w>j
|
||||||
nnoremap <C-k> <C-w>k
|
nnoremap <C-k> <C-w>k
|
||||||
nnoremap <C-l> <C-w>l
|
nnoremap <C-l> <C-w>l
|
||||||
|
|
||||||
" Make adjusing split sizes a bit more friendly
|
" Make adjusting split sizes a bit more friendly
|
||||||
noremap <silent> <C-Left> :vertical resize +3<CR>
|
noremap <silent> <C-Left> :vertical resize +3<CR>
|
||||||
noremap <silent> <C-Right> :vertical resize -3<CR>
|
noremap <silent> <C-Right> :vertical resize -3<CR>
|
||||||
noremap <silent> <C-Up> :resize +3<CR>
|
noremap <silent> <C-Up> :resize +3<CR>
|
||||||
noremap <silent> <C-Down> :resize -3<CR>
|
noremap <silent> <C-Down> :resize -3<CR>
|
||||||
|
|
||||||
" System clipboard interractions
|
" System clipboard interactions
|
||||||
map <C-c> "+y
|
map <C-c> "+y
|
||||||
vnoremap <C-v> "+p
|
vnoremap <C-v> "+p
|
||||||
|
|
||||||
" Vim-Plug (Plugins)
|
" Spell-check set to <leader>o, 'o' for 'orthography'
|
||||||
call plug#begin('~/.local/share/vim/plugged')
|
map <leader>o :setlocal spell! spelllang=en_US<CR>
|
||||||
|
|
||||||
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
|
|
||||||
Plug 'wakatime/vim-wakatime' " Wakatime integration for coding stats
|
|
||||||
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
|
|
||||||
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
" User interface / Theme
|
" User interface / Theme
|
||||||
colorscheme onedark
|
colorscheme onedark
|
||||||
|
@ -108,21 +114,26 @@ set guioptions-=L " remove left-hand scrollbar
|
||||||
let g:airline_theme='onedark'
|
let g:airline_theme='onedark'
|
||||||
let g:airline#extensions#tabline#enabled = 1
|
let g:airline#extensions#tabline#enabled = 1
|
||||||
let g:airline#tabline#formatter = 'unique_tail'
|
let g:airline#tabline#formatter = 'unique_tail'
|
||||||
|
let g:webdevicons_enable_airline_statusline = 0
|
||||||
if empty($DISPLAY) " Automatically apply ASCII only config if we don't have DISPLAY (TTY)
|
if empty($DISPLAY) " Automatically apply ASCII only config if we don't have DISPLAY (TTY)
|
||||||
let g:airline_left_sep = '►'
|
let g:airline_left_sep = '>' " Alternatively: '►'
|
||||||
let g:airline_right_sep = '◄'
|
let g:airline_right_sep = '<' " Alternatively: '◄'
|
||||||
let g:airline_symbols_ascii = 1
|
let g:airline_symbols_ascii = 1
|
||||||
|
let g:webdevicons_enable_airline_tabline = 0 " don't use symbols from vim-devicons
|
||||||
else
|
else
|
||||||
let g:airline_left_sep = "\uE0B0"
|
let g:airline_left_sep = "\uE0B0"
|
||||||
let g:airline_right_sep = "\uE0B2"
|
let g:airline_right_sep = "\uE0B2"
|
||||||
|
let g:airline_powerline_fonts = 1 " use nice symbols from powerline fonts
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Neomake
|
" Neomake
|
||||||
|
" Requires: pip install flake8
|
||||||
let g:neomake_python_enabled_makers = ['flake8']
|
let g:neomake_python_enabled_makers = ['flake8']
|
||||||
let g:neomake_python_flake8_maker = {'args': ['--ignore=E501', '--format=default']}
|
let g:neomake_python_flake8_maker = {'args': ['--ignore=E501', '--format=default']}
|
||||||
call neomake#configure#automake('nrwi', 500)
|
call neomake#configure#automake('nrwi', 500)
|
||||||
|
|
||||||
" Deoplete
|
" Deoplete
|
||||||
|
" Requires: pip install pynvim
|
||||||
let g:deoplete#enable_at_startup = 1
|
let g:deoplete#enable_at_startup = 1
|
||||||
|
|
||||||
" Jedi-vim
|
" Jedi-vim
|
||||||
|
@ -137,4 +148,6 @@ let NERDTreeShowLineNumbers=1
|
||||||
let NERDTreeShowHidden=1
|
let NERDTreeShowHidden=1
|
||||||
let NERDTreeMinimalUI = 1
|
let NERDTreeMinimalUI = 1
|
||||||
let g:NERDTreeWinSize=38
|
let g:NERDTreeWinSize=38
|
||||||
|
if empty($DISPLAY) " Disable devicons for nerdtree in TTY
|
||||||
|
let g:webdevicons_enable_nerdtree = 0
|
||||||
|
endif
|
||||||
|
|
Loading…
Reference in a new issue