" File : init.vim " Author : Jeff LANCE " Date : 15.04.2015 " Last Modified Date: 01.09.2022 " Last Modified By : Jeff LANCE """""""""""""""""""""""""""""""""""""""""""""" " " ____ _____ _ _ _____ ____ _ _ " / ___| ____| \ | | ____| _ \ / \ | | "| | _| _| | \| | _| | |_) | / _ \ | | "| |_| | |___| |\ | |___| _ < / ___ \| |___ " \____|_____|_| \_|_____|_| \_\/_/ \_\_____| " " """""""""""""""""""""""""""""""""""""""""""""""" " General {{{ " ----- set nocompatible " be iMproved, required filetype plugin indent on set mouse=nv " Disable mouse in command-line mode set report=0 " Don't report on line changes set errorbells " Trigger bell on error set visualbell " Use visual bell instead of beeping set hidden " hide buffers when abandoned instead of unload set fileformats=unix,dos,mac " Use Unix as the standard file type set magic " For regular expressions turn magic on set path+=** " Directories to search when using gf and friends set isfname-== " Remove =, detects filename in var=/foo/bar set virtualedit=block " Position cursor anywhere in visual block set synmaxcol=2500 " Don't syntax highlight long lines set formatoptions+=1 " Don't break lines after a one-letter word set formatoptions-=t " Don't auto-wrap text set formatoptions-=o " Disable comment-continuation (normal 'o'/'O') " file encoding set encoding=utf8 " Syntax highlighting syntax on set synmaxcol=512 " ----- " }}} " Vim Directories {{{ " ----- set nobackup set nowritebackup set undofile noswapfile set directory=$DATA_PATH/swap/,$DATA_PATH,~/tmp,/var/tmp,/tmp set undodir=$DATA_PATH/undo/,$DATA_PATH,~/tmp,/var/tmp,/tmp set backupdir=$DATA_PATH/backup/,$DATA_PATH,~/tmp,/var/tmp,/tmp set viewdir=$DATA_PATH/view/ " Use the coc-spell-checker to do this " set spellfile=$VIM_PATH/spell/en.utf-8.add " History saving set history=2000 if ! has('win32') && ! has('win64') set shada=!,'300,<50,@100,s10,h endif augroup user_persistent_undo autocmd! au BufWritePre /tmp/* setlocal noundofile au BufWritePre COMMIT_EDITMSG setlocal noundofile au BufWritePre MERGE_MSG setlocal noundofile au BufWritePre *.tmp setlocal noundofile au BufWritePre *.bak setlocal noundofile augroup END " If sudo, disable vim swap/backup/undo/shada/viminfo writing if $SUDO_USER !=# '' && $USER !=# $SUDO_USER \ && $HOME !=# expand('~'.$USER) \ && $HOME ==# expand('~'.$SUDO_USER) set noswapfile set nobackup set noundofile set shada="NONE" endif " Secure sensitive information, disable backup files in temp directories if exists('&backupskip') set backupskip+=/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/* set backupskip+=.vault.vim endif " Disable swap/undo/viminfo/shada files in temp directories or shm augroup user_secure autocmd! silent! autocmd BufNewFile,BufReadPre \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/*,.vault.vim \ setlocal noswapfile noundofile nobackup nowritebackup viminfo= shada= augroup END " ----- " }}} " Timing {{{ " ------ set timeout ttimeout set timeoutlen=500 " Time out on mappings set ttimeoutlen=10 " Time out on key codes set updatetime=100 " Idle time to write swap and trigger CursorHold set redrawtime=1500 " Time in milliseconds for stopping display redraw " ----- " }}} " Behaviour {{{ " ----- " Set to auto read when a file is changed from the outside set autoread " Netrw let g:netrw_fastbrowse=0 " Use system clipboard set clipboard=unnamedplus " With a map leader it's possible to do extra key combinations " like w saves the current file let mapleader = ";" " Fast saving nmap w :w! " Fast quitting without saving nmap q :q! " Fast quitting with saving if changes nmap x :x " " Allow saving of files as sudo when I forgot to start vim using sudo. " ca w!! w !sudo tee > /dev/null % " nmap W :w!! " Auto change dir to current buffer dir autocmd BufEnter * silent! lcd %:p:h " Delete extra blank line at the end of file " autocmd BufWritePre *.py normal m`:%s/\s\+$//e`` " ----- " }}} """""""""""""""""""""""""""""""""""""""""""""""""""""" " ___ _ _ _____ _____ ____ _____ _ ____ _____ " |_ _| \ | |_ _| ____| _ \| ___/ \ / ___| ____| " | || \| | | | | _| | |_) | |_ / _ \| | | _| " | || |\ | | | | |___| _ <| _/ ___ \ |___| |___ " |___|_| \_| |_| |_____|_| \_\_|/_/ \_\____|_____| " """""""""""""""""""""""""""""""""""""""""""""""""""""" " To use fancy symbols wherever possible, let fancy_symbols_enabled = 1 " Font config if has('gui') set guifont=RobotoMono\ Nerd\ Font\ Mono\ 12 endif " Disable default status ruler set noruler " Keep at least 2 lines above/below set scrolloff=2 " hide ~ tila set fcs=eob:\ " Remove ugly vertical lines on window division set fillchars+=vert:\ " vim tab title set title " Title length. set titlelen=95 " Title string. let &g:titlestring=" \ %{expand('%:p:~:.')}%(%m%r%w%) \ %<\[%{fnamemodify(getcwd(), ':~')}\] - Neovim" " Show line numbers set number " Line wrapping set wrap " Tab control set expandtab set tabstop=2 set softtabstop=2 set shiftwidth=2 set textwidth=80 set autoindent set smartindent " python au BufNewFile,BufRead *.py \ set tabstop=4 \ set softtabstop=4 \ set shiftwidth=4 \ set textwidth=79 \ set expandtab \ set autoindent \ set fileformat=unix " js, html, css au BufNewFile,BufRead *.js, *.html, *.css \ set noexpandtab \ set tabstop=2 \ set softtabstop=2 \ set shiftwidth=2 " Treat all .md files as markdown au BufNewFile,BufRead *.md set filetype=markdown " astroid format=flowed au FileType mail setlocal tw=72 au FileType mail setlocal fo+=q au FileType mail setlocal comments+=nb:> " markdown " Hide and format markdown elements like **bold** au FileType markdown set conceallevel=2 " Set spell check to British English au FileType markdown setlocal spell spelllang=fr_fr " Let the cursor traverse to the previous or following line when at the or the " end of a line set whichwrap=b,s,<,>,[,] " 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 nolazyredraw " For regular expressions turn magic on set magic " Disable scrollbars (real hackers don't use scrollbars for navigation!) set guioptions-=r set guioptions-=R set guioptions-=l set guioptions-=L " Spell checking set spell set spelllang=fr,en " Give more space for displaying messages. set cmdheight=2 " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable " delays and poor user experience. set updatetime=300 " Don't pass messages to |ins-completion-menu|. set shortmess=aFc " Always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. if has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one set signcolumn=number else set signcolumn=yes endif """"""""""""""""""""""""""""""""""""""""""" " ____ _ _ _ ____ ___ _ _ ____ " | _ \| | | | | |/ ___|_ _| \ | / ___| " | |_) | | | | | | | _ | || \| \___ \ " | __/| |__| |_| | |_| || || |\ |___) | " |_| |_____\___/ \____|___|_| \_|____/ " """"""""""""""""""""""""""""""""""""""""""" " Installing the Plug plugin manager source ${HOME}/.config/nvim/plug.vim " Start dashboard if no arg autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * \ if (argc() == 0 && !exists("s:std_in") && !has('gui')) " \ | Dashboard \ | endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ____ _____ _ _____ _ _ ____ _ ___ _ _ _____ " / ___|_ _|/ \|_ _| | | / ___|| | |_ _| \ | | ____| " \___ \ | | / _ \ | | | | | \___ \| | | || \| | _| " ___) || |/ ___ \| | | |_| |___) | |___ | || |\ | |___ " |____/ |_/_/ \_\_| \___/|____/|_____|___|_| \_|_____| " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" set noshowmode set laststatus=2 if !has('gui_running') set t_Co=256 endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ____ ___ _ ___ ____ ____ ____ _ _ _____ __ __ _____ " / ___/ _ \| | / _ \| _ \/ ___| / ___| | | | ____| \/ | ____| " | | | | | | | | | | | |_) \___ \| | | |_| | _| | |\/| | _| " | |__| |_| | |__| |_| | _ < ___) | |___| _ | |___| | | | |___ " \____\___/|_____\___/|_| \_\____/ \____|_| |_|_____|_| |_|_____| " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " General {{{ " ----- let g:SnazzyTransparent = 1 let base16colorspace=256 " Access colors present in 256 colorspace" if (has("termguicolors")) set termguicolors endif let $NVIM_TUI_ENABLE_TRUE_COLOR=1 set background=dark colorscheme snazzy " Pseudo-transparency for completion menu and floating windows if &termguicolors if exists('&pumblend') set pumblend=10 endif if exists('&winblend') set winblend=10 endif endif " ----- " }}} " Buffet {{{ " ----- function! g:BuffetSetCustomColors() hi! BuffetTab cterm=NONE ctermbg=NONE ctermfg=8 guibg=NONE guifg=#FFFFFF hi! BuffetBuffer cterm=NONE ctermbg=NONE ctermfg=8 guibg=NONE guifg=#FFFFFF hi! BuffetModBuffer cterm=NONE ctermbg=NONE ctermfg=8 guibg=NONE guifg=#FF0000 hi! BuffetCurrentBuffer cterm=NONE ctermbg=NONE ctermfg=8 guibg=NONE guifg=#00FF00 hi! BuffetModCurrentBuffer cterm=NONE ctermbg=NONE ctermfg=8 guibg=NONE guifg=#FF0000 endfunction " ----- " }}} """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " _ _ _ _ _ " _ __ | |_ _ __ _(_)_ __ ___ ___ ___| |_| |_(_)_ __ __ _ ___ " | '_ \| | | | |/ _` | | '_ \/ __| / __|/ _ \ __| __| | '_ \ / _` / __| " | |_) | | |_| | (_| | | | | \__ \ \__ \ __/ |_| |_| | | | | (_| \__ \ " | .__/|_|\__,_|\__, |_|_| |_|___/ |___/\___|\__|\__|_|_| |_|\__, |___/ " |_| |___/ |___/ " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Artify {{{ " ----- lua <', \ 'right' : '', \ 'right_alt' : '', \ 'space' : ' ' \ } let g:tmuxline_theme = 'sourcerer' " ----- " }}} " TMux navigator {{{ " ----- let g:tmux_navigator_no_mappings = 1 let g:tmux_navigator_save_on_switch = 2 " ----- " }}} " Treesitter {{{ " ----- lua require'nvim-treesitter.configs'.setup{highlight={enable=true}} " ----- " }}} " Vimroom {{{ " ----- let g:goyo_height = '100%' let g:goyo_width = '90%' let g:goyo_margin_top = 0 let g:goyo_margin_bottom = 0 " ----- " }}} " Vimtex {{{ " ----- let g:vimtex_compiler_progname = 'nvr' let g:tex_flavor = 'latex' " ----- " }}} " Vimwiki {{{ " ----- let g:vimwiki_list = [{ \ 'path': '~/Projets/web/www.jefflance.me/posts/', \ 'auto_export': 1, \ 'automatic_nested_syntaxes': 1, \ 'path_html': '/home/jeff/Projets/web/www.jefflance.me/posts/', \ 'nested_syntaxes': {'python': 'python', 'c++': 'cpp'}, \ 'syntax': 'media', \ 'ext': '.wiki', \ 'custom_wiki2html': '/home/jeff/bin/web/nikola_build.sh', \ 'html_filename_parameterization': 1, \ }] " /home/jeff/.local/bin/vimwiki_markdown " ----- " }}} """"""""""""""""""""""""""""""""""""""""""""""""""""""" " _____ _ _ _ _ ____ _____ ___ ___ _ _ ____ " | ___| | | | \ | |/ ___|_ _|_ _/ _ \| \ | / ___| " | |_ | | | | \| | | | | | | | | | \| \___ \ " | _| | |_| | |\ | |___ | | | | |_| | |\ |___) | " |_| \___/|_| \_|\____| |_| |___\___/|_| \_|____/ " " """"""""""""""""""""""""""""""""""""""""""""""""""""""" " Load functions from file source ${HOME}/.config/nvim/functions.vim source ${HOME}/.config/nvim/coc.vim """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " _ _________ ______ ___ _ _ ____ ___ _ _ ____ ____ " | |/ / ____\ \ / / __ )_ _| \ | | _ \_ _| \ | |/ ___/ ___| " | ' /| _| \ V /| _ \| || \| | | | | || \| | | _\___ \ " | . \| |___ | | | |_) | || |\ | |_| | || |\ | |_| |___) | " |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/ " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Load keybindings from file source ${HOME}/.config/nvim/keybindings.vim " vim:ft=vim