Add some modifications to config files and clean code.

This commit is contained in:
Jeff Lance 2020-06-24 22:42:55 +02:00
parent 69ab5072f1
commit cbd598d9df
4 changed files with 607 additions and 174 deletions

View File

@ -1,7 +1,7 @@
" File : functions.vim " File : functions.vim
" Author : Jeff LANCE <email@jefflance.me> " Author : Jeff LANCE <email@jefflance.me>
" Date : 15.04.2015 " Date : 15.04.2015
" Last Modified Date: 28.04.2020 " Last Modified Date: 24.06.2020
" Last Modified By : Jeff LANCE <email@jefflance.me> " Last Modified By : Jeff LANCE <email@jefflance.me>
""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -40,8 +40,9 @@ function! WinMove(key)
endif endif
endfunction endfunction
" Count buffers " Count buffers
function! CountBuf() function! CountBuffers()
let bufcount = 0 let bufcount = 0
for buf in getbufinfo() for buf in getbufinfo()
let bufcount += 1 let bufcount += 1
@ -49,26 +50,32 @@ function! CountBuf()
return bufcount return bufcount
endfunction endfunction
" Test if current buffer is netrw buffer " Test if current buffer is netrw buffer
function! IsNetrw() function! IsExplorerBuffer()
if (getbufvar('%', '&filetype') == "netrw" || bufname('%') =~ 'NetrwTreeListing') if (getbufvar('%', '&filetype') == "netrw"
\ || bufname('%') =~ 'NetrwTreeListing'
\ || bufname('%') =~ '[defx] defxplorer-0')
return 1 return 1
endif endif
return 0 return 0
endfunction endfunction
" Test if current buffer is empty " Test if current buffer is empty
function! IsEmptyBuf() function! IsEmptyBuffer()
if (bufname('%') == '') if (bufname('%') == '')
return 1 return 1
endif endif
return 0 return 0
endfunction endfunction
" Close current buffer " Close current buffer
" If empty return to Startify " If the last buffer is closed go back to Startify
function! BufClose() function! BufClose()
if (IsEmptyBuf() || IsNetrw()) if (CountBuffers() == 1 || IsExplorerBuffer() || IsEmptyBuffer())
bwipeout
Startify Startify
else else
bwipeout bwipeout
@ -76,3 +83,21 @@ function! BufClose()
endfunction endfunction
" COC functions
"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction

View File

@ -1,7 +1,7 @@
" File : keybindings.vim " File : keybindings.vim
" Author : Jeff LANCE <email@jefflance.me> " Author : Jeff LANCE <email@jefflance.me>
" Date : 15.04.2015 " Date : 15.04.2015
" Last Modified Date: 28.04.2020 " Last Modified Date: 24.06.2020
" Last Modified By : Jeff LANCE <email@jefflance.me> " Last Modified By : Jeff LANCE <email@jefflance.me>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -13,9 +13,8 @@
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " Custom {{{
" Custom " -----
"
" Disable highlights when you press <leader><cr>: " Disable highlights when you press <leader><cr>:
map <silent> <leader><cr> :noh<cr> map <silent> <leader><cr> :noh<cr>
@ -27,11 +26,21 @@ nnoremap <space> za
map <leader>s :echom 'Source file' <bar> :so %<cr> map <leader>s :echom 'Source file' <bar> :so %<cr>
" Two semicolons to escape " Two semicolons to escape
" imap ;; <Esc> imap ;; <Esc>
" Open a current file with sudo
map <silent> <leader>E :e suda://%<cr>
" Save a current file with sudo
map <silent> <leader>W :w suda://%<cr>
" -----
" }}}
" Buffers {{{
" -----
"
" Buffers
"
command! -bang -nargs=? -complete=dir Files command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files( \ call fzf#vim#files(
\ <q-args>, \ <q-args>,
@ -41,31 +50,81 @@ command! -bang -nargs=? -complete=dir Files
\ <bang>0 \ <bang>0
\ ) \ )
map <C-w> :echom 'Close buffer' <bar> :call BufClose()<cr> map <C-w> :echom 'Close buffer' <bar> :call BufClose()<cr>
map <C-S-w> :echom 'Force close buffer' <bar> bwipeout!<cr>
map <C-o> :e map <C-o> :e
map <C-n> :enew<cr> map <C-n> :enew<cr>
map <Tab> :bn<cr> map <Tab> :bn<cr>
map <S-Tab> :bp<cr> map <S-Tab> :bp<cr>
" " -----
" Windows " }}}
"
" Windows {{{
" -----
map <C-h> :call WinMove('h')<cr> map <C-h> :call WinMove('h')<cr>
map <C-j> :call WinMove('j')<cr> map <C-j> :call WinMove('j')<cr>
map <C-k> :call WinMove('k')<cr> map <C-k> :call WinMove('k')<cr>
map <C-l> :call WinMove('l')<cr> map <C-l> :call WinMove('l')<cr>
" " -----
" Tabs " }}}
"
" Tabs {{{
" -----
map <leader>tn :tabnew<cr> map <leader>tn :tabnew<cr>
map <leader>tc :tabclose<cr> map <leader>tc :tabclose<cr>
map <C-Tab> :tabnext<cr> map <C-Tab> :tabnext<cr>
map <leader><Tab> :tabnext<cr> map <leader><Tab> :tabnext<cr>
" " -----
" Defx " }}}
"
" COC {{{
" -----
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
" -----
" }}}
" Defx {{{
" -----
map <silent> <f3> :Defx<cr> map <silent> <f3> :Defx<cr>
function! s:defx_toggle_tree() abort function! s:defx_toggle_tree() abort
@ -145,40 +204,62 @@ function! s:defx_my_settings() abort
\ defx#do_action('change_vim_cwd') \ defx#do_action('change_vim_cwd')
endfunction endfunction
" -----
" }}}
" FZF {{{
" -----
"
" FZF
"
map <C-f> :Files<cr> map <C-f> :Files<cr>
" " -----
" Header " }}}
"
" Header {{{
" -----
map <f4> :AddHeader<cr> map <f4> :AddHeader<cr>
" " -----
" REPL " }}}
"
nnoremap <leader>rp :REPLToggle<Cr>
autocmd Filetype python nnoremap <F12> <Esc>:REPLDebugStopAtCurrentLine<Cr>
autocmd Filetype python nnoremap <F10> <Esc>:REPLPDBN<Cr>
autocmd Filetype python nnoremap <F11> <Esc>:REPLPDBS<Cr>
"" REPL {{{
"" -----
" "
" Vimroom "nnoremap <leader>rp :REPLToggle<Cr>
"autocmd Filetype python nnoremap <F12> <Esc>:REPLDebugStopAtCurrentLine<Cr>
"autocmd Filetype python nnoremap <F10> <Esc>:REPLPDBN<Cr>
"autocmd Filetype python nnoremap <F11> <Esc>:REPLPDBS<Cr>
" "
"" -----
"" }}}
" Vimroom {{{
" -----
nnoremap <silent> <leader>z :Goyo<cr> nnoremap <silent> <leader>z :Goyo<cr>
" " -----
" Vimux " }}}
"
" Vimux {{{
" -----
map <Leader>vp :VimuxPromptCommand<cr> map <Leader>vp :VimuxPromptCommand<cr>
" map <Leader>vr :VimuxRunCommand<cr> " map <Leader>vr :VimuxRunCommand<cr>
" map <Leader>vo :VimuxOpenRunner<cr> " map <Leader>vo :VimuxOpenRunner<cr>
" " -----
" Functions " }}}
"
" Functions {{{
" -----
" Renaming " Renaming
map <leader>r :call RenameFile()<cr> map <leader>r :call RenameFile()<cr>
@ -187,8 +268,10 @@ map <leader>r :call RenameFile()<cr>
map <leader>o :call GotoFile("")<cr> map <leader>o :call GotoFile("")<cr>
map <leader>' ciw''<esc>P map <leader>' ciw''<esc>P
map <leader>" c""<esc>P
" Rewrap paragraph using <S-q>
map <silent> <S-q> {gq}<Bar>:echo "Rewrapped paragraph"<CR>
" -----
" }}}

View File

@ -1,7 +1,7 @@
" File : plug.vim " File : plug.vim
" Author : Jeff LANCE <email@jefflance.me> " Author : Jeff LANCE <email@jefflance.me>
" Date : 15.04.2015 " Date : 15.04.2015
" Last Modified Date: 28.04.2020 " Last Modified Date: 24.06.2020
" Last Modified By : Jeff LANCE <email@jefflance.me> " Last Modified By : Jeff LANCE <email@jefflance.me>
"""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""
@ -13,6 +13,9 @@
" "
"""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""
" General {{{
" -----
" Install vim-plug if we don't already have it " Install vim-plug if we don't already have it
if empty(glob('~/.vim/autoload/plug.vim')) if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
@ -25,75 +28,135 @@ endif
" - Avoid using standard Vim directory names like 'plugin' " - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/plugged')
" Startup sceen " -----
" }}}
" Plugins {{{
" -----
" Startup screen
Plug 'mhinz/vim-startify' Plug 'mhinz/vim-startify'
" Deoplete " Deoplete
if using_neovim if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'kristijanhusak/defx-icons' Plug 'kristijanhusak/defx-icons'
else else
Plug 'Shougo/deoplete.nvim' Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
Plug 'Shougo/defx.nvim' Plug 'Shougo/defx.nvim'
Plug 'kristijanhusak/defx-icons' Plug 'kristijanhusak/defx-icons'
endif endif
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
" Buffer exploration " Buffer exploration
Plug 'ap/vim-buftabline', { 'as': 'buftabline' } Plug 'bagrat/vim-buffet', { 'as': 'buffet' }
" Folding " Folding
Plug 'Konfekt/FastFold' Plug 'Konfekt/FastFold'
" Markdown " Markdown
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' } Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } }
" Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
" Git integration " Git integration
Plug 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
" Quoting, etc... " Quoting, etc...
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
" Commenting shortcuts " Commenting shortcuts
Plug 'tpope/vim-commentary' Plug 'tpope/vim-commentary'
" Abolish
Plug 'tpope/vim-abolish'
" " Vinegar
" Plug 'tpope/vim-vinegar'
" Show hex codes as colors " Show hex codes as colors
Plug 'chrisbra/Colorizer' " Plug 'chrisbra/Colorizer'
Plug 'norcalli/nvim-colorizer.lua'
" Put an header in file " Put an header in file
Plug 'alpertuna/vim-header' Plug 'alpertuna/vim-header'
" Latex support " Latex support
Plug 'lervag/vimtex' Plug 'lervag/vimtex'
" Open file " Open file
Plug 'amix/open_file_under_cursor.vim' Plug 'amix/open_file_under_cursor.vim'
" Python autocompletion " Python autocompletion
Plug 'deoplete-plugins/deoplete-jedi' " Plug 'deoplete-plugins/deoplete-jedi'
" Completion from other opened files " Completion from other opened files
Plug 'Shougo/context_filetype.vim' " Plug 'Shougo/context_filetype.vim'
" Linting " Linting
Plug 'dense-analysis/ale' Plug 'dense-analysis/ale'
" REPL for vim
Plug 'sillybun/vim-repl'
" Auto-close char feature " Auto-close char feature
Plug 'Townk/vim-autoclose' Plug 'Townk/vim-autoclose'
" Indexed search " Indexed search
Plug 'vim-scripts/IndexedSearch' Plug 'vim-scripts/IndexedSearch'
" Git/mercurial/others diff icons on the side of the file lines " Git/mercurial/others diff icons on the side of the file lines
Plug 'mhinz/vim-signify' Plug 'mhinz/vim-signify'
" Golden resizing
Plug 'roman/golden-ratio'
" Fuzzy finder " Fuzzy finder
Plug 'junegunn/fzf' Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
" Distraction-free writing " Distraction-free writing
Plug 'junegunn/goyo.vim' Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim' Plug 'junegunn/limelight.vim'
" Status line " Status line
Plug 'itchyny/lightline.vim' Plug 'hardcoreplayers/spaceline.vim'
" Plug 'itchyny/lightline.vim'
" Tmux " Tmux
Plug 'edkolev/tmuxline.vim' Plug 'edkolev/tmuxline.vim'
Plug 'benmills/vimux' Plug 'benmills/vimux'
" Colorschemes " Colorschemes
" Plug 'wgwoods/vim-systemd-syntax'
Plug 'nanotech/jellybeans.vim', { 'as': 'jellybeans' } Plug 'nanotech/jellybeans.vim', { 'as': 'jellybeans' }
Plug 'jdsimcoe/abstract.vim', { 'as': 'abstract' } Plug 'jdsimcoe/abstract.vim', { 'as': 'abstract' }
Plug 'xero/sourcerer.vim', { 'as': 'sourcerer' } Plug 'xero/sourcerer.vim', { 'as': 'sourcerer' }
Plug 'romainl/Apprentice', { 'as': 'apprentice' }
Plug 'jdsimcoe/hyper.vim', { 'as': 'hyper' }
Plug 'jacoborus/tender.vim', { 'as': 'tender' }
Plug 'connorholyday/vim-snazzy', { 'as': 'snazzy' }
Plug 'hardcoreplayers/oceanic-material', { 'as': 'oceanic' }
" Customization " Customization
Plug 'ryanoasis/vim-devicons' Plug 'ryanoasis/vim-devicons'
" Sudo workaround plugin
Plug 'lambdalisue/suda.vim'
" Autocompletion
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Required {{{
" -----
" required ! " required !
filetype plugin indent on filetype plugin indent on
" Initialize plugin system " Initialize plugin system
call plug#end() call plug#end()
" -----
" }}}

488
vim/vimrc
View File

@ -1,7 +1,7 @@
" File : vimrc " File : vimrc
" Author : Jeff LANCE <email@jefflance.me> " Author : Jeff LANCE <email@jefflance.me>
" Date : 15.04.2015 " Date : 15.04.2015
" Last Modified Date: 28.04.2020 " Last Modified Date: 24.06.2020
" Last Modified By : Jeff LANCE <email@jefflance.me> " Last Modified By : Jeff LANCE <email@jefflance.me>
"""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""
@ -15,31 +15,121 @@
" "
"""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""
" some useful vars " General {{{
let using_neovim = has('nvim') " -----
let using_vim = !using_neovim
set nocompatible " be iMproved, required set nocompatible " be iMproved, required
filetype plugin indent on filetype plugin indent on
" viminfo configuration
if using_vim
set viminfo='100,n$HOME/.vim/files/info/viminfo
endif
set backupdir=$HOME/.vim/backup
set directory=$HOME/.vim/tmp
set noswapfile
" UTF-8 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 set encoding=utf8
" Syntax highlighting " Syntax highlighting
syntax on syntax on
set synmaxcol=512 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('nvim') && ! has('win32') && ! has('win64')
set shada=!,'300,<50,@100,s10,h
else
set viminfo='300,<10,@50,h,n$DATA_PATH/viminfo
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
if has('nvim')
set shada="NONE"
else
set viminfo="NONE"
endif
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 to auto read when a file is changed from the outside
set autoread 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 " With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file " like <leader>w saves the current file
let mapleader = ";" let mapleader = ";"
@ -47,17 +137,9 @@ let mapleader = ";"
" Fast saving " Fast saving
nmap <leader>w :w!<cr> nmap <leader>w :w!<cr>
" Allow saving of files as sudo when I forgot to start vim using sudo. " " Allow saving of files as sudo when I forgot to start vim using sudo.
" ca w!! w !sudo tee "%" " ca w!! w !sudo tee > /dev/null %
" nmap <leader>W :w!!<cr>
" A buffer becomes hidden when it is abandoned
set hidden
" Use system clipboard
set clipboard=unnamedplus
" Mouse
set mouse=a
" Auto change dir to current buffer dir " Auto change dir to current buffer dir
autocmd BufEnter * silent! lcd %:p:h autocmd BufEnter * silent! lcd %:p:h
@ -65,6 +147,9 @@ autocmd BufEnter * silent! lcd %:p:h
" Delete extra blank line at the end of file " Delete extra blank line at the end of file
" autocmd BufWritePre *.py normal m`:%s/\s\+$//e`` " autocmd BufWritePre *.py normal m`:%s/\s\+$//e``
" -----
" }}}
"""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""
@ -80,17 +165,30 @@ autocmd BufEnter * silent! lcd %:p:h
let fancy_symbols_enabled = 1 let fancy_symbols_enabled = 1
" Font config " Font config
set guifont=Inconsolata\ Nerd\ Font\ Mono\ 11 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 " Remove ugly vertical lines on window division
set fillchars+=vert:\ set fillchars+=vert:\
"
set linespace=5
" vim tab title " vim tab title
let &titlestring = @%
set title set title
" Title length.
set titlelen=95
" Title string.
let &g:titlestring="
\ %{expand('%:p:~:.')}%(%m%r%w%)
\ %<\[%{fnamemodify(getcwd(), ':~')}\] - Neovim"
" Show line numbers " Show line numbers
set number set number
@ -121,6 +219,10 @@ au BufNewFile,BufRead *.js, *.html, *.css
\ set tabstop=2 \ set tabstop=2
\ set softtabstop=2 \ set softtabstop=2
\ set shiftwidth=2 \ set shiftwidth=2
" astroid format=flowed
au FileType mail setlocal tw=72
au FileType mail setlocal fo+=q
au FileType mail setlocal comments+=nb:>
" Let the cursor traverse to the previous or following line when at the or the " Let the cursor traverse to the previous or following line when at the or the
" end of a line " end of a line
@ -154,6 +256,25 @@ set guioptions-=L
set spell set spell
set spelllang=fr,en 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
""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""
@ -171,21 +292,20 @@ source $HOME/.vim/plug.vim
" Start startify if no arg " Start startify if no arg
autocmd StdinReadPre * let s:std_in=1 autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * autocmd VimEnter *
\ if argc() == 0 \ if (argc() == 0 && !exists("s:std_in") && !has('gui'))
\ && !exists("s:std_in")
\ | Startify \ | Startify
\ | endif \ | endif
" needed so deoplete can auto select the first suggestion " " needed so deoplete can auto select the first suggestion
set completeopt+=noinsert " set completeopt+=noinsert
" comment this line to enable autocompletion preview window " " comment this line to enable autocompletion preview window
" (displays documentation related to the selected completion option) " " (displays documentation related to the selected completion option)
" disabled by default because preview makes the window flicker " " disabled by default because preview makes the window flicker
" set completeopt-=preview " set completeopt-=preview
" autocompletion of files and commands behaves like shell " " autocompletion of files and commands behaves like shell
" (complete only the common part, list the options that match) " " (complete only the common part, list the options that match)
set wildmode=list:longest " " set wildmode=list:longest
@ -215,10 +335,46 @@ endif
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General {{{
" -----
let g:SnazzyTransparent = 1
let base16colorspace=256 " Access colors present in 256 colorspace" 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 set background=dark
" colorscheme abstract colorscheme snazzy
colorscheme sourcerer
" 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
" -----
" }}}
@ -232,15 +388,58 @@ colorscheme sourcerer
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" BufTabLine {{{
"" -----
" "
" BufTabLine "hi TabLineSel ctermbg=Red ctermfg=black guibg=Red guifg=black
"hi PmenuSel ctermbg=Black ctermfg=Red guibg=Black guifg=Red
" "
hi TabLineSel ctermbg=green ctermfg=black guibg=green guifg=black "" -----
hi PmenuSel ctermbg=white ctermfg=white guibg=white guifg=white "" }}}
" Buffet {{{
" -----
let g:buffet_always_show_tabline = 1
let g:buffet_powerline_separators = 1
let g:buffet_use_devicons = 1
let g:buffet_tab_icon = "\uf00a"
let g:buffet_modified_icon = "+"
let g:buffet_left_trunc_icon = "\uf0a8"
let g:buffet_right_trunc_icon = "\uf0a9"
" -----
" }}}
" COC {{{
" -----
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Disable warnings
let g:coc_disable_startup_warning = 1
" -----
" }}}
" Colorizer {{{
" -----
let g:colorizer_auto_filetype='css,html'
" -----
" }}}
" Defx {{{
" -----
"
" Defx
"
" Set appearance " Set appearance
call defx#custom#option( call defx#custom#option(
\ '_', { \ '_', {
@ -269,22 +468,31 @@ call defx#custom#column(
\ } \ }
\ ) \ )
" " -----
" Deoplete " }}}
"
if using_neovim
let g:deoplete#enable_at_startup = 1 " Deoplete {{{
" -----
if has('nvim')
let g:deoplete#enable_at_startup = 0
endif endif
" " -----
" FZF " }}}
"
" FZF {{{
" -----
" This is the default extra key bindings " This is the default extra key bindings
let g:fzf_action = { let g:fzf_action = {
\ 'enter': 'e', \ 'enter': 'e',
\ 'ctrl-h': 'split', \ 'ctrl-h': 'split',
\ 'ctrl-v': 'vsplit' \ 'ctrl-v': 'vsplit'
\ } \ }
" Preview window " Preview window
let g:fzf_preview_window = 'right:60%' let g:fzf_preview_window = 'right:60%'
if has('nvim') && !exists('g:fzf_layout') if has('nvim') && !exists('g:fzf_layout')
@ -293,64 +501,83 @@ if has('nvim') && !exists('g:fzf_layout')
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
endif endif
" " -----
" Header " }}}
"
" Header {{{
" -----
let g:header_field_author = 'Jeff LANCE' let g:header_field_author = 'Jeff LANCE'
let g:header_field_author_email = 'email@jefflance.me' let g:header_field_author_email = 'email@jefflance.me'
let g:header_auto_add_header = 0 let g:header_auto_add_header = 0
" " -----
" 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': '' }
\ }
"" Lightline {{{
"" -----
" "
" Markdown review "let g:lightline = {
" \ 'colorscheme': 'snazzy',
" \ 'active': {
" \ 'left': [ [ 'mode', 'paste' ],
" \ [ 'readonly', 'filename', 'gitstatus', 'modified' ]
" \ ],
" \ 'right': [ [ 'lineinfo' ],
" \ [ 'percent' ],
" \ [ 'fileformat', 'fileencoding', 'filetype', 'kitestatus' ]
" \ ]
" \ },
" \ 'component': {
" \ 'readonly': '%{&readonly?"|":""}',
" \ 'kitestatus': '%{kite#statusline()}',
" \ 'gitstatus': '%{FugitiveStatusline()}'
" \ },
" \ 'component_function': {
" \ 'gitbranch': 'FugitiveHead'
" \ },
" \ 'separator': { 'left': '', 'right': '' },
" \ 'subseparator': { 'left': '', 'right': '' }
" \ }
" "
"" -----
"" }}}
" Markdown preview {{{
" -----
let vim_markdown_preview_toggle=1 let vim_markdown_preview_toggle=1
let vim_markdown_preview_browser='x-www-browser' let vim_markdown_preview_browser='x-www-browser'
" " -----
" REPL " }}}
"
let g:repl_program = {
\ 'python': ['ipython'], " Neovim {{{
\ 'default': ['zsh'], " -----
\ 'r': ['R'],
\ 'lua': ['lua'], let g:python3_host_prog = '/usr/bin/python3'
\ 'vim': ['vim -e']
\ } " -----
let g:repl_predefine_python = { " }}}
\ 'numpy': 'import numpy as np',
\ 'matplotlib': 'from matplotlib import pyplot as plt'
\ } " Spaceline {{{
let g:repl_cursor_down = 1 " -----
let g:repl_python_automerge = 1
let g:repl_ipython_version = '7' let g:spaceline_seperate_style= 'slant-fade'
let g:repl_position = 3 " let g:spaceline_colorscheme = 'snazzy'
" -----
" }}}
" Startify {{{
" -----
"
" Startify
"
let g:startify_custom_header = 'startify#center(startify#fortune#cowsay())' let g:startify_custom_header = 'startify#center(startify#fortune#cowsay())'
let g:startify_session_dir = '~/.vim/session' let g:startify_session_dir = '~/.vim/session'
let g:startify_lists = [ let g:startify_lists = [
@ -369,9 +596,23 @@ let g:startify_bookmarks = [
\ '~/Projets/latex/latex-homework' \ '~/Projets/latex/latex-homework'
\ ] \ ]
" " -----
" Tmuxline " }}}
"
" Suda {{{
" -----
let g:suda#prompt = 'Mot de passe: '
let g:suda_smart_edit = 1
" -----
" }}}
" Tmuxline {{{
" -----
let g:tmuxline_preset = { let g:tmuxline_preset = {
\'a' : '#S', \'a' : '#S',
\'win' : ['#I', '#W'], \'win' : ['#I', '#W'],
@ -388,19 +629,39 @@ let g:tmuxline_separators = {
\ } \ }
let g:tmuxline_theme = 'sourcerer' let g:tmuxline_theme = 'sourcerer'
" " -----
" TMux navigator " }}}
"
" TMux navigator {{{
" -----
let g:tmux_navigator_no_mappings = 1 let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_save_on_switch = 2 let g:tmux_navigator_save_on_switch = 2
" " -----
" Vimroom " }}}
"
" Vimroom {{{
" -----
let g:goyo_width=200 let g:goyo_width=200
let g:goyo_margin_top = 2 let g:goyo_margin_top = 2
let g:goyo_margin_bottom = 2 let g:goyo_margin_bottom = 2
" -----
" }}}
" Vimtex {{{
" -----
let g:vimtex_compiler_progname = 'nvr'
" -----
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -413,7 +674,7 @@ let g:goyo_margin_bottom = 2
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""
" Load fucntions from file " Load functions from file
source $HOME/.vim/functions.vim source $HOME/.vim/functions.vim
@ -431,3 +692,4 @@ source $HOME/.vim/functions.vim
source $HOME/.vim/keybindings.vim source $HOME/.vim/keybindings.vim