Clean up some of the vimrc

This commit is contained in:
flyingscorpio@arch-desktop 2020-06-21 17:38:04 +02:00
parent f71e3586b3
commit 876e795eec

View file

@ -5,52 +5,38 @@
set nocompatible " disable vi compatibility (emulation of old bugs)
" UTF-8 ENCODING {{{
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" }}}
" LEADER SHORTCUTS {{{
let mapleader="," " leader is comma
let mapleader=","
" jk is escape
inoremap jk <esc>
" in normal mode F2 will save the file
" F2 to save file
nmap <F2> :w<CR>
" in insert mode F2 will exit insert, save, enters insert again
imap <F2> <ESC>:w<CR>i
" in normal mode <leader>y will save to the selection clipboard
" global copy/paste
nmap <leader>y "*yy
" in normal mode <leader>p will paste from the selection clipboard
nmap <leader>p "*p
" split navigation
nnoremap <leader>h :wincmd h<CR>
nnoremap <leader>j :wincmd j<CR>
nnoremap <leader>k :wincmd k<CR>
nnoremap <leader>l :wincmd l<CR>
" }}}
" VUNDLE {{{
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" Keep Plugin commands between vundle#begin/end.
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'VundleVim/Vundle.vim' " let Vundle manage Vundle, required
" AUTOCOMPLETION, FORMATTING AND LINTING
Plugin 'ycm-core/YouCompleteMe' " Main autocompletion
@ -73,29 +59,12 @@ Plugin 'vim-airline/vim-airline-themes'
Plugin 'preservim/nerdtree' " A tree explorer plugin
Plugin 'Xuyuanp/nerdtree-git-plugin' " A NERDTree plugin showing git status
Plugin 'Yggdroot/indentLine' " Display thin vertical lines at each indentation level
Plugin 'junegunn/goyo.vim' " Distraction free writing by removing UI elements and centering everything
Plugin 'junegunn/limelight.vim' " Dim paragraphs above and below the active paragraph
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
call vundle#end()
filetype plugin indent on
" }}}
" PLUGIN OPTIONS {{{
let g:ale_python_mypy_options = '--strict --strict-optional'
let g:pymode_options_max_line_length = 90
@ -115,39 +84,28 @@ nmap <leader>ne :NERDTree<CR>
" let g:indentLine_char = '▏'
let g:indentLine_fileType = ['html', 'htmldjango']
" }}}
" COLORS {{{
colorscheme badwolf
let g:airline_theme='badwolf'
syntax on
" Disable BCE (background color erase)
let &t_ut=''
let &t_ut='' " Disable BCE (background color erase)
" }}}
" SPACES & TABS {{{
set expandtab " expand tabs to spaces
set shiftwidth=4
set softtabstop=4 " number of spaces in tab when editing
" }}}
" UI CONFIG {{{
" The default cursor in normal mode is block but this will be overridden by
" any shell configuration.
" The default cursor in normal mode is block but this will be overridden by any shell configuration.
let &t_SI = "\e[5 q" " cursor beam on insert mode
let &t_SR = "\e[3 q" " cursor underline on replace mode
let &t_EI = "\e[2 q" " cursor block otherwise
set number relativenumber " show hybrid line numbers
set number relativenumber " hybrid line numbers
set spelllang=en,fr
set showcmd " show command in bottom bar
set cursorline " highlight current line
@ -157,49 +115,32 @@ set smartindent " use intelligent indentation for C
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when necessary
set showmatch " highlight matching braces
" }}}
" SEARCHING {{{
" Find files in sub-folders too
set path+=**
set path+=** " Find files in sub-folders too
set incsearch " search as characters are entered
set hlsearch " highlight matches
" turn off search hightlight after search
nnoremap <leader><space> :nohlsearch<CR>
" }}}
" FOLDING {{{
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default (0 to 99)
set foldnestmax=10 " guard against too many nested folds
set foldmethod=syntax " fold based on filetype
" space opens and closes folds
nnoremap <space> za
" }}}
" MOVEMENT {{{
" move vertically by visual line (don't jump wrapped lines)
nnoremap j gj
nnoremap k gk
" highlight last inserted text
nnoremap gV `[v`]
" }}}
" AUTOGROUPS {{{
" set language-specific settings for certain filetype/file extensions
" augroup makes the command only apply once
" autocmd! directive clears all the autocmds for the current group
augroup configgroup
autocmd!
@ -237,7 +178,6 @@ augroup configgroup
autocmd FileType ruby setlocal shiftwidth=2
autocmd FileType ruby setlocal softtabstop=2
autocmd FileType ruby setlocal commentstring=#\ %s
" F9 will run RustFmt
autocmd FileType rust nnoremap <F9> :RustFmt<CR>
autocmd FileType python setlocal commentstring=#\ %s
autocmd FileType python setlocal foldmethod=indent
@ -246,7 +186,6 @@ augroup configgroup
autocmd FileType python let g:ycm_python_sys_path = []
autocmd FileType python let g:ycm_extra_conf_vim_data = ['g:ycm_python_interpreter_path', 'g:ycm_python_sys_path']
autocmd FileType python let g:ycm_global_ycm_extra_conf = '~/.global_extra_conf.py'
" F9 will run Black
autocmd FileType python nnoremap <F9> :Black<CR>
autocmd FileType yaml setlocal foldmethod=indent
autocmd BufEnter *.cls setlocal filetype=java
@ -266,7 +205,6 @@ augroup configgroup
autocmd BufEnter *.sh setlocal foldmethod=marker
autocmd BufEnter *.sh setlocal foldlevel=0
augroup END
" }}}
set modelines=1