Created
August 31, 2019 19:35
-
-
Save gvolpe/9afb0b9b421517d65eb74494622f09a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set directory=~/.vim/backup | |
set backupdir=~/.vim/backup " keep swap files here | |
filetype off " required | |
call plug#begin('~/.local/share/nvim/plugged') " you need to create this directory first (or change it) | |
Plug 'vim-airline/vim-airline' " bottom status bar | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " fuzzy finder conf | |
Plug 'junegunn/fzf.vim' " fuzzy finder | |
Plug 'scrooloose/nerdtree' " folders tree | |
"Plug 'scrooloose/nerdcommenter' " code commenter | |
Plug 'neomake/neomake' " run programs asynchronously and highlight errors | |
"Plug 'Twinside/vim-hoogle' " Hoogle search (Haskell) in Vim | |
"Plug 'vmchale/dhall-vim' " Syntax highlighting for Dhall lang | |
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}} " LSP client + autocompletion plugin | |
Plug 'itchyny/lightline.vim' " configurable status line (can be used by coc) | |
Plug 'Xuyuanp/nerdtree-git-plugin' " shows files git status on the NerdTree | |
call plug#end() | |
" End of plugins here | |
" =================== | |
" airline: status bar at the bottom | |
let g:airline_powerline_fonts=1 | |
let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}' | |
let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}' | |
" Highlighting for jsonc filetype | |
autocmd FileType json syntax match Comment +\/\/.\+$+ | |
" Nerd commenter | |
filetype plugin on | |
" Better Unix support | |
set viewoptions=folds,options,cursor,unix,slash | |
set encoding=utf-8 | |
" Handle window actions with Meta instead of <C-w> | |
" Switching | |
nnoremap <M-h> <C-w>h | |
nnoremap <M-j> <C-w>j | |
nnoremap <M-k> <C-w>k | |
nnoremap <M-l> <C-w>l | |
" Moving | |
nnoremap <M-H> <C-w>H | |
nnoremap <M-J> <C-w>J | |
nnoremap <M-K> <C-w>K | |
nnoremap <M-L> <C-w>L | |
nnoremap <M-x> <C-w>x | |
" Resizing | |
nnoremap <M-=> <C-w>= | |
nnoremap <M-+> <C-w>+ | |
nnoremap <M--> <C-w>- | |
nnoremap <M-<> <C-w>< | |
nnoremap <M->> <C-w>> | |
" Clear search highlighting | |
nnoremap <C-z> :nohlsearch<CR> | |
" Nerdtree git plugin symbols | |
let g:NERDTreeIndicatorMapCustom = { | |
\ "Modified" : "ᵐ", | |
\ "Staged" : "ˢ", | |
\ "Untracked" : "ᵘ", | |
\ "Renamed" : "ʳ", | |
\ "Unmerged" : "ᶴ", | |
\ "Deleted" : "ˣ", | |
\ "Dirty" : "˜", | |
\ "Clean" : "ᵅ", | |
\ "Unknown" : "?" | |
\ } | |
function! TrimWhitespace() | |
let l:save_cursor = getpos('.') | |
%s/\s\+$//e | |
call setpos('.', l:save_cursor) | |
endfun | |
command! TrimWhitespace call TrimWhitespace() " Trim whitespace with command | |
autocmd BufWritePre * :call TrimWhitespace() " Trim whitespace on every save | |
" Nerdtree | |
map <C-F> :NERDTreeToggle<CR> | |
map <C-S> :NERDTreeFind<CR> | |
" Other options | |
let mapleader=',' | |
set backspace=2 | |
colorscheme torte | |
syntax on | |
set shell=/bin/bash | |
set laststatus=2 | |
set noshowmode | |
" Fixes broken cursor on Linux | |
set guicursor= | |
" NerdTree config | |
let g:NERDTreeDirArrowExpandable = '▸' | |
let g:NERDTreeDirArrowCollapsible = '▾' | |
let g:NERDTreeMinimalUI = 1 | |
let g:NERDTreeDirArrows = 1 | |
" General editor options | |
set hidden " Hide files when leaving them. | |
set number " Show line numbers. | |
set numberwidth=1 " Minimum line number column width. | |
set cmdheight=2 " Number of screen lines to use for the commandline. | |
set textwidth=120 " Lines length limit (0 if no limit). | |
set formatoptions=jtcrq " Sensible default line auto cutting and formatting. | |
set linebreak " Don't cut lines in the middle of a word . | |
set showmatch " Shows matching parenthesis. | |
set matchtime=2 " Time during which the matching parenthesis is shown. | |
set background=dark " Color adapted to dark background. | |
set listchars=tab:▸\ ,eol:¬ " Invisible characters representation when :set list. | |
set clipboard=unnamedplus " Copy/Paste to/from clipboard | |
set cursorline " Highlight line cursor is currently on | |
set completeopt+=noinsert " Select the first item of popup menu automatically without inserting it | |
" Search | |
set incsearch " Incremental search. | |
set ignorecase " Case insensitive. | |
set smartcase " Case insensitive if no uppercase letter in pattern, case sensitive otherwise. | |
set nowrapscan " Don't go back to first match after the last match is found. | |
" Tabs | |
set expandtab " Tab transformed in spaces | |
set tabstop=2 " Sets tab character to correspond to x columns. | |
" x spaces are automatically converted to <tab>. | |
" If expandtab option is on each <tab> character is converted to x spaces. | |
set softtabstop=2 " column offset when PRESSING the tab key or the backspace key. | |
set shiftwidth=2 " column offset when using keys '>' and '<' in normal mode. | |
" Toggle display of tabs and EOF | |
nnoremap <leader>l :set list!<CR> | |
" Fuzzy finder shortcut | |
nnoremap <C-p> :FZF<CR> | |
" Disable arrow keys and page up / down | |
noremap <Up> <nop> | |
noremap <Down> <nop> | |
noremap <Left> <nop> | |
noremap <Right> <nop> | |
inoremap <Up> <nop> | |
inoremap <Down> <nop> | |
inoremap <Left> <nop> | |
inoremap <Right> <nop> | |
vnoremap <Up> <nop> | |
vnoremap <Down> <nop> | |
vnoremap <Left> <nop> | |
vnoremap <Right> <nop> | |
noremap <PageUp> <nop> | |
inoremap <PageUp> <nop> | |
vnoremap <PageUp> <nop> | |
noremap <PageDown> <nop> | |
inoremap <PageDown> <nop> | |
vnoremap <PageDown> <nop> | |
" Disable mouse / touchpad (only in vim) | |
set mouse=nicr | |
inoremap <ScrollWheelUp> <nop> | |
inoremap <S-ScrollWheelUp> <nop> | |
inoremap <C-ScrollWheelUp> <nop> | |
inoremap <ScrollWheelDown> <nop> | |
inoremap <S-ScrollWheelDown> <nop> | |
inoremap <C-ScrollWheelDown> <nop> | |
inoremap <ScrollWheelLeft> <nop> | |
inoremap <S-ScrollWheelLeft> <nop> | |
inoremap <C-ScrollWheelLeft> <nop> | |
inoremap <ScrollWheelRight> <nop> | |
inoremap <S-ScrollWheelRight> <nop> | |
inoremap <C-ScrollWheelRight> <nop> | |
" ------------------- COC config ----------------------- | |
" Smaller updatetime for CursorHold & CursorHoldI | |
set updatetime=300 | |
" don't give |ins-completion-menu| messages. | |
set shortmess+=c | |
" always show signcolumns | |
set signcolumn=yes | |
" Some server have issues with backup files, see #649 | |
set nobackup | |
set nowritebackup | |
" Better display for messages | |
set cmdheight=2 | |
" Use <c-space> for trigger completion. | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Use <cr> for confirm completion, `<C-g>u` means break undo chain at current position. | |
" Coc only does snippet and additional edit on confirm. | |
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment