init.vim (6281B) - raw


      1 "        _
      2 "       (_)
      3 " __   ___ _ __ ___  _ __ ___
      4 " \ \ / / | '_ ` _ \| '__/ __|
      5 "  \ V /| | | | | | | | | (__
      6 "   \_/ |_|_| |_| |_|_|  \___|
      7 "
      8 "
      9 
     10 " Vim Plug {{{
     11 
     12 " Plug Autoinstall {{{
     13 if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
     14 	echo "Downloading junegunn/vim-plug to manage plugins..."
     15 	silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
     16 	silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
     17 	autocmd VimEnter * PlugInstall
     18 endif
     19 " }}}
     20 
     21 " Plugins
     22 call plug#begin()
     23 " Bracket Completion
     24 Plug 'jiangmiao/auto-pairs'
     25 " Automated vim bulletpoints
     26 Plug 'dkarter/bullets.vim'
     27 " Vim css hex highlight
     28 Plug 'chrisbra/Colorizer'
     29 " Deoplete
     30 Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
     31 " LaTeX deoplete
     32 Plug 'hisaknown/deoplete-latex'
     33 " Todoist with vim?
     34 Plug 'romgrk/todoist.nvim', { 'do': ':TodoistInstall' }
     35 " Minimal writing environment
     36 Plug 'junegunn/goyo.vim'
     37 " markdown preview vim
     38 Plug 'iamcco/markdown-preview.nvim'
     39 " Nice markdown formatting
     40 Plug 'godlygeek/tabular', { 'for': 'markdown' }
     41 Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
     42 " Generate buffers
     43 Plug 'AndrewRadev/bufferize.vim'
     44 " Emmet
     45 Plug 'mattn/emmet-vim', { 'for': [ 'markdown', 'html' ] }
     46 " html preview
     47 Plug 'turbio/bracey.vim', { 'for': [ 'html', 'stylesheet', 'javascript'] }
     48 " My colorscheme
     49 Plug 'ChausseBenjamin/friffle-vim'
     50 " Elly colorscheme
     51 Plug 'ryuta69/elly.vim'
     52 " Vim Fugitive
     53 Plug 'tpope/vim-fugitive'
     54 " Vim-Surround
     55 Plug 'tpope/vim-surround'
     56 " Vim repeat for dot command on vim surround
     57 Plug 'tpope/vim-repeat'
     58 " Vimtex
     59 Plug 'lervag/vimtex', { 'for': ['tex', 'aux', 'bib'] }
     60 " Commentary
     61 Plug 'tpope/vim-commentary'
     62 " Vim snippet manager/tool
     63 Plug 'sirver/UltiSnips'
     64 " Vim snippet library
     65 Plug 'honza/vim-snippets'
     66 " French grammar checker
     67 Plug 'dpelle/vim-Grammalecte'
     68 " All purpose grammar checker
     69 Plug 'dpelle/vim-LanguageTool'
     70 " sxhkd syntax
     71 Plug 'kovetskiy/sxhkd-vim', { 'for': 'sxhkdrc' }
     72 " Google cal inside vim
     73 Plug 'itchyny/calendar.vim'
     74 " Turning vim into an R IDE
     75 Plug 'jalvesaq/Nvim-R', { 'for': [ 'R', 'Rnoweb', 'tex', 'aux', 'bib' ] }
     76 " csv filetype for vim
     77 Plug 'chrisbra/csv.vim'
     78 " Quick highlighting
     79 Plug 'qxxxb/vim-searchhi'
     80 " Split resizing made easy
     81 Plug 'simeji/winresizer'
     82 call plug#end()
     83 " }}}
     84 " Sensible defaults {{{
     85 " Aesthetics & basics
     86 syntax on
     87 colo friffle
     88 " colorscheme tweaks {{{
     89 hi Normal guibg=NONE
     90 hi CursorLineNr guibg=NONE
     91 hi Constant guibg=NONE
     92 hi Conceal guibg=NONE
     93 hi Folded guibg=NONE
     94 hi ColorColumn guibg='#738c9c'
     95 hi Todo guibg='#acb3b5' guifg='#340001'
     96 hi Search guifg='#810002' guibg='#738c9c'
     97 " }}}
     98 " weird Goyo behavior fix {{{
     99 au User GoyoEnter,GoyoLeave hi Normal guibg=NONE
    100 au User GoyoEnter,GoyoLeave hi StatusLineNC guibg=NONE
    101 au User GoyoEnter,GoyoLeave hi StatusLine guibg=NONE
    102 au User GoyoEnter,GoyoLeave hi VertSplit guibg=NONE
    103 " }}}
    104 set tgc " Use my terminal's colors
    105 set lz " Lazy redraw -> Quicker vim
    106 set t_Co=256 " 256 colors
    107 set enc=utf-8
    108 set wmnu " Display all matching file when we tab complete
    109 set nosc " Don't show the previously typed command
    110 set nu rnu " Ablolute Relative number hybrid
    111 set ru " View column count
    112 set ls=0 " Disable the statusline
    113 set sb spr " Sensible split directions
    114 set ts=2 " A sensible tab width
    115 set shiftwidth=2 " A sensible tab width
    116 set et " Expanding tabs
    117 set foldmethod=marker " vim folding
    118 
    119 " Completion
    120 set path+=** " Provides tab-completion for all file related tasks
    121 set wim=longest,list,full " set completion mode
    122 set runtimepath+=~/.config/nvim/plugged/deoplete.nvim
    123 let g:deoplete#enable_at_startup = 1
    124 
    125 " Wrapping
    126 set wrap
    127 set lbr
    128 
    129 " Custom semicolon leader
    130 let mapleader=";"
    131 " Tab space for quick commands
    132 nnoremap <space> :
    133 
    134 " Spelling
    135 set complete+=kspell " Better Spell Checking
    136 set spl=fr " French prose
    137 
    138 " Tag Editing
    139 inoremap <leader>t <++>
    140 inoremap <leader>: <Esc>/<++><CR>"_c4l
    141 
    142 " Quickly save
    143 nnoremap <silent> <Leader>w :update<CR>
    144 
    145 " Logical way to Y ank
    146 nnoremap Y y$
    147 
    148 " Easily escape terminal mode
    149 tnoremap <Esc> <C-\><C-n>
    150 
    151 " Split motion
    152 nnoremap <C-h> <C-w>h
    153 nnoremap <C-j> <C-w>j
    154 nnoremap <C-k> <C-w>k
    155 nnoremap <C-l> <C-w>l
    156 
    157 " Saving and quitting buffers
    158 nnoremap ZF ZQ
    159 nnoremap <silent> <leader>w :update<CR>
    160 
    161 " Remove trailing white spaces
    162 autocmd BufWritePre * %s/\s\+$//e
    163 
    164 " }}}
    165 " Workflow specific {{{
    166 
    167 " 'o'pen pdf for the current document
    168 nnoremap <silent> <leader>o :!opout <c-r>%<CR><CR>
    169 nnoremap <silent> <leader>c :update \| :!compiler <c-r>%<CR><CR>
    170 nnoremap <silent> <leader>r :update \| :!compiler <c-r>%<CR><CR> \| :!sage %:r.sagetex.sage && compiler %<CR><CR>
    171 
    172 " Auto-enable Goyo for certain filetypes
    173 au filetype mail,todoist Goyo
    174 
    175 " }}}
    176 " Plugin related {{{
    177 
    178 " Todoist.nvim
    179 let todoist = {
    180 \ 'icons': {
    181 \   'unchecked': ' ',
    182 \   'checked':   ' ',
    183 \   'loading':   ' ',
    184 \   'error':     ' ',
    185 \ },
    186 \}
    187 
    188 " Markdown syntax
    189 let g:vim_markdown_strikethrough = 1
    190 let g:vim_markdown_folding_disabled = 1
    191 set conceallevel=2
    192 
    193 " Bufferize
    194 let g:bufferize_command = 'vnew'
    195 
    196 " Bracey
    197 let g:bracey_browser_command = "firefox"
    198 
    199 " Grammalecte
    200 let g:grammalecte_cli_py = "/usr/bin/grammalecte-cli"
    201 
    202 " Calendar.vim
    203 let g:calendar_google_calendar = 1
    204 let g:calendar_frame = 'default'
    205 source ~/.cache/calendar.vim/credentials.vim
    206 
    207 " Emmet.vim
    208 let g:user_emmet_leader_key=','
    209 
    210 " Vimtex
    211 "  pdf viewer
    212    let g:vimtex_view_general_viewer = 'open'
    213    let g:vimtex_view_general_options = '-a zathura'
    214    let g:tex_flavor = 'latex'
    215 "  TOC
    216    nnoremap <C-n> :VimtexTocToggle<cr>
    217 "  Underscore errors
    218    let g:tex_no_error=1
    219 
    220 " Nvim-R
    221 "  Folding
    222    let r_syntax_folding = 1
    223    set foldnestmax=1
    224    set foldmethod=marker
    225 "  Follow colorscheme
    226    let rout_follow_colorscheme = 0
    227 
    228 " Arduino
    229 let g:arduino_cmd = '/usr/bin/arduino'
    230 let g:arduino_dir = '/usr/share/arduino'
    231 
    232 " Ultisnips
    233 let g:UltiSnipsExpandTrigger="<Tab>"
    234 let g:UltiSnipsJumpForwardTrigger=";<Space>"
    235 let g:UltiSnipsJumpBackwardTrigger=";n"
    236     " If you want :UltiSnipsEdit to split your window.
    237 let g:UltiSnipsEditSplit="vertical"
    238 " Snippet directory
    239 let g:UltiSnipsSnippetDirectories=[$HOME.'/.config/nvim/UltiSnips']
    240 
    241 " }}}
    242 
    243 " See immediate results when edditing this file
    244 autocmd BufWritePost ~/.config/nvim/init.vim :source %