Update vimrc

This commit is contained in:
ItsDrike 2021-05-10 19:03:35 +02:00
parent d270d211f6
commit 8de802f73a
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD

View file

@ -1,54 +1,34 @@
" TODO: Spell Checking
set nocompatible " Disable vi compatibilty (Use vi improved only) - required for Vundle
set encoding=utf-8 " Use UTF-8 set encoding=utf-8 " Use UTF-8
syntax enable " Turn on syntax highlighting
set showmatch " Show matching brackets set showmatch " Show matching brackets
set ignorecase " Do case insensitive matching set ignorecase " Do case insensitive matching
set incsearch " Show partial matches for a search phrase set incsearch " Show partial matches for a search phrase
set number " Show numbers set number " Show numbers
set relativenumber " Show relative numbersi set relativenumber " Show relative numbersi
set undolevels=999 " Lots of these set undolevels=999 " Lots of these
set history=1000 " More history
set hlsearch " Highlight Search set hlsearch " Highlight Search
set tabstop=4 " Tab size
set noexpandtab " Do not expand tab into spaces (change to expandtab to use spaces) set noexpandtab " Do not expand tab into spaces (change to expandtab to use spaces)
set tabstop=4 " Tab size
set shiftwidth=4 " Indentation size set shiftwidth=4 " Indentation size
set softtabstop=4 " Tabs/Spaces interrop set softtabstop=4 " Tabs/Spaces interrop
set tabpagemax=50 " More tabs
set autoindent " Enable autoindent set autoindent " Enable autoindent
set ruler " Show cursor position set ruler " Show cursor position
set cursorline " Highlight cursor line set cursorline " Highlight cursor line
set mouse=a " Enable mouse mode
set backspace=indent,eol,start " Delete everything set backspace=indent,eol,start " Delete everything
set laststatus=2 " Always show status line set laststatus=2 " Always show status line
set wildmode=longest,list,full " Enable autocompletion set wildmode=longest,list,full " Enable autocompletion
set splitbelow splitright " Split in more natural way set splitbelow splitright " Split in more natural way
set formatoptions+=j " Delete comment character when joining commented lines
"set nomodeline " Disable as a security precaution set autoread " Reload files on change
"set termguicolors " Enable true colors (breaks TTY vim) set mouse=a " Enable mouse mode (won't have any effect on TTY)
"set wildmenu " Enable wildmenu syntax enable " Turn on syntax highlighting
"set conceallevel=0 " Disable concealing " Non TTY Settings (Uncomment if you are on full graphical environment)
"set complete-=i " Better completion set encoding=utf-8 " Use UTF-8, not ASCII
"set smarttab " Better tabs "set termguicolors " Use true colors (256)
"set ttimeout " Set timeout
"set ttimeoutlen=100
"set synmaxcol=500 " Syntax limit
"set scrolloff=3 " Scroll offset
"set sidescrolloff=5
"set autoread " Reload files on change
"set tabpagemax=50 " More tabs
"set history=1000 " More history
"set viminfo^=! " Better viminfo
"set formatoptions+=j " Delete comment character when joining commented lines
"set listchars=tab:,nbsp:_,trail:,extends:>,precedes:<
"set list " Highlight non whitespace characters
"set nrformats-=octal " 007 != 010
"set sessionoptions-=options
"set viewoptions-=option
"set listchars=tab:\|\ " Set tab lines
"set listchars=tab:\|\- " Set tab lines with -
" XDG Support " XDG Support
" 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
if empty($XDG_CACHE_HOME) | let $XDG_CACHE_HOME = $HOME."/.cache" | endif if empty($XDG_CACHE_HOME) | let $XDG_CACHE_HOME = $HOME."/.cache" | endif
@ -70,63 +50,71 @@ 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')
" Always use terminal background
autocmd ColorScheme * highlight! Normal ctermbg=NONE guibg=NONE
" Have Vim jump to the last position when reopening a file " Have Vim jump to the last position when reopening a file
if has("autocmd") if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\""
endif endif
" Shortcutting split navigation, saving a keystroke
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Check file in shellcheck
map <leader>s :!clear && shellcheck %<CR>
" Copy selected text to system clipboard (requires gvim)
vnoremap <C-c> "*Y :let @+=@*<CR>
map <C-p> "+P
" Automatically deletes all trailing whitespace on save " Automatically deletes all trailing whitespace on save
autocmd BufWritePre * %s/\s\+$//e autocmd BufWritePre * %s/\s\+$//e
" Vundle Init " Perform shellcheck on files
map <leader>s :!clear && shellcheck %<CR>
" 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
" 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>
" Vundle
filetype off " required
set nocompatible " be iMproved, required
set rtp+=~/.local/share/vim/bundle/Vundle.vim set rtp+=~/.local/share/vim/bundle/Vundle.vim
call vundle#begin('~/.local/share/vim/bundle') call vundle#begin('~/.local/share/vim/bundle')
" Plugins Plugin 'VundleVim/Vundle.vim' " Let vundle manage itself
Plugin 'VundleVim/Vundle.vim'
Plugin 'airblade/vim-gitgutter' " Shows Git diff Plugin 'airblade/vim-gitgutter' " Shows Git diff
Plugin 'joshdick/onedark.vim' " OneDark Theme Plugin 'joshdick/onedark.vim' " OneDark theme
Plugin 'tpope/vim-fugitive' " Git Wrapper (also shows branch on statusline)
Plugin 'vim-airline/vim-airline' " AirLine statusline Plugin 'vim-airline/vim-airline' " AirLine statusline
Plugin 'vim-airline/vim-airline-themes' " AirLine statusline themes Plugin 'vim-airline/vim-airline-themes' " AirLine statusline themes
Plugin 'scrooloose/nerdtree' " Adds File-tree
Plugin 'Xuyuanp/nerdtree-git-plugin' " Shows git status in nerd-tree
Plugin 'vim-syntastic/syntastic' " Syntax checking Plugin 'vim-syntastic/syntastic' " Syntax checking
Plugin 'PotatoesMaster/i3-vim-syntax' " Add syntax for i3 config Plugin 'vim-python/python-syntax' " Python highlighting
Plugin 'jmcantrell/vim-virtualenv' " Manage Virtual Enviroment
" Vundle End
call vundle#end() call vundle#end()
filetype plugin indent on filetype plugin indent on
" NERD Tree " User interface / Theme
autocmd StdinReadPre * let s:std_in=1 colorscheme onedark
" Show tree when opening directory "autocmd ColorScheme * highlight! Normal ctermbg=NONE guibg=NONE " Terminal background
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif set guioptions-=m " remove menubar
" Use Ctrl+n to open tree set guioptions-=T " remove toolbar
map <C-n> :NERDTreeToggle<CR> set guioptions-=r " remove right-hand scrollbar
set guioptions-=L " remove left-hand scrollbar
let g:python_highlight_all = 1 " Enable pyhton-syntax support
" Airline
let g:airline_theme='onedark'
let g:airline#extensions#tabline#enabled = 1
let g:airline#tabline#formatter = 'unique_tail'
let g:airline_symbols_ascii = 1 " Enable ASCII only for TTY
let g:airline_left_sep = "\uE0B0" " Change to ASCII symbol on TTY (>)
let g:airline_right_sep = "\uE0B2" " Change to ASCII symbol on TTY (<)
" Syntastic " Syntastic
set statusline+=%#warningmsg# set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%* set statusline+=%*
let g:syntastic_always_populate_loc_list = 1 let g:syntastic_alays_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0 let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1 let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0 let g:syntastic_check_on_wq = 0
@ -135,19 +123,5 @@ let g:syntastic_python_checkers = ['flake8']
map <leader>c :SyntasticCheck<CR> map <leader>c :SyntasticCheck<CR>
map <leader>z :Errors<CR> map <leader>z :Errors<CR>
" Airline
let g:airline_theme='onedark'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail'
let g:airline_left_sep = "\uE0B0"
let g:airline_right_sep = "\uE0B2"
" One Dark
let g:onedark_color_overrides = {
\ "comment_grey": {"gui": "#69747C","cterm": "245", "cterm16": "8"},
\ "gutter_fg_grey": { "gui": "#69747C", "cterm": "245", "cterm16": "8"}
\}
if !exists('$TMUX')
let g:onedark_terminal_italics = 1
endif
colorscheme onedark