vim
This commit is contained in:
parent
d1bbff0c42
commit
0363a19280
3
.config/nvim/autoload/ftdetect/cairo.vim
Normal file
3
.config/nvim/autoload/ftdetect/cairo.vim
Normal file
@ -0,0 +1,3 @@
|
||||
augroup cairoFileType
|
||||
autocmd BufRead,BufNewFile *.cairo set filetype=cairo
|
||||
augroup END
|
6
.config/nvim/autoload/ftplugin/cairo.vim
Normal file
6
.config/nvim/autoload/ftplugin/cairo.vim
Normal file
@ -0,0 +1,6 @@
|
||||
" Show existing tab with 4 spaces width.
|
||||
setlocal tabstop=4
|
||||
" When indenting with '>', use 4 spaces width.
|
||||
setlocal shiftwidth=4
|
||||
|
||||
command -buffer Format !.tox/dev/bin/python cairo-format -i %
|
30
.config/nvim/autoload/syntax/cairo.vim
Normal file
30
.config/nvim/autoload/syntax/cairo.vim
Normal file
@ -0,0 +1,30 @@
|
||||
" Vim syntax file
|
||||
"
|
||||
" Language: CAIRO
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax include @python syntax/python.vim
|
||||
|
||||
let b:current_syntax = "cairo"
|
||||
|
||||
hi def link statement Statement
|
||||
hi def link register Identifier
|
||||
hi def link comment Comment
|
||||
hi def link funcDef Statement
|
||||
hi def link funcName Function
|
||||
hi def link num Constant
|
||||
hi def link specialIdentifier Special
|
||||
|
||||
syn keyword statement call jmp ret abs rel if const let end from import static_assert local tempvar
|
||||
\ felt return assert member cast else alloc_locals as with nondet
|
||||
syn keyword register ap fp
|
||||
syn keyword specialIdentifier SIZEOF_LOCALS SIZE
|
||||
syn match comment '#[^\n]*\n'
|
||||
syn keyword funcDef func namespace struct nextgroup=funcName skipwhite
|
||||
syn match funcName '[a-zA-Z_][a-zA-Z0-9_]*' display contained
|
||||
syn match num '[+-]\?\d\+'
|
||||
syn region cairoHint matchgroup=SpecialComment start="%{" keepend end="%}" contains=@python
|
||||
syn region pythonLiteral matchgroup=SpecialComment start="%\[" keepend end="%\]" contains=@python
|
6
.config/nvim/coc-settings.json
Normal file
6
.config/nvim/coc-settings.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"eslint.enable": false,
|
||||
"go.goplsOptions": {
|
||||
},
|
||||
"go.goplsPath": "~/.asdf/shims/gopls"
|
||||
}
|
461
.config/nvim/init.vim
Normal file
461
.config/nvim/init.vim
Normal file
@ -0,0 +1,461 @@
|
||||
set nocompatible
|
||||
call plug#begin('~/.config/nvim/plugged')
|
||||
|
||||
"General plugins
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
Plug 'scrooloose/nerdtree'
|
||||
Plug 'scrooloose/nerdcommenter'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
|
||||
" coc and ale
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'w0rp/ale'
|
||||
|
||||
|
||||
|
||||
Plug 'cjrh/vim-conda'
|
||||
|
||||
Plug 'roxma/nvim-yarp'
|
||||
Plug 'roxma/vim-hug-neovim-rpc'
|
||||
Plug 'benekastah/neomake'
|
||||
Plug 'FooSoft/vim-argwrap'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'chrisbra/Colorizer'
|
||||
Plug 'ctrlpvim/ctrlp.vim'
|
||||
|
||||
|
||||
Plug 'fergdev/vim-cursor-hist'
|
||||
Plug 'lifepillar/vim-outlaw'
|
||||
Plug 'sickill/vim-pasta'
|
||||
Plug 'twinside/vim-hoogle'
|
||||
Plug 'mptre/vim-printf'
|
||||
Plug 'zef/vim-cycle'
|
||||
Plug 'tpope/vim-repeat'
|
||||
Plug 'majutsushi/tagbar'
|
||||
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'edkolev/tmuxline.vim'
|
||||
|
||||
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
|
||||
"Themes
|
||||
Plug 'nanotech/jellybeans.vim'
|
||||
|
||||
" HTML support
|
||||
Plug 'mattn/emmet-vim'
|
||||
Plug 'lepture/vim-jinja'
|
||||
|
||||
" Javascript support
|
||||
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
|
||||
|
||||
" Python support
|
||||
Plug 'SirVer/ultisnips'
|
||||
Plug 'honza/vim-snippets'
|
||||
|
||||
"Haskell
|
||||
Plug 'neovimhaskell/haskell-vim'
|
||||
Plug 'eagletmt/neco-ghc'
|
||||
|
||||
"markdown
|
||||
Plug 'godlygeek/tabular'
|
||||
Plug 'plasticboy/vim-markdown'
|
||||
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
|
||||
|
||||
"go
|
||||
Plug 'fatih/vim-go', {'do': ':GoUpdateBinaries'}
|
||||
|
||||
"Java
|
||||
Plug 'artur-shaik/vim-javacomplete2'
|
||||
|
||||
"utils
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'triglav/vim-visual-increment'
|
||||
|
||||
|
||||
"toml
|
||||
Plug 'cespare/vim-toml'
|
||||
|
||||
"fbs
|
||||
Plug 'zchee/vim-flatbuffers'
|
||||
|
||||
call plug#end()
|
||||
|
||||
:set dictionary="/usr/dict/words"
|
||||
|
||||
xmap ga <Plug>(EasyAlign)
|
||||
nmap ga <Plug>(EasyAlign)
|
||||
|
||||
let g:colorizer_auto_color = 1
|
||||
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:tmuxline_preset = "minimal"
|
||||
|
||||
let g:powerline_pycmd = "py3"
|
||||
|
||||
|
||||
|
||||
"coc config
|
||||
let g:coc_global_extensions = ['coc-json', 'coc-git', 'coc-css', 'coc-go', 'coc-tsserver', 'coc-html', 'coc-snippets', 'coc-yank', 'coc-toml', 'coc-eslint', 'coc-prettier', 'coc-highlight', 'coc-import-cost']
|
||||
|
||||
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
nnoremap <A-d> :CocDiagnostics <CR>
|
||||
nnoremap <A-q> :CocFix <CR>
|
||||
nnoremap <A-r> :CocRestart <CR> :ALEReset<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
"ale
|
||||
let g:ale_linters_explicit = 1
|
||||
let g:ale_fixers = {
|
||||
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
|
||||
\ 'python': ['autopep8','yapf'],
|
||||
\ 'javascript': ['prettier','eslint'],
|
||||
\ 'typescript': ['prettier','tslint'],
|
||||
\ 'solidity': ['prettier'],
|
||||
\ 'go': ['goimports','gofmt'],
|
||||
\}
|
||||
let g:ale_linters = {
|
||||
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
|
||||
\ 'python': [],
|
||||
\ 'javascript': [],
|
||||
\ 'typescript': [],
|
||||
\ 'go': [],
|
||||
\}
|
||||
|
||||
let g:ale_fix_on_save = 1
|
||||
|
||||
" airline
|
||||
let g:airline#extensions#ale#enabled = 1
|
||||
|
||||
|
||||
|
||||
set hidden
|
||||
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" Better display for messages
|
||||
set cmdheight=1
|
||||
|
||||
" You will have bad experience for diagnostic messages when it's default 4000.
|
||||
set updatetime=300
|
||||
set mmp=5000
|
||||
|
||||
|
||||
" don't give |ins-completion-menu| messages.
|
||||
set shortmess+=c
|
||||
|
||||
" always show signcolumns
|
||||
set signcolumn=yes
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> to 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>"
|
||||
" Or use `complete_info` if your vim support it, like:
|
||||
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" Remap keys for gotos
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
|
||||
" Use K to show documentation in preview window
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight symbol under cursor on CursorHold
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
autocmd FileType scss setl iskeyword+=@-@
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Remap for format selected region
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
augroup mygroup
|
||||
autocmd!
|
||||
" Setup formatexpr specified filetype(s).
|
||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||
" Update signature help on jump placeholder
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
augroup end
|
||||
|
||||
|
||||
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap for do codeAction of current line
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Fix autofix problem of current line
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Create mappings for function text object, requires document symbols feature of languageserver.
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
|
||||
" Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
|
||||
nmap <silent> <C-d> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-d> <Plug>(coc-range-select)
|
||||
|
||||
" Use `:Format` to format current buffer
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Use `:Fold` to fold current buffer
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" use `:OR` for organize import of current buffer
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add status line support, for integration with other plugin, checkout `:h coc-status`
|
||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
|
||||
" Using CocList
|
||||
" Show all diagnostics
|
||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions
|
||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands
|
||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document
|
||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols
|
||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
|
||||
|
||||
"
|
||||
" Cursor hist
|
||||
|
||||
nnoremap <leader>j :call g:CursorHistForward()<CR>
|
||||
nnoremap <leader>k :call g:CursorHistBack()<CR>
|
||||
|
||||
|
||||
" NERDTree configuration
|
||||
let NERDTreeDirArrows=1
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
let g:NERDTreeWinSize = 50
|
||||
let NERDTreeShowHidden=1
|
||||
let NERDTreeIgnore = ['\.pyc$', '__pycache__']
|
||||
|
||||
" Nerd tree
|
||||
nnoremap <C-n> :NERDTreeToggle<CR>
|
||||
nnoremap <silent><leader>f :NERDTreeFind<cr>
|
||||
|
||||
vnoremap <C-b> <C-a>
|
||||
|
||||
|
||||
|
||||
|
||||
" Python syntax
|
||||
let python_highlight_all=1
|
||||
|
||||
" Javscript syntax
|
||||
let g:javascript_plugin_jsdoc = 1
|
||||
let g:javascript_plugin_flow = 1
|
||||
|
||||
" JSX
|
||||
let g:jsx_ext_required = 0
|
||||
|
||||
" ArgWrap
|
||||
let g:argwrap_tail_comma_braces = '['
|
||||
nnoremap <silent> <leader>w :ArgWrap<CR>
|
||||
|
||||
"
|
||||
" Env variables
|
||||
"
|
||||
|
||||
"
|
||||
" Python host config
|
||||
"
|
||||
|
||||
let g:conda_startup_msg_suppress = 1
|
||||
let g:conda_startup_wrn_suppress = 1
|
||||
if !empty($CONDA_PREFIX)
|
||||
let g:python3_host_prog = $CONDA_PREFIX . '/bin/python'
|
||||
endif
|
||||
let s:current_python_path=$CONDA_PREFIX.'/bin/python'
|
||||
call coc#config('python', {'pythonPath': s:current_python_path})
|
||||
|
||||
"
|
||||
" Common settings
|
||||
"
|
||||
|
||||
set encoding=utf-8
|
||||
set autoread
|
||||
set backspace=indent,eol,start
|
||||
set ruler
|
||||
set showmode
|
||||
set history=1000
|
||||
set hidden
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set showmatch
|
||||
set noerrorbells
|
||||
set novisualbell
|
||||
set laststatus=2
|
||||
set autoindent
|
||||
set cindent
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set tabstop=2
|
||||
set expandtab
|
||||
set scrolloff=5
|
||||
set foldmethod=indent
|
||||
set foldlevel=99
|
||||
|
||||
set showcmd
|
||||
|
||||
set number
|
||||
set relativenumber
|
||||
set mouse=a
|
||||
|
||||
set redrawtime=10000
|
||||
|
||||
set inccommand=split
|
||||
|
||||
|
||||
set nowrap
|
||||
|
||||
" show completion options on <TAB>
|
||||
set wildmenu
|
||||
" complete only up to the point of ambiguity
|
||||
set wildmode=list:longest
|
||||
|
||||
" turn backup off, since most stuff is in git
|
||||
set nowb
|
||||
set noswapfile
|
||||
|
||||
|
||||
" ignore theme color for background
|
||||
let g:jellybeans_overrides = {
|
||||
\ 'background': { 'ctermbg': 'NONE', '256ctermbg': 'NONE' },
|
||||
\}
|
||||
colorscheme jellybeans
|
||||
|
||||
" Sync " and + registers
|
||||
set clipboard=unnamedplus
|
||||
|
||||
"
|
||||
" Key mappings
|
||||
"
|
||||
|
||||
let g:tex_flavor = "latex"
|
||||
|
||||
" Toggle between line numbers and relative line numbers
|
||||
nnoremap <silent><leader>u :exe "set " . (&relativenumber == 1 ? "norelativenumber" : "relativenumber")<cr>
|
||||
" Toggle between line numbers and relative line numbers
|
||||
au InsertEnter * :set norelativenumber
|
||||
au InsertLeave * :set relativenumber
|
||||
|
||||
" Map leader
|
||||
let mapleader="\<space>"
|
||||
"ctrlP
|
||||
|
||||
let g:ctrlp_map = '<C-l>'
|
||||
let g:ctrlp_cmd = 'CtrlP'
|
||||
let g:ctrlp_working_path_mode = 'ra'
|
||||
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
|
||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
||||
let g:ctrlp_custom_ignore = 'dist'
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': 'node_modules\|v[\/]\.(git|hg|svn)\|dist$',
|
||||
\ 'file': '\v\.(exe|so|dll)$',
|
||||
\ 'link': 'some_bad_symbolic_links',
|
||||
\ }
|
||||
|
||||
" move between splits with hjkl
|
||||
map <C-H> <C-W>h
|
||||
map <C-J> <C-W>j
|
||||
map <C-K> <C-W>k
|
||||
map <C-L> <C-W>l
|
||||
|
||||
" Remove search highlight on Enter
|
||||
nnoremap <silent> <CR> :nohlsearch<CR><CR>
|
||||
|
||||
" Don't loose selection on < or >
|
||||
xnoremap < <gv
|
||||
xnoremap > >gv
|
||||
|
||||
|
||||
" Grepper
|
||||
nnoremap <leader>p :Grepper<cr>
|
||||
|
||||
" ArgWrap
|
||||
nnoremap <silent> <leader>w :ArgWrap<CR>
|
||||
|
||||
" trim whitespace on save
|
||||
au BufWritePre * :%s/\s\+$//e
|
||||
|
||||
syntax sync fromstart
|
||||
|
||||
autocmd FileType python setlocal completeopt-=preview
|
||||
autocmd BufReadPost,FileReadPost,BufNewFile,BufEnter * call system("tmux rename-window '" . expand("%:t") . "'")
|
||||
|
||||
function! s:check_back_space() abort "{{{
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~ '\s'
|
||||
endfunction"}}}
|
Loading…
Reference in New Issue
Block a user