dotfiles/vim/vimrc
2020-04-15 13:15:10 +02:00

311 lines
8.1 KiB
VimL

""""""""""""""""""""""""""""""""""""""""""""""
"
" ____ _____ _ _ _____ ____ _ _
" / ___| ____| \ | | ____| _ \ / \ | |
"| | _| _| | \| | _| | |_) | / _ \ | |
"| |_| | |___| |\ | |___| _ < / ___ \| |___
" \____|_____|_| \_|_____|_| \_\/_/ \_\_____|
"
"
""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required
" viminfo configuration
set viminfo='100,n$HOME/.vim/files/info/viminfo
" UTF-8
set encoding=utf8
" Syntax highlighting
syntax on
set synmaxcol=512
"" Set to auto read when a file is changed from the outside
set autoread
"au FocusGained,BufEnter * checktime
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
" Fast saving
nmap <leader>w :w!<cr>
" Allow saving of files as sudo when I forgot to start vim using sudo.
command! W execute 'w !sudo tee % > /dev/null %'
" A buffer becomes hidden when it is abandoned
set hidden
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___ _ _ _____ _____ ____ _____ _ ____ _____
" |_ _| \ | |_ _| ____| _ \| ___/ \ / ___| ____|
" | || \| | | | | _| | |_) | |_ / _ \| | | _|
" | || |\ | | | | |___| _ <| _/ ___ \ |___| |___
" |___|_| \_| |_| |_____|_| \_\_|/_/ \_\____|_____|
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Font config
set guifont=Inconsolata\ Nerd\ Font\ Mono\ 11
"
set linespace=5
" vim tab title
let &titlestring = @%
set title
" Show line numbers
set number
" Line wrapping
set wrap
" Tab control
set noexpandtab " tabs ftw
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop'
set tabstop=4 " the visible width of tabs
set softtabstop=4 " edit as if the tabs are 4 characters wide
set shiftwidth=4 " number of spaces to use for indent and unindent
set shiftround " round indent to a multiple of 'shiftwidth'
" Configure backspace so it acts as it should act
set backspace=indent,eol,start
set whichwrap+=<,>,h,l
" Search
set ignorecase " Ignore case when searching
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Auto indent
set ai
" Smart indent
set si
" Disable scrollbars (real hackers don't use scrollbars for navigation!)
set guioptions-=r
set guioptions-=R
set guioptions-=l
set guioptions-=L
"""""""""""""""""""""""""""""""""""""""""""
" ____ _ _ _ ____ ___ _ _ ____
" | _ \| | | | | |/ ___|_ _| \ | / ___|
" | |_) | | | | | | | _ | || \| \___ \
" | __/| |__| |_| | |_| || || |\ |___) |
" |_| |_____\___/ \____|___|_| \_|____/
"
"""""""""""""""""""""""""""""""""""""""""""
" Installing the Plug plugin manager
source $HOME/.vim/plug.vim
" Start NERDTree if no file is pass as arg
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter *
\ if argc() == 0
\ && !exists("s:std_in")
\ | Startify
\ | NERDTree
\ | endif
" Close vim if the only window left open is a NERDTree
autocmd BufEnter *
\ if (winnr("$") == 1
\ && exists("b:NERDTree")
\ && b:NERDTree.isTabTree())
\ | q
\ | endif
" If more than one window and previous buffer was NERDTree, go back to it.
autocmd BufEnter *
\ if bufname('#') =~# "^NERD_tree_"
\ && winnr('$') > 1
\ | b#
\ | endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ____ _____ _ _____ _ _ ____ _ ___ _ _ _____
" / ___|_ _|/ \|_ _| | | / ___|| | |_ _| \ | | ____|
" \___ \ | | / _ \ | | | | | \___ \| | | || \| | _|
" ___) || |/ ___ \| | | |_| |___) | |___ | || |\ | |___
" |____/ |_/_/ \_\_| \___/|____/|_____|___|_| \_|_____|
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set noshowmode
set laststatus=2
if !has('gui_running')
set t_Co=256
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ____ ___ _ ___ ____ ____ ____ _ _ _____ __ __ _____
" / ___/ _ \| | / _ \| _ \/ ___| / ___| | | | ____| \/ | ____|
" | | | | | | | | | | | |_) \___ \| | | |_| | _| | |\/| | _|
" | |__| |_| | |__| |_| | _ < ___) | |___| _ | |___| | | | |___
" \____\___/|_____\___/|_| \_\____/ \____|_| |_|_____|_| |_|_____|
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let base16colorspace=256 " Access colors present in 256 colorspace"
" set background=dark
colorscheme abstract
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" _ _ _ _ _
" _ __ | |_ _ __ _(_)_ __ ___ ___ ___| |_| |_(_)_ __ __ _ ___
" | '_ \| | | | |/ _` | | '_ \/ __| / __|/ _ \ __| __| | '_ \ / _` / __|
" | |_) | | |_| | (_| | | | | \__ \ \__ \ __/ |_| |_| | | | | (_| \__ \
" | .__/|_|\__,_|\__, |_|_| |_|___/ |___/\___|\__|\__|_|_| |_|\__, |___/
" |_| |___/ |___/
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" Markdown review
"
let vim_markdown_preview_toggle=1
let vim_markdown_preview_toggle=2
let vim_markdown_preview_browser='x-www-browser'
"
" NERDTree
"
let g:NERDTreeQuitOnOpen=0 " close NERDTree after a file is opened
"
" Startify
"
" let g:startify_custom_header = 'startify#center(startify#fortune#cowsay())'
" let g:startify_session_dir = '~/.vim/session'
" let g:startify_lists = [
" \ { 'type': 'files', 'header': ['RÉCENTS'] },
" \ { 'type': 'sessions', 'header': ['SESSIONS'] },
" \ { 'type': 'bookmarks', 'header': ['MARQUES-PAGES'] },
" \ ]
" let g:startify_enable_special = 0
" let g:startify_files_number = 5
" let g:startify_bookmarks = [
" \ '~/.vimrc',
" \ '~/.vim/keybindings.vim',
" \ '~/.vim/plug.vim',
" \ '~/.vim/scripts.vim',
" \ '~/Projets/latex/latex-homework'
" \ ]
"
" Lightline
"
let g:lightline = {
\ 'colorscheme': 'jellybeans',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified' ] ],
\ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype', 'kitestatus' ] ],
\ },
\ 'component': {
\ 'readonly': '%{&readonly?"|":""}',
\ 'kitestatus': '%{kite#statusline()}',
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }
"
" Tmuxline
"
let g:tmuxline_preset = {
\'a' : '#S',
\'win' : ['#I', '#W'],
\'cwin' : ['#I', '#W', '#F'],
\'y' : ['%a', '%d', '%b', '%R'],
\'z' : '#H'
\ }
let g:tmuxline_separators = {
\ 'left' : '',
\ 'left_alt': '>',
\ 'right' : '',
\ 'right_alt' : '',
\ 'space' : ' '}
let g:tmuxline_theme = 'jellybeans'
"
" CtrlP
"
let g:ctrlp_map = '<C-f>'
let g:ctrlp_cmd = 'CtrlPMixed'
let g:ctrlp_switch_buffer = 'et'
"
" Vimroom
"
let g:goyo_width=200
let g:goyo_margin_top = 2
let g:goyo_margin_bottom = 2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
" _____ _ _ _ _ ____ _____ ___ ___ _ _ ____
" | ___| | | | \ | |/ ___|_ _|_ _/ _ \| \ | / ___|
" | |_ | | | | \| | | | | | | | | | \| \___ \
" | _| | |_| | |\ | |___ | | | | |_| | |\ |___) |
" |_| \___/|_| \_|\____| |_| |___\___/|_| \_|____/
"
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Load fucntions from file
source $HOME/.vim/functions.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" _ _________ ______ ___ _ _ ____ ___ _ _ ____ ____
" | |/ / ____\ \ / / __ )_ _| \ | | _ \_ _| \ | |/ ___/ ___|
" | ' /| _| \ V /| _ \| || \| | | | | || \| | | _\___ \
" | . \| |___ | | | |_) | || |\ | |_| | || |\ | |_| |___) |
" |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Load keybindings from file
source $HOME/.vim/keybindings.vim