dotfiles/init.vim

205 lines
6.1 KiB
VimL

" VIM-PLUG MANAGER ##################################################{{{
" First install vim-plug with the following command:
" curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" Then copy this file in: ~/.config/nvim/
" Install all requirements (neovim, python3, python3 neovim package,
" nerd-fonts, rust, cargo, ... (see below for details))
" Finally launch nvim and run: :PlugInstall
call plug#begin('~/.config/nvim/plugged')
" Nerdtree file explorer
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | Plug 'Xuyuanp/nerdtree-git-plugin'
" Great collection of color themes
Plug 'flazz/vim-colorschemes'
" correct terminal palette colors
Plug 'KevinGoodsell/vim-csexact'
" rst syntax
Plug 'mitsuhiko/vim-rst'
" Display thin vertical line at each indentation level for code indented with spaces
" Plug 'Yggdroot/indentLine'
" Personalized status bar
Plug 'bling/vim-airline'
" Some icons (need to install nerd-fonts to work)
" Plug 'ryanoasis/vim-devicons'
" Comment any type of code (gcc, gcip)
Plug 'tomtom/tcomment_vim'
" Auto completion tools (deoplete is still alpha)
Plug 'Shougo/deoplete.nvim'
" Snippets made easy (<C-k>)
Plug 'Shougo/neosnippet.vim' | Plug 'Shougo/neosnippet-snippets'
" Python highlight
Plug 'hdima/python-syntax'
" Git stuff
Plug 'tpope/vim-fugitive'
" Typescript-doc
Plug 'https://gogs.tforgione.fr/tforgione/typescript-doc.git'
" Add plugins to &runtimepath
call plug#end()
" }}}
"NeoBundle Scripts-----------------------------
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=/home/thomas/.nvim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('/home/thomas/.nvim/bundle'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" NeoBundle 'Shougo/vimproc.vim', {
" \ 'build' : {
" \ 'windows' : 'tools\\update-dll-mingw',
" \ 'cygwin' : 'make -f make_cygwin.mak',
" \ 'mac' : 'make -f make_mac.mak',
" \ 'linux' : 'make',
" \ 'unix' : 'gmake',
" \ },
" \ }
" NeoBundle 'Quramy/tsuquyomi'
" Required:
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"End NeoBundle Scripts-------------------------
" Vundle
" filetype off
" set rtp+=~/.config/nvim/bundle/Vundle.vim
"
" call vundle#begin("~/.config/nvim/bundle")
" Plugin 'VundleVim/Vundle.vim'
" Plugin 'suan/vim-instant-markdown'
" call vundle#end()
"
" filetype plugin indent on
" End vundle
" COLOR #############################################################{{{
set background=dark " use dark background
syntax enable " enable syntax processing
colorscheme mypeachpuff " awesome colorscheme
" }}}
" INDENTATION #######################################################{{{
set expandtab " tabs are spaces
set tabstop=4 " number of visual spaces per TAB
set shiftwidth=4 " number of spaces for 1 indentation level
" set list listchars=tab:▸\ ,trail:·,extends:>,precedes:<,nbsp:¬
filetype plugin indent on " load filetype-specific indent files
set autoindent
" }}}
" UI CONFIG #########################################################{{{
set number " show line numbers
set showcmd " show command in bottom bar
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when we need to.
set showmatch " highlight matching [{()}]
set encoding=utf8
let g:airline_powerline_fonts = 1
set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types\ 11
set clipboard=unnamedplus
set updatecount=50
" Remove trailing spaces
autocmd BufWritePre * :%s/\s\+$//e
" }}}
" SEARCHING #########################################################{{{
set title
set showmatch
set hlsearch
set noincsearch
" }}}
" NERDTREE ##########################################################{{{
let NERDTreeIgnore = ['\.pyc$','__pycache__']
set shell=sh
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ "Unknown" : "?"
\ }
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
" }}}
" AUTO COMPLETION ###################################################{{{
" Use deoplete.
let g:deoplete#enable_at_startup = 1
" neosnippet plugin key-mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" Complete on tab
""Window users can copy the file to their machine.
function! Tab_Or_Complete()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-n>"
else
return "\<Tab>"
endif
endfunction
:inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
" Compile on F12
nnoremap <silent><F12> :wa \| !make-client.sh<CR>
inoremap <silent><F12> <C-O>:wa \|!make-client.sh<CR>
vnoremap <silent><F12> :wa \|!make-client.sh<CR>
" Escape on F1
map <F1> <Esc>
imap <F1> <Esc>
" }}}
" MARKDOWN PREVIEW ##################################################{{{
let g:markdown_composer_browser = 'chromium'
" }}}
"
" BACKUPS ###########################################################{{{
set directory=$HOME/.vim/swp//
set backupdir=$HOME/.vim/backups/
set nobackup
" Persistent undo
if exists('+undofile')
set undofile
set undolevels=1000
set undoreload=10000
if exists('+undodir')
set undodir=$HOME/.vim/undo
endif
endif
" Markdown : do not open browser if i'm not telling you
let g:instant_markdown_autostart = 0
nnoremap <silent><F4> :call InsertTypeScriptDoc()<CR>
inoremap <silent><F4> :call InsertTypeScriptDoc()<CR>
vnoremap <silent><F4> :call InsertTypeScriptDoc()<CR>
autocmd BufWritePost * :silent execute ':w! ' ."$HOME/.vim/backups/" . escape(substitute(expand('%:p'), "/", "%", "g"), "%")
autocmd BufEnter,BufNew *.pgsql set filetype=pgsql.