This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/nvim/.config/nvim/init.vim

309 lines
7.5 KiB
VimL
Raw Normal View History

2020-04-20 04:27:35 +02:00
"
2019-11-23 02:17:36 +01:00
" LEL
2019-12-09 19:25:42 +01:00
" _
" _ ____ _(_)_ __ ___
" | '_ \ \ / / | '_ ` _ \
2019-12-01 17:36:00 +01:00
" | | | \ V /| | | | | | |
" |_| |_|\_/ |_|_| |_| |_|
2019-12-09 19:25:42 +01:00
2019-11-23 02:17:36 +01:00
" Plugins{{{
2019-10-16 02:28:41 +02:00
"
" Install plug if it isn't already
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
augroup PLUG
au!
autocmd VimEnter * PlugInstall
augroup END
endif
call plug#begin('~/.config/nvim/plugged')
2020-06-16 21:58:16 +02:00
Plug 'arrufat/vala.vim'
Plug 'NLKNguyen/c-syntax.vim'
2019-10-16 02:28:41 +02:00
Plug 'airblade/vim-gitgutter'
Plug 'chrisbra/Colorizer'
Plug 'junegunn/vim-easy-align'
" Language server support
2020-04-17 06:54:35 +02:00
"
2019-12-13 03:25:15 +01:00
" Plug 'sheerun/vim-polyglot'
2019-12-13 03:58:26 +01:00
" Plug 'dense-analysis/ale'
2020-06-16 21:58:16 +02:00
Plug 'neoclide/coc.nvim', {'branch': 'release'}
2019-12-13 03:25:15 +01:00
" Plug 'davidhalter/jedi-vim'
2020-04-17 06:54:35 +02:00
" Plug 'autozimu/LanguageClient-neovim', {
" \ 'branch': 'next',
" \ 'do': 'bash install.sh',
" \}
2019-10-16 02:28:41 +02:00
2020-03-13 03:13:31 +01:00
" Debugger
2020-04-17 06:54:35 +02:00
" Plug 'vim-vdebug/vdebug'
2020-03-13 03:13:31 +01:00
2019-10-16 02:28:41 +02:00
" Fuzzy find
2020-04-17 06:54:35 +02:00
" Plug 'junegunn/fzf'
2019-10-16 02:28:41 +02:00
" Completions
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
2020-04-17 06:54:35 +02:00
" Pais
2019-10-17 20:55:24 +02:00
Plug 'jiangmiao/auto-pairs'
2020-04-17 06:54:35 +02:00
Plug 'tpope/vim-surround'
2019-10-16 02:28:41 +02:00
" Comments
Plug 'tpope/vim-commentary'
2019-12-09 19:25:42 +01:00
2019-10-16 02:28:41 +02:00
" Status bar
2019-12-09 19:25:42 +01:00
" Plug 'vim-airline/vim-airline'
" Plug 'vim-airline/vim-airline-themes'
" let g:airline#extensions#ale#enabled = 1
2019-10-16 02:28:41 +02:00
" Bufferlist (integrates with airline)
"Plug 'bling/vim-bufferline'
" Color scheme
Plug 'dikiaap/minimalist'
" Simplify movement
"Plug 'easymotion/vim-easymotion'
" Simplify file management
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
" Format using prettier
" Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
" Make markdown fun again
"Plug 'junegunn/limelight.vim'
" Better buffer management
"Plug 'qpkorr/vim-bufkill'
" Utilities
"Plug 'xolox/vim-misc'
" Notes
"Plug 'xolox/vim-notes'
2019-10-17 20:36:20 +02:00
" Latex
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
2019-10-18 15:48:39 +02:00
Plug 'vim-latex/vim-latex', { 'for': 'tex' }
2019-12-13 03:58:26 +01:00
Plug 'vim-scripts/AnsiEsc.vim', { 'for': 'man' }
2019-12-09 19:25:42 +01:00
" Plug 'powerman/vim-plugin-AnsiEsc'
2019-12-13 03:25:15 +01:00
Plug 'mboughaba/i3config.vim'
2020-04-20 04:27:35 +02:00
Plug 'dag/vim-fish'
2019-10-16 02:28:41 +02:00
call plug#end()
2019-12-09 19:25:42 +01:00
2019-11-23 02:17:36 +01:00
"}}}
" Syntax options{{{
2019-10-16 02:28:41 +02:00
"
" Enable syntax and set color scheme
syntax on
set tabstop=4
set shiftwidth=4
set expandtab
set smarttab
set virtualedit=block
"destaque no númer de linhas
set number
set relativenumber
"display whitespace
set listchars=tab:>-,trail:~,extends:>,precedes:<
set listchars=space:_,eol:;,tab:>-,trail:~,extends:>,precedes:<
2019-12-09 19:25:42 +01:00
set list
2019-10-16 02:28:41 +02:00
"ativa o mouse
set mouse =a
set clipboard +=unnamedplus
set title
2019-11-23 02:17:36 +01:00
"}}}
" Gay colors{{{
2019-10-16 02:28:41 +02:00
2020-04-19 21:17:46 +02:00
" if (empty($TMUX))
2019-10-16 02:28:41 +02:00
if (has('nvim'))
let $NVIM_TUI_ENABLE_TRUE_COLOR = 1
endif
if (has('termguicolors'))
set termguicolors
endif
2020-04-19 21:17:46 +02:00
" endif
2019-10-16 02:28:41 +02:00
colorscheme minimalist
2019-12-13 03:58:26 +01:00
set background=dark
2019-12-09 19:25:42 +01:00
2019-10-16 02:28:41 +02:00
"background color is transparent
2019-12-13 03:25:15 +01:00
highlight Normal guibg=None
2019-12-09 19:25:42 +01:00
highlight EndOfBuffer guibg=None guifg=#303030
2019-10-16 02:28:41 +02:00
highlight SpecialKey guibg=None guifg=#cc5757
2019-11-23 02:17:36 +01:00
2019-10-16 02:28:41 +02:00
"Line numers
highlight LineNr term=bold ctermfg=9 guifg=#cc5757 guibg=None
2019-11-23 02:17:36 +01:00
"Make whitespace dark
2020-04-19 21:17:46 +02:00
highlight NonText ctermfg=darkgray guifg=#252525 guibg=None
2019-12-09 19:25:42 +01:00
" highlight SpecialKey ctermfg=black guifg=#252525 guibg=None
2019-10-16 02:28:41 +02:00
"Current line
set cursorline
2019-12-09 19:25:42 +01:00
highlight CursorLine term=bold cterm=bold gui=Bold guibg=#191919
highlight CursorLineNr term=bold cterm=bold gui=Bold guibg=#191919 guifg=white
2019-11-23 02:17:36 +01:00
"}}}
" Keys{{{
2019-10-16 02:28:41 +02:00
"
2020-05-18 00:40:41 +02:00
"
2019-10-16 02:28:41 +02:00
2020-06-17 10:25:10 +02:00
" Dvorak it!
noremap h h
noremap t j
noremap n k
noremap s l
noremap j d
noremap l n
noremap L N
" Added benefits
noremap - $
noremap _ ^
noremap N <C-w><C-w>
noremap T <C-w><C-r>
noremap H 8<Down>
noremap T 8<Up>
noremap D <C-w><C-r>
" Single charater traversal
imap <C-t> <Left>
imap <C-n> <Right>
" Quickly exit insert mode
imap jj <ESC>
"I deserve the death sentence
nmap <C-s> :w<CR>
"open and close folds
nmap <silent> s <right>:silent! foldopen<CR>
nmap <silent> <right> <right>:silent! foldopen<CR>
2019-10-16 02:28:41 +02:00
" Easy comment toggle
nmap <silent> gc :Commentary<CR>
xmap <silent> gc :Commentary<CR>
" Toggle file manager
map <silent> <C-n> :NERDTreeToggle %:p:h<CR>
" EasyAlign
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
" Simplify window navigation
2020-06-17 10:25:10 +02:00
" nnoremap <silent> <C-h> <C-w><C-h>
" nnoremap <silent> <C-t> <C-w><C-j>
" nnoremap <silent> <C-n> <C-w><C-k>
" nnoremap <silent> <C-s> <C-w><C-l>
" use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
2019-10-16 02:28:41 +02:00
2020-06-17 10:25:10 +02:00
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
2020-04-17 06:54:35 +02:00
2020-06-17 10:25:10 +02:00
" " Interact with language server
" nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
" nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
2019-12-13 03:25:15 +01:00
2019-11-23 02:17:36 +01:00
"}}}
" Lanugage Server{{{
2019-10-16 02:28:41 +02:00
"
2020-04-19 21:17:46 +02:00
set foldmethod=marker
2019-10-16 02:28:41 +02:00
set hidden
2020-04-17 06:54:35 +02:00
" let g:deoplete#enable_at_startup = 1
2019-12-09 19:25:42 +01:00
2019-10-16 02:28:41 +02:00
2020-04-17 06:54:35 +02:00
" let g:LanguageClient_serverCommands = {
" \ 'rust': ['rustup', 'run', 'stable', 'rls'],
" \ 'python': ['/usr/bin/pyls'],
" \ 'tex': ['/usr/bin/texlab'],
" \ 'c': ['cquery', '--log-file=/tmp/cq.log'],
" \ 'cpp': ['cquery', '--log-file=/tmp/cq.log'],
" \ }
2020-03-13 03:13:31 +01:00
2019-12-13 03:25:15 +01:00
2020-04-17 06:54:35 +02:00
" call deoplete#custom#source('LanguageClient',
" \ 'min_pattern_length',
" \ 2)
" " Configure deoplete to use language server
" let g:ale_fix_on_save = 1
" let g:ale_fixers = {
" \ '*': ['remove_trailing_lines', 'trim_whitespace'],
" \ 'javascript': ['eslint'],
" \ 'python': ['black'],
" \}
2019-12-09 19:25:42 +01:00
2019-11-23 02:17:36 +01:00
"python env{{{
2019-10-16 02:28:41 +02:00
" MUST NOT BE INDENTED!
py3 << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
2019-11-23 02:17:36 +01:00
"}}}
" Latex{{{
2019-10-17 20:36:20 +02:00
let g:livepreview_previewer = 'zathura'
2019-10-18 15:48:39 +02:00
autocmd FileType tex LLPStartPreview
2019-11-23 02:17:36 +01:00
"}}}
2020-04-17 06:54:35 +02:00
"groff{{{
2020-04-19 21:17:46 +02:00
augroup filetrype_groff
autocmd VimEnter *.ms set ft=groff
autocmd VimEnter *.ms silent !zathura (string replace --regex .ms\$ .pdf "%" ) & jobs -lp > /tmp/groff-preview
autocmd VimLeave *.ms silent !kill (cat /tmp/groff-preview )
autocmd BufWritePost *.ms silent !compile %
" autocmd FileType groff setlocal commentstring=\\\"\ %s
augroup END
2020-04-17 06:54:35 +02:00
"}}}
2019-11-23 02:17:36 +01:00
"}}}
"Hide statusbar{{{
2019-10-18 18:24:58 +02:00
let s:hidden_all = 0
2019-10-17 20:36:20 +02:00
function! ToggleHiddenAll()
if s:hidden_all == 0
let s:hidden_all = 1
set noshowmode
set noruler
set laststatus=0
set noshowcmd
else
let s:hidden_all = 0
set showmode
set ruler
set laststatus=2
set showcmd
endif
endfunction
2020-06-17 10:25:10 +02:00
" nnoremap <S-h> :call ToggleHiddenAll()<CR>
2019-10-18 18:24:58 +02:00
call ToggleHiddenAll()
2019-11-23 02:17:36 +01:00
"}}}
2019-12-09 19:25:42 +01:00
" vim:foldmethod=marker