zsh and nvim

This commit is contained in:
Flo
2023-02-01 13:25:23 +01:00
parent 6e93bc0868
commit 085b850d99
38 changed files with 943 additions and 0 deletions

View File

@ -0,0 +1,113 @@
" prettier command for coc
command! -nargs=0 Prettier :CocCommand prettier.formatFile
let g:coc_global_extensions = [
\ 'coc-snippets',
\ 'coc-pairs',
\ 'coc-prettier',
\ 'coc-tsserver',
\ 'coc-html',
\ 'coc-css',
\ 'coc-json',
\ 'coc-angular',
\ 'coc-explorer',
\ 'coc-vimtex',
\ 'coc-python',
\ 'coc-marketplace'
\ ]
noremap <silent> <A-f> :CocCommand explorer<CR>
" From Coc Readme
set updatetime=300
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" 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)
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Remap for rename current word
nmap <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 `: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','')}

View File

@ -0,0 +1,5 @@
map <leader><leader>. <Plug>(easymotion-repeat)
map <leader><leader>f <Plug>(easymotion-overwin-f)
map <leader><leader>j <Plug>(easymotion-overwin-line)
map <leader><leader>k <Plug>(easymotion-overwin-line)
map <leader><leader>w <Plug>(easymotion-overwin-w)

View File

@ -0,0 +1 @@
let g:user_emmet_leader_key='<A-c>'

View File

@ -0,0 +1,26 @@
let g:fern#drawer_width = 30
let g:fern#default_hidden = 1
let g:fern#disable_drawer_auto_quit = 1
"noremap <silent> <A-f> :Fern . -drawer -toggle <CR>
function! s:init_fern() abort
nmap <buffer> H <Plug>(fern-action-open:split)
nmap <buffer> V <Plug>(fern-action-open:vsplit)
nmap <buffer> R <Plug>(fern-action-rename)
nmap <buffer> M <Plug>(fern-action-move)
nmap <buffer> C <Plug>(fern-action-copy)
nmap <buffer> N <Plug>(fern-action-new-path)
nmap <buffer> T <Plug>(fern-action-new-file)
nmap <buffer> D <Plug>(fern-action-new-dir)
nmap <buffer> S <Plug>(fern-action-hidden-toggle)
nmap <buffer> dd <Plug>(fern-action-trash)
nmap <buffer> <leader> <Plug>(fern-action-mark)
endfunction
augroup fern-custom
autocmd! *
autocmd FileType fern call s:init_fern()
augroup END
let g:fern#renderer = "nerdfont"

View File

@ -0,0 +1,5 @@
nmap ) <Plug>(GitGutterNextHunk)
nmap ( <Plug>(GitGutterPrevHunk)
let g:gitgutter_enabled = 1
let g:gitgutter_map_keys = 0
let g:gitgutter_highlight_linenrs = 1

View File

@ -0,0 +1 @@
noremap <leader>g :Goyo<CR>

View File

@ -0,0 +1,35 @@
"let g:indentLine_showFirstIndentLevel = 1
"let g:indentLine_fileType = ['javascript', 'c']
let g:indentLine_fileTypeExclude = ["vimwiki", "coc-explorer", "help", "undotree", "diff"]
let g:indentLine_bufTypeExclude = ["help", "terminal"]
"let g:indentLine_bufNameExclude = []
let g:indentLine_indentLevel = 10
" Conceal settings
let g:indentLine_setConceal = 1
let g:indentLine_concealcursor = "incv"
let g:indentLine_conceallevel = 2
let g:indentLine_char = '|'
"let g:indentLine_char_list = ['|', '¦', '┆', '┊']
" Leading Space
"let g:indentLine_leadingSpaceEnabled = 1
let g:indentLine_leadingSpaceChar = "•"
" Use Theme Colors
"let g:indentLine_setColors = 0
" 16 Color
let g:indentLine_color_tty_light = 7 " (default: 4)
let g:indentLine_color_dark = 1 " (default: 2)
" 256
let g:indentLine_color_term = 239
" True Color
let g:indentLine_color_gui = '#616161'
" Background (256, True)
"let g:indentLine_bgcolor_term = 202
"let g:indentLine_bgcolor_gui = '#FF5F00'

View File

@ -0,0 +1,82 @@
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_winsize = 20
function! OpenToRight()
:normal v
let g:path=expand('%:p')
execute 'q!'
execute 'belowright vnew' g:path
:normal <C-w>l
endfunction
function! OpenBelow()
:normal v
let g:path=expand('%:p')
execute 'q!'
execute 'belowright new' g:path
:normal <C-w>l
endfunction
function! OpenTab()
:normal v
let g:path=expand('%:p')
execute 'q!'
execute 'tabedit' g:path
:normal <C-w>l
endfunction
function! NetrwMappings()
" Hack fix to make ctrl-l work properly
noremap <buffer> <A-l> <C-w>l
noremap <buffer> <C-l> <C-w>l
noremap <silent> <A-f> :call ToggleNetrw()<CR>
noremap <silent> <C-E> :call ToggleNetrw()<CR>
noremap <buffer> V :call OpenToRight()<cr>
noremap <buffer> H :call OpenBelow()<cr>
noremap <buffer> T :call OpenTab()<cr>
endfunction
augroup netrw_mappings
autocmd!
autocmd filetype netrw call NetrwMappings()
augroup END
" Allow for netrw to be toggled
function! ToggleNetrw()
if g:NetrwIsOpen
let i = bufnr("$")
while (i >= 1)
if (getbufvar(i, "&filetype") == "netrw")
silent exe "bwipeout " . i
endif
let i-=1
endwhile
let g:NetrwIsOpen=0
else
let g:NetrwIsOpen=1
silent Lexplore
endif
endfunction
" Check before opening buffer on any file
function! NetrwOnBufferOpen()
if exists('b:noNetrw')
return
endif
call ToggleNetrw()
endfun
" Close Netrw if it's the only buffer open
autocmd WinEnter * if winnr('$') == 1 && getbufvar(winbufnr(winnr()), "&filetype") == "netrw" || &buftype == 'quickfix' |q|endif
" Make netrw act like a project Draw
augroup ProjectDrawer
autocmd!
" Don't open Netrw
autocmd VimEnter ~/.config/joplin/tmp/*,/tmp/calcurse*,~/.calcurse/notes/*,~/vimwiki/*,*/.git/COMMIT_EDITMSG let b:noNetrw=1
autocmd VimEnter * :call NetrwOnBufferOpen()
augroup END
let g:NetrwIsOpen=0

View File

@ -0,0 +1,38 @@
call plug#begin('~/.config/nvim/plugged')
" Themes
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tomasiser/vim-code-dark'
" Code Completion
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Tags
Plug 'alvan/vim-closetag'
Plug 'tpope/vim-surround'
Plug 'mattn/emmet-vim'
" Commenting
Plug 'tpope/vim-commentary'
" Syntax highlighting
Plug 'HerringtonDarkholme/yats.vim'
Plug 'yuezk/vim-js'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'rust-lang/rust.vim'
" Motions
Plug 'easymotion/vim-easymotion'
" Git
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
" Misc
Plug 'junegunn/fzf.vim'
Plug 'junegunn/goyo.vim'
Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' }
Plug 'vimwiki/vimwiki'
Plug 'tpope/vim-repeat'
Plug 'dhruvasagar/vim-table-mode'
Plug 'itchyny/calendar.vim'
Plug 'mbbill/undotree'
"Plug 'lambdalisue/fern.vim'
Plug 'lambdalisue/nerdfont.vim'
Plug 'lambdalisue/fern-renderer-nerdfont.vim'
call plug#end()

View File

@ -0,0 +1 @@
let g:table_mode_delete_row_map = "<leader>tdr"

View File

@ -0,0 +1,11 @@
nnoremap <A-u> :UndotreeToggle<CR>
let g:undotree_RelativeTimestamp = 1
let g:undotree_ShortIndicators = 1
let g:undotree_HelpLine = 0
let g:undotree_WindowLayout = 2
if has("persistent_undo")
set undodir=$HOME/.local/share/nvim/undodir
set undofile
endif

View File

@ -0,0 +1,6 @@
let g:vifm_replace_netrw = 1
let g:vifm_replace_netrw_cmd = "Vifm"
"let g:vifm_embed_term = 1
"let g:vifm_embed_split = 1
"let g:vifm_exec_args =

View File

@ -0,0 +1,3 @@
let g:airline#extensions#wordcount#enabled = 1
let g:airline#extensions#hunks#non_zero_only = 1
let g:airline_theme = 'codedark'

View File

@ -0,0 +1,31 @@
" filenames like *.xml, *.html, *.xhtml, ...
" These are the file extensions where this plugin is enabled.
let g:closetag_filenames = '*.html,*.xhtml,*.jsx,*.js,*.tsx'
" filenames like *.xml, *.xhtml, ...
" This will make the list of non-closing tags self-closing in the specified files.
let g:closetag_xhtml_filenames = '*.xml,*.xhtml,*.jsx,*.js,*.tsx'
" filetypes like xml, html, xhtml, ...
" These are the file types where this plugin is enabled.
let g:closetag_filetypes = 'html,xhtml,jsx,js,tsx'
" filetypes like xml, xhtml, ...
" This will make the list of non-closing tags self-closing in the specified files.
let g:closetag_xhtml_filetypes = 'xml,xhtml,jsx,js,tsx'
" integer value [0|1]
" This will make the list of non-closing tags case-sensitive (e.g. `<Link>` will be closed while `<link>` won't.)
let g:closetag_emptyTags_caseSensitive = 1
" Disables auto-close if not in a "valid" region (based on filetype)
let g:closetag_regions = {
\ 'typescript.tsx': 'jsxRegion,tsxRegion',
\ 'javascript.jsx': 'jsxRegion',
\ }
" Shortcut for closing tags, default is '>'
let g:closetag_shortcut = '>'
" Add > at current position without closing the current tag, default is ''
let g:closetag_close_shortcut = '<leader>>'

View File

@ -0,0 +1,7 @@
nnoremap <A-g> :GFiles<CR>
nnoremap <A-z> :Files<CR>
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, {'options': ['--preview', 'preview {}']}, <bang>0)
command! -bang -nargs=? -complete=dir GFiles
\ call fzf#vim#gitfiles(<q-args>, {'options': ['--preview', 'preview {}']}, <bang>0)

View File

@ -0,0 +1,16 @@
let g:Hexokinase_refreshEvents = ['InsertLeave']
let g:Hexokinase_optInPatterns = [
\ 'full_hex',
\ 'triple_hex',
\ 'rgb',
\ 'rgba',
\ 'hsl',
\ 'hsla',
\ 'colour_names'
\ ]
let g:Hexokinase_highlighters = ['backgroundfull']
" Reenable hexokinase on enter
autocmd VimEnter * HexokinaseTurnOn

View File

@ -0,0 +1 @@
let g:vimwiki_list = [{'path': '~/.local/share/vimwiki/', 'auto_diary_index': 1}]