home/dotfiles/vimrc

136 lines
3.2 KiB
VimL
Raw Normal View History

2020-06-19 08:03:11 +02:00
" VIM Configuration - DarKou
2020-04-24 19:21:58 +02:00
2020-06-19 08:03:11 +02:00
" Cancel VI compatibility
set nocompatible
2020-04-24 19:21:58 +02:00
2020-06-19 08:03:11 +02:00
" -- Vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'arcticicestudio/nord-vim'
Plug 'sjbach/lusty'
Plug 'kshenoy/vim-signature'
Plug 'w0rp/ale'
Plug 'ap/vim-css-color'
Plug 'mileszs/ack.vim'
Plug 'ctrlpvim/ctrlp.vim'
2020-06-21 19:37:49 +02:00
Plug 'moll/vim-node'
2020-07-11 08:27:10 +02:00
Plug 'pangloss/vim-javascript'
Plug '1995eaton/vim-better-javascript-completion'
2020-07-05 10:47:31 +02:00
Plug 'heavenshell/vim-jsdoc', {
\ 'for': ['javascript', 'javascript.jsx','typescript'],
\ 'do': 'make install'
\}
2020-07-11 08:27:10 +02:00
Plug 'JamshedVesuna/vim-markdown-preview'
2020-07-22 15:19:00 +02:00
Plug 'ternjs/tern_for_vim', {'do': 'yarn install'}
2020-06-19 08:03:11 +02:00
" Initialize plugin system
call plug#end()
2020-07-11 08:27:10 +02:00
" -- Markdown preview
let vim_markdown_preview_browser='Mozilla Firefox'
2020-06-19 08:03:11 +02:00
" -- Display
colorscheme nord
set title
set number
set ruler
set wrap
set scrolloff=5
syntax enable
2020-07-11 08:27:10 +02:00
set encoding=utf-8
set fileencoding=utf-8
set showmatch " When a bracket is inserted, briefly jump to the matching one
set cursorline " Highlight the screen line of the cursor
2020-06-19 08:03:11 +02:00
filetype on
filetype plugin on
filetype indent on
2020-07-22 15:19:00 +02:00
set omnifunc=syntaxcomplete#Complete
2020-06-19 08:03:11 +02:00
:highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+$/
:match errorMsg /\s\+$/
2020-06-19 08:03:11 +02:00
" -- Search
set ignorecase
set smartcase
set incsearch
set hlsearch
" -- Ack search
let g:ackprg="ack -H --nocolor --nogroup --column"
nmap <leader>j mA:Ack<space>
nmap <leader>ja mA:Ack "<C-r>=expand("<cword>")<cr>"
nmap <leader>jA mA:Ack "<C-r>=expand("<cWORD>")<cr>"
" -- Ctrlp
let g:ctrlp_map='<leader>c'
" -- Beep
set visualbell
set noerrorbells
"
set backspace=indent,eol,start
" Hide file when open other file
set hidden
" Code formating
2020-07-11 08:27:10 +02:00
set smartindent " Do smart autoindenting when starting a new line
set tabstop=2 " Number of spaces that a <Tab> in the file counts for
set shiftwidth=2 " Alignment with '<' and '>'
set expandtab " Use spaces instead of tab
2020-06-19 08:03:11 +02:00
let b:ale_linters = ['eslint']
let g:ale_fixers = {
\ 'javascript': ['eslint']
\ }
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '⚠️'
let g:ale_fix_on_save = 1
2020-07-05 10:47:31 +02:00
augroup myTodo
autocmd!
autocmd Syntax * syntax match myTodo /\v\_.<(TODO|FIXME|INFO).*/hs=s+1 containedin=.*Comment
augroup END
highlight link myTodo Todo
2020-07-11 08:27:10 +02:00
2020-07-22 15:19:00 +02:00
" Auto close brackets/…
inoremap " ""<left>
inoremap ' ''<left>
inoremap ` ``<left>
inoremap ( ()<left>
inoremap [ []<left>
inoremap { {}<left>
inoremap {<CR> {<CR>}<ESC>O
inoremap {;<CR> {<CR>};<ESC>O
" -- Remove unwantedd spaces
function TrimWhiteSpace()
%s/\s*$//
''
endfunction
set list listchars=trail:.,extends:>
autocmd FileWritePre * call TrimWhiteSpace()
autocmd FileAppendPre * call TrimWhiteSpace()
autocmd FilterWritePre * call TrimWhiteSpace()
autocmd BufWritePre * call TrimWhiteSpace()
map <F2> :call TrimWhiteSpace()<CR>
map! <F2> :call TrimWhiteSpace()<CR>
2020-07-11 08:27:10 +02:00
" -- Plugins configurations
" vim-javascript
let g:javascript_plugin_jsdoc = 1 " Enables syntax highlighting for JSDocs
let g:javascript_plugin_flow = 1 " Enables syntax highlighting for Flow