Massive changes!!
This commit is contained in:
1
.env.example
Normal file
1
.env.example
Normal file
@@ -0,0 +1 @@
|
||||
AIHUBMIX_API_KEY=
|
||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,3 +1,9 @@
|
||||
*
|
||||
!init.vim
|
||||
!colors/guiwal.vim
|
||||
.env
|
||||
|
||||
tags
|
||||
test.sh
|
||||
.luarc.json
|
||||
nvim
|
||||
|
||||
spell/
|
||||
lazy-lock.json
|
||||
|
||||
6
.stylua.toml
Normal file
6
.stylua.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
column_width = 160
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 4
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "None"
|
||||
1313
colors/atom-dark.vim
1313
colors/atom-dark.vim
File diff suppressed because it is too large
Load Diff
@@ -1,210 +0,0 @@
|
||||
hi clear
|
||||
set background=dark
|
||||
|
||||
if exists('syntax_on')
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
" Colorscheme name
|
||||
let g:colors_name = 'guiwal'
|
||||
|
||||
source $HOME/.cache/wal/colors-wal.vim
|
||||
|
||||
" Do I need to set guixx=NONE ?
|
||||
|
||||
execute "hi Normal ctermbg=NONE guifg=" . color7 ." ctermfg=7"
|
||||
execute "hi NonText ctermbg=NONE guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi Comment ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
|
||||
hi Conceal ctermbg=NONE
|
||||
execute "hi Constant ctermbg=NONE guifg=" . color3 . "ctermfg=3"
|
||||
execute "hi Error guibg=" . color1 . " ctermbg=1 guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi Identifier ctermbg=NONE guifg=" . color1 . " ctermfg=1 gui=BOLD cterm=BOLD"
|
||||
execute "hi Ignore guibg=" . color8 . " ctermbg=8 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi PreProc ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi Special ctermbg=NONE guifg=" . color6 . " ctermfg=6"
|
||||
execute "hi Statement ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
execute "hi String ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
execute "hi Number ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi Todo guibg=" . color2 . " ctermbg=2 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi Type ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi Underlined ctermbg=NONE guifg=" . color1 . " ctermfg=1 gui=underline cterm=underline"
|
||||
|
||||
execute "hi StatusLine guibg=" . color7 . " ctermbg=7 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi StatusLineNC guibg=" . color8 . " ctermbg=8 guifg=" . color0 . " ctermfg=0"
|
||||
|
||||
execute "hi TabLine ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi TabLineFill ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi TabLineSel guibg=" . color4 . " ctermbg=4 guifg=" . color0 . " ctermfg=0"
|
||||
|
||||
execute "hi TermCursorNC guibg=" . color3 . " ctermbg=3 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi VertSplit guibg=" . color8 . " ctermbg=8 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi Title ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
|
||||
execute "hi CursorLine guibg=" . color0 . " ctermbg=2"
|
||||
execute "hi LineNr ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi CursorLineNr ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
|
||||
execute "hi helpLeadBlank ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi helpNormal ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi Visual guibg=" . color0 . " ctermbg=0 guifg=" . color1 . " ctermfg=15 gui=reverse cterm=reverse term=reverse"
|
||||
execute "hi VisualNOS ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
execute "hi Pmenu guibg=" . color8 . " ctermbg=8 guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi PmenuSbar guibg=" . color6 . " ctermbg=6 guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi PmenuSel guibg=" . color4 . " ctermbg=4 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi PmenuThumb guibg=" . color8 . " ctermbg=8 guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi FoldColumn ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi Folded ctermbg=0 guibg=" . color0 . " guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi WildMenu guibg=" . color2 . " ctermbg=2 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi SpecialKey ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi DiffAdd ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
execute "hi DiffChange ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi DiffDelete ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
execute "hi DiffText ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi IncSearch guibg=" . color3 . " ctermbg=3 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi Search guibg=" . color3 . " ctermbg=3 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi Directory ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi MatchParen guibg=" . color1 . " ctermbg=1 guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi ColorColumn guibg=" . color0 . " ctermbg=0 guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi signColumn ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi ErrorMsg ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi ModeMsg ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
execute "hi MoreMsg ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
execute "hi Question ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi WarningMsg guibg=" . color1 . " ctermbg=1 guifg=" . color0 . " ctermfg=0"
|
||||
execute "hi Cursor ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi Structure ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi CursorColumn guibg=" . color8 . " ctermbg=8 guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi ModeMsg ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi SpellBad ctermbg=NONE guifg=" . color1 . " ctermfg=1 gui=underline cterm=underline"
|
||||
execute "hi SpellCap ctermbg=NONE guifg=" . color4 . " ctermfg=4 gui=underline cterm=underline"
|
||||
execute "hi SpellLocal ctermbg=NONE guifg=" . color5 . " ctermfg=5 gui=underline cterm=underline"
|
||||
execute "hi SpellRare ctermbg=NONE guifg=" . color6 . " ctermfg=6 gui=underline cterm=underline"
|
||||
execute "hi Boolean ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi Character ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
execute "hi Conditional ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi Define ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi Delimiter ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi Float ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi Include ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi Keyword ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi Label ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi Operator ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi Repeat ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi SpecialChar ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi Tag ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi Typedef ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi vimUserCommand ctermbg=NONE guifg=" . color1 . " ctermfg=1 gui=BOLD cterm=BOLD"
|
||||
hi link vimMap vimUserCommand
|
||||
hi link vimLet vimUserCommand
|
||||
hi link vimCommand vimUserCommand
|
||||
hi link vimFTCmd vimUserCommand
|
||||
hi link vimAutoCmd vimUserCommand
|
||||
hi link vimNotFunc vimUserCommand
|
||||
execute "hi vimNotation ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi vimMapModKey ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi vimBracket ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi vimCommentString ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
|
||||
execute "hi htmlLink ctermbg=NONE guifg=" . color1 . " ctermfg=1 gui=underline cterm=underline"
|
||||
execute "hi htmlBold ctermbg=NONE guifg=" . color3 . " ctermfg=3 gui=BOLD cterm=BOLD"
|
||||
execute "hi htmlItalic ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi htmlEndTag ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi htmlTag ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi htmlTagName ctermbg=NONE guifg=" . color1 . " ctermfg=1 gui=BOLD cterm=BOLD"
|
||||
execute "hi htmlH1 ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
|
||||
hi link htmlH2 htmlH1
|
||||
hi link htmlH3 htmlH1
|
||||
hi link htmlH4 htmlH1
|
||||
hi link htmlH5 htmlH1
|
||||
hi link htmlH6 htmlH1
|
||||
|
||||
execute "hi cssMultiColumnAttr ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
hi link cssFontAttr cssMultiColumnAttr
|
||||
hi link cssFlexibleBoxAttr cssMultiColumnAttr
|
||||
execute "hi cssBraces ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
hi link cssAttrComma cssBraces
|
||||
execute "hi cssValueLength ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi cssUnitDecorators ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi cssValueNumber ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
hi link cssValueLength cssValueNumber
|
||||
execute "hi cssNoise ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi cssTagName ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
execute "hi cssFunctionName ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
|
||||
execute "hi scssSelectorChar ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi scssAttribute ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
hi link scssDefinition cssNoise
|
||||
execute "hi sassidChar ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
execute "hi sassClassChar ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi sassInclude ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi sassMixing ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi sassMixinName ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
|
||||
execute "hi javaScript ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi javaScriptBraces ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi javaScriptNumber ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
|
||||
execute "hi markdownH1 ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
hi link markdownH2 markdownH1
|
||||
hi link markdownH3 markdownH1
|
||||
hi link markdownH4 markdownH1
|
||||
hi link markdownH5 markdownH1
|
||||
hi link markdownH6 markdownH1
|
||||
execute "hi markdownAutomaticLink ctermbg=NONE guifg=" . color2 . " ctermfg=2 gui=underline cterm=underline"
|
||||
hi link markdownUrl markdownAutomaticLink
|
||||
execute "hi markdownError ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi markdownCode ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi markdownCodeBlock ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi markdownCodeDelimiter ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
hi markdownItalic gui=Italic cterm=Italic
|
||||
hi markdownBold gui=Bold cterm=Bold
|
||||
|
||||
execute "hi xdefaultsValue ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
|
||||
execute "hi rubyInclude ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi rubyDefine ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi rubyFunction ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi rubyStringDelimiter ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
execute "hi rubyInteger ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi rubyAttribute ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi rubyConstant ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi rubyInterpolation ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
execute "hi rubyInterpolationDelimiter ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi rubyRegexp ctermbg=NONE guifg=" . color6 . " ctermfg=6"
|
||||
execute "hi rubySymbol ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
execute "hi rubyTodo ctermbg=NONE guifg=" . color8 . " ctermfg=8"
|
||||
execute "hi rubyRegexpAnchor ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
hi link rubyRegexpQuantifier rubyRegexpAnchor
|
||||
|
||||
execute "hi pythonOperator ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi pythonFunction ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi pythonRepeat ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
execute "hi pythonStatement ctermbg=NONE guifg=" . color1 . " ctermfg=1 gui=Bold cterm=Bold"
|
||||
execute "hi pythonBuiltIn ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
|
||||
execute "hi phpMemberSelector ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi phpComparison ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
execute "hi phpParent ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
|
||||
execute "hi cOperator ctermbg=NONE guifg=" . color6 . " ctermfg=6"
|
||||
execute "hi cPreCondit ctermbg=NONE guifg=" . color5 . " ctermfg=5"
|
||||
|
||||
execute "hi SignifySignAdd ctermbg=NONE guifg=" . color2 . " ctermfg=2"
|
||||
execute "hi SignifySignChange ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi SignifySignDelete ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
|
||||
execute "hi NERDTreeDirSlash ctermbg=NONE guifg=" . color4 . " ctermfg=4"
|
||||
execute "hi NERDTreeExecFile ctermbg=NONE guifg=" . color7 . " ctermfg=7"
|
||||
|
||||
execute "hi ALEErrorSign ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
execute "hi ALEWarningSign ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
execute "hi ALEError ctermbg=NONE guifg=" . color1 . " ctermfg=1"
|
||||
execute "hi ALEWarning ctermbg=NONE guifg=" . color3 . " ctermfg=3"
|
||||
|
||||
let g:limelight_conceal_ctermfg=8
|
||||
let g:limelight_conceal_guifg=color8
|
||||
|
||||
set cursorline
|
||||
|
||||
482
init.lua
Normal file
482
init.lua
Normal file
@@ -0,0 +1,482 @@
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ','
|
||||
vim.g.maplocalleader = ','
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
require 'opt'
|
||||
require 'keymap'
|
||||
require 'autocmd'
|
||||
require 'lazy_init'
|
||||
|
||||
-- nnoremap <Leader>ev :tabedit $MYVIMRC<CR>
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
-- " Mappings --- {{{
|
||||
-- " Editing files - {{{
|
||||
-- "Make it easy to edit the vimrc file
|
||||
-- " }}}
|
||||
--
|
||||
-- "Changing unused ctrl bindings
|
||||
-- "Turn on git blame
|
||||
-- nnoremap <C-S-A> <CMD>Git blame<CR>
|
||||
-- "List all tags in the current buffer (replaced pageup, use CTRL-u instead)
|
||||
-- nnoremap <C-Q> <CMD>CocFzfList outline<CR>
|
||||
-- "List all tags in directory
|
||||
-- "nnoremap <C-S-B> <CMD>Tags<CR>
|
||||
-- "List all the recently opened files (replaced scroll one line up, use "k")
|
||||
-- nnoremap <C-E> <CMD>History<CR>
|
||||
-- "Search within the current buffer (replaced pagedown, use CTRL-d instead)
|
||||
-- "nnoremap <C-F> /
|
||||
-- "Search within the whole project
|
||||
-- nnoremap <C-F> <CMD>Rg<CR>
|
||||
-- "Move line down (uses vim-unimpaired) (replaced move down, use "j")
|
||||
-- nnoremap <C-J> <C-E>
|
||||
-- "Move line up (uses vim-unimpaired) (replaced move up, use "k")
|
||||
-- nnoremap <C-K> <C-Y>
|
||||
-- "Does not work because of legacy reasons
|
||||
-- " nnoremap <C-M>
|
||||
-- "Search marks (replaced "j" clone)
|
||||
-- nnoremap <C-N> <CMD>Marks<CR>
|
||||
-- "Search version controlled files (replaced move up, use "k")
|
||||
-- nnoremap <C-P> <CMD>GFiles<CR>
|
||||
-- "Search all files in directory
|
||||
-- nnoremap <C-S-P> <CMD>Files<CR>
|
||||
-- "Toggle file draw
|
||||
-- nnoremap <C-S-Q> <CMD>CHADopen<CR>
|
||||
-- "Search all snippets (uses ultisnips)
|
||||
-- nnoremap <C-S> <CMD>Snippets<CR>
|
||||
-- "Search git history (replaced scroll one line up, use "k")
|
||||
-- nnoremap <C-Y> <CMD>Commits<CR>
|
||||
-- "Search git history within current buffer/selection
|
||||
-- nnoremap <C-S-Y> <CMD>BCommits<CR>
|
||||
--
|
||||
-- "Turn on git blame
|
||||
-- inoremap <C-S-A> <CMD>Git blame<CR>
|
||||
-- "List all tags in the current buffer
|
||||
-- inoremap <C-Q> <CMD>BTags<CR>
|
||||
-- "List all tags in directory
|
||||
-- inoremap <C-S-Q> <CMD>Tags<CR>
|
||||
-- "List all the recently opened files (replaced inserting characters from below)
|
||||
-- inoremap <C-E> <CMD>History<CR>
|
||||
-- "Search within the current buffer
|
||||
-- inoremap <C-F> <Esc>/
|
||||
-- "Search within the whole project
|
||||
-- inoremap <C-S-F> <CMD>Rg<CR>
|
||||
-- "Move line down (uses vim-unimpaired) (replaced <CR> clone)
|
||||
-- inoremap <C-J> <Esc>ddpi
|
||||
-- "Move line up (uses vim-unimpaired) (replaced start digraph, use command instead)
|
||||
-- inoremap <C-K> <Esc>ddkPi
|
||||
-- "Does not work because of legacy reasons
|
||||
-- " inoremap <C-M> <CMD>Marks<CR>
|
||||
-- "Add line below (replaced execute single command in normal)
|
||||
-- inoremap <C-O> <Esc>o
|
||||
-- "Add line above
|
||||
-- inoremap <C-S-O> <Esc>O
|
||||
-- "Search version controlled files (replaced autocomplete reverse)
|
||||
-- inoremap <C-P> <CMD>GFiles<CR>
|
||||
-- "Search all files in directory
|
||||
-- inoremap <C-S-P> <CMD>Files<CR>
|
||||
-- "Toggle file draw (replaces CTRL-v clone)
|
||||
-- inoremap <C-S-Q> <CMD>CHADopen<CR>
|
||||
-- "Search all snippets (uses ultisnips)
|
||||
-- inoremap <C-S> <CMD>Snippets<CR>
|
||||
-- "Search git history (replaced inserting characters from above)
|
||||
-- inoremap <C-Y> <CMD>Commits<CR>
|
||||
-- "Search git history within current buffer/selection
|
||||
-- inoremap <C-S-Y> <CMD>BCommits<CR>
|
||||
--
|
||||
-- "Add simple highlight removal
|
||||
-- nnoremap <Leader><Space> :nohlsearch<CR>
|
||||
--
|
||||
-- "Convert tabs to spaces
|
||||
-- nnoremap <Leader><Tab> :retab<CR>
|
||||
--
|
||||
-- "Git mappings
|
||||
-- nnoremap ga :Git add %<CR>
|
||||
-- nnoremap gb :Git blame<CR>
|
||||
-- nnoremap gC :Git commit<CR>
|
||||
-- nnoremap gp :Git push<CR>
|
||||
-- nnoremap gP :Git pull<CR>
|
||||
--
|
||||
-- "Map movement keys to Escape
|
||||
-- inoremap jj <Esc>
|
||||
-- inoremap jk <Esc>
|
||||
-- inoremap kk <Esc>
|
||||
-- inoremap hh <Esc>
|
||||
--
|
||||
-- "Delete a line in insert mode
|
||||
-- " inoremap <C-D> <Esc>ddi
|
||||
--
|
||||
-- "Use semicolon instead of colon for commands
|
||||
-- nnoremap ; :
|
||||
-- nnoremap : ;
|
||||
--
|
||||
-- "Append the line with a semicolon
|
||||
-- inoremap <Leader>; <Esc>mzA;<Esc>`za
|
||||
-- nnoremap <Leader>; mzA;<Esc>`za<Esc>
|
||||
--
|
||||
-- "Easily navigate items in the quickfix menu
|
||||
-- nnoremap <Leader>] :cnext<CR>
|
||||
-- nnoremap <Leader>[ :cprevious<CR>
|
||||
--
|
||||
-- "Indent arrays
|
||||
-- nnoremap <Leader>{ mzF[`a<CR><Esc>``%i<CR><Esc>`z
|
||||
-- nnoremap <Leader>} mzF[`a<CR><Esc>``%i<CR><Esc>`zvi[:s/,\s*/,\r/g<CR>vi[=<Esc>`z:nohlsearch<CR>
|
||||
--
|
||||
-- "A command to properly indent json code
|
||||
-- command! FormatJSON %!python -m json.tool
|
||||
--
|
||||
-- " Allow saving of files as doas
|
||||
-- command! W execute 'silent! w !doas /usr/bin/tee % >/dev/null' <BAR> edit!
|
||||
-- command! X execute 'silent! x !doas /usr/bin/tee % >/dev/null' <BAR> edit!
|
||||
--
|
||||
-- " }}}
|
||||
--
|
||||
-- " Plugins --- {{{
|
||||
--
|
||||
-- " COC --- {{{
|
||||
-- " Use tab for trigger completion with characters ahead and navigate
|
||||
-- " NOTE: There's always complete item selected by default, you may want to enable
|
||||
-- " no select by `"suggest.noselect": true` in your configuration file
|
||||
-- " NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
-- " other plugin before putting this into your config
|
||||
-- inoremap <silent><expr> <TAB>
|
||||
-- \ coc#pum#visible() ? coc#pum#next(1) :
|
||||
-- \ CheckBackspace() ? "\<Tab>" :
|
||||
-- \ coc#refresh()
|
||||
-- inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
||||
--
|
||||
-- " Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||
-- " <C-g>u breaks current undo, please make your own choice
|
||||
-- inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
||||
-- \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
--
|
||||
-- function! CheckBackspace() abort
|
||||
-- let col = col('.') - 1
|
||||
-- return !col || getline('.')[col - 1] =~# '\s'
|
||||
-- endfunction
|
||||
--
|
||||
-- if has('nvim')
|
||||
-- inoremap <silent><expr> <c-space> coc#refresh()
|
||||
-- else
|
||||
-- inoremap <silent><expr> <c-@> coc#refresh()
|
||||
-- endif
|
||||
--
|
||||
-- " Use `[g` and `]g` to navigate diagnostics
|
||||
-- " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||
-- nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
-- nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
--
|
||||
-- " GoTo code navigation
|
||||
-- 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 ShowDocumentation()<CR>
|
||||
--
|
||||
-- function! ShowDocumentation()
|
||||
-- if CocAction('hasProvider', 'hover')
|
||||
-- call CocActionAsync('doHover')
|
||||
-- else
|
||||
-- call feedkeys('K', 'in')
|
||||
-- endif
|
||||
-- endfunction
|
||||
--
|
||||
-- " Highlight the symbol and its references when holding the cursor
|
||||
-- autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
--
|
||||
-- " Symbol renaming
|
||||
-- nmap <leader>rn <Plug>(coc-rename)
|
||||
--
|
||||
-- " Formatting selected code
|
||||
-- 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
|
||||
--
|
||||
-- " Applying code actions to the selected code block
|
||||
-- " Example: `<leader>aap` for current paragraph
|
||||
-- xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
-- nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
--
|
||||
-- " Remap keys for applying code actions at the cursor position
|
||||
-- nmap <leader>ac <Plug>(coc-codeaction-cursor)
|
||||
-- " Remap keys for apply code actions affect whole buffer
|
||||
-- nmap <leader>as <Plug>(coc-codeaction-source)
|
||||
-- " Apply the most preferred quickfix action to fix diagnostic on the current line
|
||||
-- nmap <leader>qf <Plug>(coc-fix-current)
|
||||
--
|
||||
-- " Remap keys for applying refactor code actions
|
||||
-- nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
|
||||
-- xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
|
||||
-- nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
|
||||
--
|
||||
-- " Run the Code Lens action on the current line
|
||||
-- nmap <leader>cl <Plug>(coc-codelens-action)
|
||||
--
|
||||
-- " Map function and class text objects
|
||||
-- " NOTE: Requires 'textDocument.documentSymbol' support from the language server
|
||||
-- xmap if <Plug>(coc-funcobj-i)
|
||||
-- omap if <Plug>(coc-funcobj-i)
|
||||
-- xmap af <Plug>(coc-funcobj-a)
|
||||
-- omap af <Plug>(coc-funcobj-a)
|
||||
-- xmap ic <Plug>(coc-classobj-i)
|
||||
-- omap ic <Plug>(coc-classobj-i)
|
||||
-- xmap ac <Plug>(coc-classobj-a)
|
||||
-- omap ac <Plug>(coc-classobj-a)
|
||||
--
|
||||
-- " Remap <C-f> and <C-b> to scroll float windows/popups
|
||||
-- " if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||
-- " nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
-- " nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
-- " inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||
-- " inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||
-- " vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
-- " vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
-- " endif
|
||||
--
|
||||
-- " Use CTRL-S for selections ranges
|
||||
-- " Requires 'textDocument/selectionRange' support of language server
|
||||
-- nmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
-- xmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
--
|
||||
-- " Add `:Format` command to format current buffer
|
||||
-- command! -nargs=0 Format :call CocActionAsync('format')
|
||||
--
|
||||
-- " Add `:Fold` command to fold current buffer
|
||||
-- command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
--
|
||||
-- " Add `:OR` command for organize imports of the current buffer
|
||||
-- command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
|
||||
--
|
||||
-- " Add (Neo)Vim's native statusline support
|
||||
-- " NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||
-- " provide custom statusline: lightline.vim, vim-airline
|
||||
-- set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
--
|
||||
--
|
||||
-- " Mappings for CoCList
|
||||
-- " Show all diagnostics
|
||||
-- nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
||||
-- " Manage extensions
|
||||
-- nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
|
||||
-- " Show commands
|
||||
-- nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
|
||||
-- " Find symbol of current document
|
||||
-- nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
|
||||
-- " Search workspace symbols
|
||||
-- nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
|
||||
-- " Do default action for next item
|
||||
-- nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
|
||||
-- " Do default action for previous item
|
||||
-- nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
||||
-- " Resume latest coc list
|
||||
-- nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||
--
|
||||
-- " }}}
|
||||
--
|
||||
-- " Emmet --- {{{
|
||||
-- " Toggle emmet completion using <Tab> with <Leader>em
|
||||
-- let g:emmet_completion = 0
|
||||
-- function ToggleEmmet()
|
||||
-- if g:emmet_completion
|
||||
-- echo "Emmet completion off!"
|
||||
-- let g:user_emmet_expandabbr_key=','
|
||||
-- iunmap <Tab>
|
||||
-- let g:emmet_completion = 0
|
||||
-- else
|
||||
-- echo "Emmet completion on!"
|
||||
-- let g:user_emmet_expandabbr_key='<Tab>'
|
||||
-- imap <Expr> <Tab> emmet#expandAbbrIntelligent("\<Tab>")
|
||||
-- let g:emmet_completion = 1
|
||||
-- endif
|
||||
-- endfunction
|
||||
-- nnoremap <Leader>em :call ToggleEmmet()<CR>
|
||||
-- " }}}
|
||||
--
|
||||
-- " Markdown --- {{{
|
||||
-- " Conceal markdown text
|
||||
-- set conceallevel=3
|
||||
-- " }}}
|
||||
--
|
||||
-- " AutoPairs --- {{{
|
||||
-- let g:AutoPairsFlyMode = 0
|
||||
-- let g:AutoPairsShortcutBackInsert = '<M-b>' " Use <M-B> to insert the closing parentheses if it jumped ahead by mistake
|
||||
-- " }}}
|
||||
--
|
||||
-- " CHADTree --- {{{
|
||||
-- let g:chadtree_settings = {
|
||||
-- \ 'theme': {
|
||||
-- \ 'icon_glyph_set': 'devicons',
|
||||
-- \ 'text_colour_set': 'env',
|
||||
-- \ 'icon_colour_set': 'github',
|
||||
-- \ "discrete_colour_map": {
|
||||
-- \ "black": "#21222c",
|
||||
-- \ "red": "#ff5555",
|
||||
-- \ "green": "#50fa7b",
|
||||
-- \ "yellow": "#f1fa8c",
|
||||
-- \ "blue": "#bd93f9",
|
||||
-- \ "magenta": "#ff79c6",
|
||||
-- \ "cyan": "#8be9fd",
|
||||
-- \ "white": "#f8f8f2",
|
||||
-- \ "bright_black": "#6272a4",
|
||||
-- \ "bright_red": "#ff6e6e",
|
||||
-- \ "bright_green": "#69ff94",
|
||||
-- \ "bright_yellow": "#ffffa5",
|
||||
-- \ "bright_blue": "#d6acff",
|
||||
-- \ "bright_magenta": "#ff92df",
|
||||
-- \ "bright_cyan": "#a4ffff",
|
||||
-- \ "bright_white": "#ffffff"
|
||||
-- \ }
|
||||
-- \ }
|
||||
-- \ }
|
||||
-- " }}}
|
||||
--
|
||||
-- " Commentary --- {{{
|
||||
-- " function s:set_commentary_format()
|
||||
-- " echo "running command"
|
||||
-- " if &filetype =~ 'vue\|html\|svelte'
|
||||
-- " if searchpair('<\(script\|style\)', '', '</\(script\|style\)>', 'Wn')
|
||||
-- " let b:commentary_format="// %s"
|
||||
-- " else
|
||||
-- " let b:commentary_format=&commentstring
|
||||
-- " endif
|
||||
-- " endif
|
||||
-- " endfunction
|
||||
--
|
||||
-- " xnoremap gc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
-- " nnoremap gc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
-- " onoremap gc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
-- " nnoremap gcc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
-- " nnoremap cgc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
-- " nnoremap cgu :call <SID>set_commentary_format()<CR><Plug>Commentary<Plug>Commentary
|
||||
-- " }}}
|
||||
--
|
||||
-- " Easymotion --- {{{
|
||||
-- let g:EasyMotion_do_mapping = 0 " Disable default mappings
|
||||
--
|
||||
-- map <Leader> <Plug>(easymotion-prefix)
|
||||
-- " Jump to anywhere you want with minimal keystrokes, with just one key binding.
|
||||
-- " `s{char}{label}
|
||||
-- nmap s <Plug>(easymotion-overwin-f)
|
||||
--
|
||||
-- " Turn on case-insensitive feature
|
||||
-- let g:EasyMotion_smartcase = 1
|
||||
--
|
||||
-- " JK motions: Line motions
|
||||
-- map <Leader>j <Plug>(easymotion-j)
|
||||
-- map <Leader>k <Plug>(easymotion-k)
|
||||
-- " }}}
|
||||
--
|
||||
-- " }}}
|
||||
--
|
||||
-- " PHP --- {{{
|
||||
-- " function! RunPHPUnitTest()
|
||||
-- " cd %:p:h
|
||||
-- " normal! T yw
|
||||
-- " let result = system("phpunit --filter " . @" . " " . bufname("%"))
|
||||
-- " split __PHPUnit_Result__
|
||||
-- " normal! ggdG
|
||||
-- " setlocal buftype=nofile
|
||||
-- " call append(0, split(result, '\v\n'))
|
||||
-- " cd -
|
||||
-- " endfunction
|
||||
--
|
||||
-- " nnoremap <F12> :call RunPHPUnitTest()<cr>
|
||||
-- " }}}
|
||||
--
|
||||
-- " Moving around --- {{{
|
||||
-- "Use capital H and L to move to the start and end of lines
|
||||
-- nnoremap H ^
|
||||
-- nnoremap L $
|
||||
--
|
||||
-- " }}}
|
||||
--
|
||||
-- " Operator mappings --- {{{
|
||||
-- onoremap in( :<C-U>normal! f(vi(<CR>
|
||||
-- onoremap il( :<C-U>normal! F)vi(<CR>
|
||||
-- onoremap an( :<C-U>normal! f(va(<CR>
|
||||
-- onoremap al( :<C-U>normal! F)va(<CR>
|
||||
-- onoremap an{ :<C-U>normal! f{vi{<CR>
|
||||
-- onoremap al{ :<C-U>normal! F}vi<CR>
|
||||
-- " }}}
|
||||
--
|
||||
-- " Abbreviations --- {{{
|
||||
-- iabbrev adn and
|
||||
-- iabbrev waht what
|
||||
-- iabbrev tehn then
|
||||
-- iabbrev tihs this
|
||||
-- iabbrev teh the
|
||||
-- iabbrev Teh The
|
||||
-- " }}}
|
||||
--
|
||||
-- " Auto-Commands --- {{{
|
||||
--
|
||||
-- "Automatically source the config files on save.
|
||||
-- augroup autosourcing
|
||||
-- autocmd!
|
||||
-- autocmd BufWritePost $MYVIMRC source % "Source the vimrc file
|
||||
-- augroup END
|
||||
--
|
||||
-- "Fold vimrc and zshrc files on open
|
||||
-- augroup autofolding
|
||||
-- autocmd!
|
||||
-- autocmd BufReadPost $MYVIMRC :setlocal foldlevelstart=0
|
||||
-- autocmd FileType vim setlocal foldmethod=marker
|
||||
-- autocmd BufReadPost zsh :setlocal foldlevelstart=0
|
||||
-- autocmd FileType zsh setlocal foldmethod=marker
|
||||
-- augroup END
|
||||
--
|
||||
-- "Set commentary formats
|
||||
-- function s:setcommentary()
|
||||
-- if &commentstring =~ '/\*\s*%s\s*\*/'
|
||||
-- let b:commentary_format="// %s"
|
||||
-- endif
|
||||
-- endfunction
|
||||
--
|
||||
-- augroup autocomment
|
||||
-- autocmd!
|
||||
-- autocmd FileType * call <SID>setcommentary()
|
||||
-- augroup END
|
||||
--
|
||||
-- "Automatically save files
|
||||
-- augroup autosaving
|
||||
-- autocmd!
|
||||
-- autocmd FocusLost * silent! wa "Save all files when moving away from the window
|
||||
-- autocmd InsertLeave * silent! wa "Save all files when leaving insert mode
|
||||
-- autocmd TextChanged * silent! wa "Save all files when text is changed
|
||||
-- augroup END
|
||||
--
|
||||
-- augroup modes
|
||||
-- autocmd!
|
||||
-- autocmd FocusLost * call feedkeys("\<Esc>") "Go to normal mode when moving away
|
||||
-- autocmd BufNewFile * call feedkeys("i") "Go to insert mode when starting a new file
|
||||
-- augroup END
|
||||
--
|
||||
-- "Recompile suckless software when updating config
|
||||
-- augroup suckless
|
||||
-- autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; doas make install && { killall -q dwmblocks;setsid -f dwmblocks }
|
||||
-- autocmd BufWritePost ~/.local/src/dwm/config.h !cd ~/.local/src/dwm/; doas make clean install
|
||||
-- autocmd BufWritePost ~/.local/src/st/config.h !cd ~/.local/src/st/; doas make clean install
|
||||
-- " }}}
|
||||
--
|
||||
-- " Notes and tips
|
||||
-- " - press 'zz' to instantly center the line where the cursor is located.
|
||||
-- " - You can increment numbers with <c-a>.
|
||||
-- " - To operate on multiple lines use <c-v> to select the lines, <c-i> to go to
|
||||
-- " insert mode, perform edit, press <esc>.
|
||||
-- " - Use the command :r to paste the output of a command to the buffer.
|
||||
593
init.vim
593
init.vim
@@ -1,593 +0,0 @@
|
||||
" Plugins --- {{{
|
||||
|
||||
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
|
||||
echo "Downloading junegunn/vim-plug to manage plugins..."
|
||||
silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
|
||||
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
|
||||
autocmd VimEnter * PlugInstall
|
||||
autocmd VimEnter * CHADdeps
|
||||
endif
|
||||
|
||||
let g:polyglot_disabled = ['markdown']
|
||||
|
||||
call plug#begin(stdpath('data') . '/plugged')
|
||||
Plug 'rafi/awesome-vim-colorschemes' " Provides a number of pretty themes
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Fast fuzzy file searching
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'tpope/vim-fugitive' " Adds git support to vim
|
||||
Plug 'tpope/vim-surround' " Adds motions for dealing with parentheses
|
||||
" Plug 'tpope/vim-commentary' " Easily comment/uncomment lines with `gc` (updated to work with style/script)
|
||||
Plug 'tpope/vim-unimpaired' " A series of bindings for complementary actions [<space> and ]<space> for adding lines before and after
|
||||
Plug 'tpope/vim-vinegar' " Improvements to the file browser
|
||||
Plug 'jiangmiao/auto-pairs' " Creates closing parentheses when writing the opening, use <m-e> to wrap the next word/group, <m-p> to disable
|
||||
Plug 'mattn/emmet-vim' " Emmet support ,em to toggle it
|
||||
Plug 'dylanaraps/wal.vim' " Set the theme to match the system colours
|
||||
Plug 'godlygeek/tabular' " Easy alligning of code based on match, :Tab/| will line up markdown tables
|
||||
Plug 'plasticboy/vim-markdown' " All markdown features (some are disabled by polyglot)
|
||||
Plug 'sheerun/vim-polyglot' " Dynamically loads syntax hilighting from multiple packages
|
||||
Plug 'ms-jpq/chadtree', { 'branch': 'chad', 'do': 'python3 -m chadtree deps' } " A file tree
|
||||
"Plug 'wakatime/vim-wakatime'
|
||||
Plug 'neoclide/coc.nvim', { 'branch': 'release' } " Autocompletion
|
||||
Plug 'github/copilot.vim' " Copilot
|
||||
Plug 'easymotion/vim-easymotion' " Advanced navigation
|
||||
Plug 'antoinemadec/coc-fzf' " Open CocList results in fzf
|
||||
|
||||
"Plug 'phpactor/phpactor', { 'do': 'composer install', 'for': 'php' }
|
||||
"Plug 'ncm2/ncm2'
|
||||
"Plug 'roxma/nvim-yarp'
|
||||
|
||||
"autocmd BufEnter * call ncm2#enable_for_buffer()
|
||||
"set completeopt=noinsert,menuone,noselect
|
||||
|
||||
"Plug 'phpactor/ncm2-phpactor'
|
||||
"
|
||||
" vim-devicons must be last plugin
|
||||
Plug 'ryanoasis/vim-devicons' " Icons for file tree
|
||||
|
||||
call plug#end()
|
||||
" }}}
|
||||
|
||||
" Basic settings ---- {{{
|
||||
set nocompatible "Use the latest vim settings/options
|
||||
syntax enable "Enable syntax highlighting
|
||||
let mapleader = ',' "The default leader is \, but a comma is much better
|
||||
let localleader = '\\' "The leader to be used for filetype specific mappings
|
||||
set number relativenumber "Show relative line numbers
|
||||
set noerrorbells visualbell t_vb= "Remove the bells
|
||||
set tabstop=4 "Set how many columns a tab counts for
|
||||
set shiftwidth=4 "How many columns text is indented when using reindent
|
||||
set softtabstop=4 "Set columns for tabs in insert mode
|
||||
set expandtab "Use spaces instead of tabs
|
||||
set smartindent "Automatically indent code
|
||||
set ignorecase "Ignores case when searching
|
||||
set smartcase "Doesn't ignore case when the search includes upper case characters
|
||||
set backupdir=/tmp// "Store backup files in the /tmp directory
|
||||
set directory=/tmp// "Store swap files in the /tmp directory
|
||||
set undodir=/tmp// "Store undo history in the /tmp directory
|
||||
set undofile "Store the undo history
|
||||
"set spell "Enable spell checking
|
||||
set autowriteall "Save the file when switching buffers
|
||||
set colorcolumn=80,120
|
||||
set updatetime=300 " Recommended by COC
|
||||
set signcolumn=yes " Also recommended by COC
|
||||
" }}}
|
||||
|
||||
" Visuals ---- {{{
|
||||
if isdirectory(system('echo -n "${XDG_CACHE_HOME:-$HOME/.cache}/wal"'))
|
||||
colorscheme guiwal
|
||||
else
|
||||
colorscheme atom-dark
|
||||
endif
|
||||
|
||||
set t_Co=256 "User 256 colors. This is useful for terminal vim
|
||||
set guifont=Fira_Code:h17
|
||||
set guioptions-=e "We don't want GUI tabs
|
||||
set termguicolors
|
||||
|
||||
set guioptions-=l
|
||||
set guioptions-=L
|
||||
set guioptions-=r
|
||||
set guioptions-=R
|
||||
set nowrap "Don't wrap lines around
|
||||
"Set line number Colour to be same as background
|
||||
hi LineNr guibg=bg
|
||||
"Get rid of ugly split borders
|
||||
hi vertsplit guifg=bg guibg=bg
|
||||
" }}}
|
||||
|
||||
" Navigation --- {{{
|
||||
set splitbelow
|
||||
set splitright
|
||||
|
||||
"Increase/Decrease window size
|
||||
nnoremap <M-q> <C-W><
|
||||
nnoremap <M-w> <C-W>>
|
||||
nnoremap <M-S-q> <C-W>+
|
||||
nnoremap <M-S-w> <C-W>-
|
||||
"Move around splits
|
||||
nnoremap <M-h> <C-W><C-H>
|
||||
nnoremap <M-l> <C-W><C-L>
|
||||
nnoremap <M-j> <C-W><C-J>
|
||||
nnoremap <M-k> <C-W><C-K>
|
||||
"Go to next tab
|
||||
nnoremap <M-S-l> :tabnext<CR>
|
||||
nnoremap <M-S-h> :tabprev<CR>
|
||||
nnoremap <M-f> :vertical resize<CR>:resize<CR>
|
||||
nnoremap <M-g> <C-W>=
|
||||
nnoremap <M-s> :vsplit<CR>
|
||||
nnoremap <M-v> :split<CR>
|
||||
nnoremap <M-w> :q<CR>
|
||||
" }}}
|
||||
|
||||
" Search --- {{{
|
||||
set hlsearch
|
||||
set incsearch
|
||||
|
||||
set path+=**
|
||||
" }}}
|
||||
|
||||
" Mappings --- {{{
|
||||
" Editing files - {{{
|
||||
"Make it easy to edit the vimrc file
|
||||
nnoremap <Leader>ev :tabedit $MYVIMRC<CR>
|
||||
"Source the vimrc file
|
||||
nnoremap <Leader>es :source $MYVIMRC<CR>
|
||||
" }}}
|
||||
|
||||
"Changing unused ctrl bindings
|
||||
"Turn on git blame
|
||||
nnoremap <C-S-A> <CMD>Git blame<CR>
|
||||
"List all tags in the current buffer (replaced pageup, use CTRL-u instead)
|
||||
nnoremap <C-Q> <CMD>CocFzfList outline<CR>
|
||||
"List all tags in directory
|
||||
"nnoremap <C-S-B> <CMD>Tags<CR>
|
||||
"List all the recently opened files (replaced scroll one line up, use "k")
|
||||
nnoremap <C-E> <CMD>History<CR>
|
||||
"Search within the current buffer (replaced pagedown, use CTRL-d instead)
|
||||
"nnoremap <C-F> /
|
||||
"Search within the whole project
|
||||
nnoremap <C-F> <CMD>Rg<CR>
|
||||
"Move line down (uses vim-unimpaired) (replaced move down, use "j")
|
||||
nnoremap <C-J> <C-E>
|
||||
"Move line up (uses vim-unimpaired) (replaced move up, use "k")
|
||||
nnoremap <C-K> <C-Y>
|
||||
"Does not work because of legacy reasons
|
||||
" nnoremap <C-M>
|
||||
"Search marks (replaced "j" clone)
|
||||
nnoremap <C-N> <CMD>Marks<CR>
|
||||
"Search version controlled files (replaced move up, use "k")
|
||||
nnoremap <C-P> <CMD>GFiles<CR>
|
||||
"Search all files in directory
|
||||
nnoremap <C-S-P> <CMD>Files<CR>
|
||||
"Toggle file draw
|
||||
nnoremap <C-S-Q> <CMD>CHADopen<CR>
|
||||
"Search all snippets (uses ultisnips)
|
||||
nnoremap <C-S> <CMD>Snippets<CR>
|
||||
"Search git history (replaced scroll one line up, use "k")
|
||||
nnoremap <C-Y> <CMD>Commits<CR>
|
||||
"Search git history within current buffer/selection
|
||||
nnoremap <C-S-Y> <CMD>BCommits<CR>
|
||||
|
||||
"Turn on git blame
|
||||
inoremap <C-S-A> <CMD>Git blame<CR>
|
||||
"List all tags in the current buffer
|
||||
inoremap <C-Q> <CMD>BTags<CR>
|
||||
"List all tags in directory
|
||||
inoremap <C-S-Q> <CMD>Tags<CR>
|
||||
"List all the recently opened files (replaced inserting characters from below)
|
||||
inoremap <C-E> <CMD>History<CR>
|
||||
"Search within the current buffer
|
||||
inoremap <C-F> <Esc>/
|
||||
"Search within the whole project
|
||||
inoremap <C-S-F> <CMD>Rg<CR>
|
||||
"Move line down (uses vim-unimpaired) (replaced <CR> clone)
|
||||
inoremap <C-J> <Esc>ddpi
|
||||
"Move line up (uses vim-unimpaired) (replaced start digraph, use command instead)
|
||||
inoremap <C-K> <Esc>ddkPi
|
||||
"Does not work because of legacy reasons
|
||||
" inoremap <C-M> <CMD>Marks<CR>
|
||||
"Add line below (replaced execute single command in normal)
|
||||
inoremap <C-O> <Esc>o
|
||||
"Add line above
|
||||
inoremap <C-S-O> <Esc>O
|
||||
"Search version controlled files (replaced autocomplete reverse)
|
||||
inoremap <C-P> <CMD>GFiles<CR>
|
||||
"Search all files in directory
|
||||
inoremap <C-S-P> <CMD>Files<CR>
|
||||
"Toggle file draw (replaces CTRL-v clone)
|
||||
inoremap <C-S-Q> <CMD>CHADopen<CR>
|
||||
"Search all snippets (uses ultisnips)
|
||||
inoremap <C-S> <CMD>Snippets<CR>
|
||||
"Search git history (replaced inserting characters from above)
|
||||
inoremap <C-Y> <CMD>Commits<CR>
|
||||
"Search git history within current buffer/selection
|
||||
inoremap <C-S-Y> <CMD>BCommits<CR>
|
||||
|
||||
"Add simple highlight removal
|
||||
nnoremap <Leader><Space> :nohlsearch<CR>
|
||||
|
||||
"Convert tabs to spaces
|
||||
nnoremap <Leader><Tab> :retab<CR>
|
||||
|
||||
"Git mappings
|
||||
nnoremap ga :Git add %<CR>
|
||||
nnoremap gb :Git blame<CR>
|
||||
nnoremap gC :Git commit<CR>
|
||||
nnoremap gp :Git push<CR>
|
||||
nnoremap gP :Git pull<CR>
|
||||
|
||||
"Map movement keys to Escape
|
||||
inoremap jj <Esc>
|
||||
inoremap jk <Esc>
|
||||
inoremap kk <Esc>
|
||||
inoremap hh <Esc>
|
||||
|
||||
"Delete a line in insert mode
|
||||
" inoremap <C-D> <Esc>ddi
|
||||
|
||||
"Use semicolon instead of colon for commands
|
||||
nnoremap ; :
|
||||
nnoremap : ;
|
||||
|
||||
"Append the line with a semicolon
|
||||
inoremap <Leader>; <Esc>mzA;<Esc>`za
|
||||
nnoremap <Leader>; mzA;<Esc>`za<Esc>
|
||||
|
||||
"Easily navigate items in the quickfix menu
|
||||
nnoremap <Leader>] :cnext<CR>
|
||||
nnoremap <Leader>[ :cprevious<CR>
|
||||
|
||||
"Indent arrays
|
||||
nnoremap <Leader>{ mzF[`a<CR><Esc>``%i<CR><Esc>`z
|
||||
nnoremap <Leader>} mzF[`a<CR><Esc>``%i<CR><Esc>`zvi[:s/,\s*/,\r/g<CR>vi[=<Esc>`z:nohlsearch<CR>
|
||||
|
||||
"A command to properly indent json code
|
||||
command! FormatJSON %!python -m json.tool
|
||||
|
||||
" Allow saving of files as doas
|
||||
command! W execute 'silent! w !doas /usr/bin/tee % >/dev/null' <BAR> edit!
|
||||
command! X execute 'silent! x !doas /usr/bin/tee % >/dev/null' <BAR> edit!
|
||||
|
||||
" }}}
|
||||
|
||||
" Plugins --- {{{
|
||||
|
||||
" COC --- {{{
|
||||
" Use tab for trigger completion with characters ahead and navigate
|
||||
" NOTE: There's always complete item selected by default, you may want to enable
|
||||
" no select by `"suggest.noselect": true` in your configuration file
|
||||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
" other plugin before putting this into your config
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ coc#pum#visible() ? coc#pum#next(1) :
|
||||
\ CheckBackspace() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
||||
|
||||
" Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||
" <C-g>u breaks current undo, please make your own choice
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
function! CheckBackspace() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
if has('nvim')
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
else
|
||||
inoremap <silent><expr> <c-@> coc#refresh()
|
||||
endif
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" GoTo code navigation
|
||||
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 ShowDocumentation()<CR>
|
||||
|
||||
function! ShowDocumentation()
|
||||
if CocAction('hasProvider', 'hover')
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
call feedkeys('K', 'in')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Symbol renaming
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Formatting selected code
|
||||
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
|
||||
|
||||
" Applying code actions to the selected code block
|
||||
" Example: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap keys for applying code actions at the cursor position
|
||||
nmap <leader>ac <Plug>(coc-codeaction-cursor)
|
||||
" Remap keys for apply code actions affect whole buffer
|
||||
nmap <leader>as <Plug>(coc-codeaction-source)
|
||||
" Apply the most preferred quickfix action to fix diagnostic on the current line
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Remap keys for applying refactor code actions
|
||||
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
|
||||
xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
|
||||
nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
|
||||
|
||||
" Run the Code Lens action on the current line
|
||||
nmap <leader>cl <Plug>(coc-codelens-action)
|
||||
|
||||
" Map function and class text objects
|
||||
" NOTE: Requires 'textDocument.documentSymbol' support from the language server
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
xmap ic <Plug>(coc-classobj-i)
|
||||
omap ic <Plug>(coc-classobj-i)
|
||||
xmap ac <Plug>(coc-classobj-a)
|
||||
omap ac <Plug>(coc-classobj-a)
|
||||
|
||||
" Remap <C-f> and <C-b> to scroll float windows/popups
|
||||
" if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||
" nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
" nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
" inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||
" inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||
" vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
" vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
" endif
|
||||
|
||||
" Use CTRL-S for selections ranges
|
||||
" Requires 'textDocument/selectionRange' support of language server
|
||||
nmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
|
||||
" Add `:Format` command to format current buffer
|
||||
command! -nargs=0 Format :call CocActionAsync('format')
|
||||
|
||||
" Add `:Fold` command to fold current buffer
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" Add `:OR` command for organize imports of the current buffer
|
||||
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add (Neo)Vim's native statusline support
|
||||
" NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||
" provide custom statusline: lightline.vim, vim-airline
|
||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
|
||||
" Mappings for CoCList
|
||||
" Show all diagnostics
|
||||
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions
|
||||
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands
|
||||
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document
|
||||
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols
|
||||
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item
|
||||
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item
|
||||
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list
|
||||
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
" }}}
|
||||
|
||||
" Emmet --- {{{
|
||||
" Toggle emmet completion using <Tab> with <Leader>em
|
||||
let g:emmet_completion = 0
|
||||
function ToggleEmmet()
|
||||
if g:emmet_completion
|
||||
echo "Emmet completion off!"
|
||||
let g:user_emmet_expandabbr_key=','
|
||||
iunmap <Tab>
|
||||
let g:emmet_completion = 0
|
||||
else
|
||||
echo "Emmet completion on!"
|
||||
let g:user_emmet_expandabbr_key='<Tab>'
|
||||
imap <Expr> <Tab> emmet#expandAbbrIntelligent("\<Tab>")
|
||||
let g:emmet_completion = 1
|
||||
endif
|
||||
endfunction
|
||||
nnoremap <Leader>em :call ToggleEmmet()<CR>
|
||||
" }}}
|
||||
|
||||
" Markdown --- {{{
|
||||
" Conceal markdown text
|
||||
set conceallevel=3
|
||||
" }}}
|
||||
|
||||
" AutoPairs --- {{{
|
||||
let g:AutoPairsFlyMode = 0
|
||||
let g:AutoPairsShortcutBackInsert = '<M-b>' " Use <M-B> to insert the closing parentheses if it jumped ahead by mistake
|
||||
" }}}
|
||||
|
||||
" CHADTree --- {{{
|
||||
let g:chadtree_settings = {
|
||||
\ 'theme': {
|
||||
\ 'icon_glyph_set': 'devicons',
|
||||
\ 'text_colour_set': 'env',
|
||||
\ 'icon_colour_set': 'github',
|
||||
\ "discrete_colour_map": {
|
||||
\ "black": "#21222c",
|
||||
\ "red": "#ff5555",
|
||||
\ "green": "#50fa7b",
|
||||
\ "yellow": "#f1fa8c",
|
||||
\ "blue": "#bd93f9",
|
||||
\ "magenta": "#ff79c6",
|
||||
\ "cyan": "#8be9fd",
|
||||
\ "white": "#f8f8f2",
|
||||
\ "bright_black": "#6272a4",
|
||||
\ "bright_red": "#ff6e6e",
|
||||
\ "bright_green": "#69ff94",
|
||||
\ "bright_yellow": "#ffffa5",
|
||||
\ "bright_blue": "#d6acff",
|
||||
\ "bright_magenta": "#ff92df",
|
||||
\ "bright_cyan": "#a4ffff",
|
||||
\ "bright_white": "#ffffff"
|
||||
\ }
|
||||
\ }
|
||||
\ }
|
||||
" }}}
|
||||
|
||||
" Commentary --- {{{
|
||||
" function s:set_commentary_format()
|
||||
" echo "running command"
|
||||
" if &filetype =~ 'vue\|html\|svelte'
|
||||
" if searchpair('<\(script\|style\)', '', '</\(script\|style\)>', 'Wn')
|
||||
" let b:commentary_format="// %s"
|
||||
" else
|
||||
" let b:commentary_format=&commentstring
|
||||
" endif
|
||||
" endif
|
||||
" endfunction
|
||||
|
||||
" xnoremap gc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
" nnoremap gc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
" onoremap gc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
" nnoremap gcc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
" nnoremap cgc :call <SID>set_commentary_format()<CR><Plug>Commentary
|
||||
" nnoremap cgu :call <SID>set_commentary_format()<CR><Plug>Commentary<Plug>Commentary
|
||||
" }}}
|
||||
|
||||
" Easymotion --- {{{
|
||||
let g:EasyMotion_do_mapping = 0 " Disable default mappings
|
||||
|
||||
map <Leader> <Plug>(easymotion-prefix)
|
||||
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
|
||||
" `s{char}{label}
|
||||
nmap s <Plug>(easymotion-overwin-f)
|
||||
|
||||
" Turn on case-insensitive feature
|
||||
let g:EasyMotion_smartcase = 1
|
||||
|
||||
" JK motions: Line motions
|
||||
map <Leader>j <Plug>(easymotion-j)
|
||||
map <Leader>k <Plug>(easymotion-k)
|
||||
" }}}
|
||||
|
||||
" }}}
|
||||
|
||||
" PHP --- {{{
|
||||
" function! RunPHPUnitTest()
|
||||
" cd %:p:h
|
||||
" normal! T yw
|
||||
" let result = system("phpunit --filter " . @" . " " . bufname("%"))
|
||||
" split __PHPUnit_Result__
|
||||
" normal! ggdG
|
||||
" setlocal buftype=nofile
|
||||
" call append(0, split(result, '\v\n'))
|
||||
" cd -
|
||||
" endfunction
|
||||
|
||||
" nnoremap <F12> :call RunPHPUnitTest()<cr>
|
||||
" }}}
|
||||
|
||||
" Moving around --- {{{
|
||||
"Use capital H and L to move to the start and end of lines
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
|
||||
" Operator mappings --- {{{
|
||||
onoremap in( :<C-U>normal! f(vi(<CR>
|
||||
onoremap il( :<C-U>normal! F)vi(<CR>
|
||||
onoremap an( :<C-U>normal! f(va(<CR>
|
||||
onoremap al( :<C-U>normal! F)va(<CR>
|
||||
onoremap an{ :<C-U>normal! f{vi{<CR>
|
||||
onoremap al{ :<C-U>normal! F}vi<CR>
|
||||
" }}}
|
||||
|
||||
" Abbreviations --- {{{
|
||||
iabbrev adn and
|
||||
iabbrev waht what
|
||||
iabbrev tehn then
|
||||
iabbrev tihs this
|
||||
iabbrev teh the
|
||||
iabbrev Teh The
|
||||
" }}}
|
||||
|
||||
" Auto-Commands --- {{{
|
||||
|
||||
"Automatically source the config files on save.
|
||||
augroup autosourcing
|
||||
autocmd!
|
||||
autocmd BufWritePost $MYVIMRC source % "Source the vimrc file
|
||||
augroup END
|
||||
|
||||
"Fold vimrc and zshrc files on open
|
||||
augroup autofolding
|
||||
autocmd!
|
||||
autocmd BufReadPost $MYVIMRC :setlocal foldlevelstart=0
|
||||
autocmd FileType vim setlocal foldmethod=marker
|
||||
autocmd BufReadPost zsh :setlocal foldlevelstart=0
|
||||
autocmd FileType zsh setlocal foldmethod=marker
|
||||
augroup END
|
||||
|
||||
"Set commentary formats
|
||||
function s:setcommentary()
|
||||
if &commentstring =~ '/\*\s*%s\s*\*/'
|
||||
let b:commentary_format="// %s"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
augroup autocomment
|
||||
autocmd!
|
||||
autocmd FileType * call <SID>setcommentary()
|
||||
augroup END
|
||||
|
||||
"Automatically save files
|
||||
augroup autosaving
|
||||
autocmd!
|
||||
autocmd FocusLost * silent! wa "Save all files when moving away from the window
|
||||
autocmd InsertLeave * silent! wa "Save all files when leaving insert mode
|
||||
autocmd TextChanged * silent! wa "Save all files when text is changed
|
||||
augroup END
|
||||
|
||||
augroup modes
|
||||
autocmd!
|
||||
autocmd FocusLost * call feedkeys("\<Esc>") "Go to normal mode when moving away
|
||||
autocmd BufNewFile * call feedkeys("i") "Go to insert mode when starting a new file
|
||||
augroup END
|
||||
|
||||
"Recompile suckless software when updating config
|
||||
augroup suckless
|
||||
autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; doas make install && { killall -q dwmblocks;setsid -f dwmblocks }
|
||||
autocmd BufWritePost ~/.local/src/dwm/config.h !cd ~/.local/src/dwm/; doas make clean install
|
||||
autocmd BufWritePost ~/.local/src/st/config.h !cd ~/.local/src/st/; doas make clean install
|
||||
" }}}
|
||||
|
||||
" Notes and tips
|
||||
" - press 'zz' to instantly center the line where the cursor is located.
|
||||
" - You can increment numbers with <c-a>.
|
||||
" - To operate on multiple lines use <c-v> to select the lines, <c-i> to go to
|
||||
" insert mode, perform edit, press <esc>.
|
||||
" - Use the command :r to paste the output of a command to the buffer.
|
||||
15
lua/autocmd.lua
Normal file
15
lua/autocmd.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
-- Highlight when yanking (copying) text
|
||||
-- Try it with `yap` in normal mode
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
require('helpers').edit_cf('a', '/lua/autocmd.lua')
|
||||
15
lua/helpers.lua
Normal file
15
lua/helpers.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local helpers = {}
|
||||
|
||||
--- Creates a keymap to edit a certain config file
|
||||
--- @param map string the keys that follow <Leader>e
|
||||
--- @param path string the relative path from the config root
|
||||
helpers.edit_cf = function(map, path)
|
||||
vim.keymap.set('n', '<Leader>e' .. map, function()
|
||||
vim.cmd('tabedit ' .. vim.fn.stdpath 'config' .. '/' .. path)
|
||||
end, { desc = 'Edit ' .. path .. ' in a new tab' })
|
||||
end
|
||||
|
||||
helpers.edit_cf('h', '/lua/helpers.lua')
|
||||
|
||||
return helpers
|
||||
-- nnoremap <Leader>ev :tabedit $MYVIMRC<CR>
|
||||
43
lua/keymap.lua
Normal file
43
lua/keymap.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Swap : and ; around
|
||||
vim.keymap.set('n', ':', ';')
|
||||
vim.keymap.set('n', ';', ':')
|
||||
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
-- See `:help hlsearch`
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
--
|
||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||
|
||||
-- TIP: Disable arrow keys in normal mode
|
||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
vim.keymap.set('n', '<C-S-h>', '<C-w>H', { desc = 'Move window to the left' })
|
||||
vim.keymap.set('n', '<C-S-l>', '<C-w>L', { desc = 'Move window to the right' })
|
||||
vim.keymap.set('n', '<C-S-j>', '<C-w>J', { desc = 'Move window to the lower' })
|
||||
vim.keymap.set('n', '<C-S-k>', '<C-w>K', { desc = 'Move window to the upper' })
|
||||
|
||||
require('helpers').edit_cf('k', '/lua/keymap.lua')
|
||||
49
lua/lazy_init.lua
Normal file
49
lua/lazy_init.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||
if vim.v.shell_error ~= 0 then
|
||||
error('Error cloning lazy.nvim:\n' .. out)
|
||||
end
|
||||
end ---@diagnostic disable-next-line: undefined-field
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- [[ Configure and install plugins ]]
|
||||
--
|
||||
-- To check the current status of your plugins, run
|
||||
-- :Lazy
|
||||
--
|
||||
-- You can press `?` in this menu for help. Use `:q` to close the window
|
||||
--
|
||||
-- To update plugins you can run
|
||||
-- :Lazy update
|
||||
--
|
||||
-- NOTE: Here is where you install your plugins.
|
||||
require('lazy').setup({
|
||||
{ import = 'plugins' },
|
||||
}, {
|
||||
ui = {
|
||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
||||
icons = vim.g.have_nerd_font and {} or {
|
||||
cmd = '⌘',
|
||||
config = '🛠',
|
||||
event = '📅',
|
||||
ft = '📂',
|
||||
init = '⚙',
|
||||
keys = '🗝',
|
||||
plugin = '🔌',
|
||||
runtime = '💻',
|
||||
require = '🌙',
|
||||
source = '📄',
|
||||
start = '🚀',
|
||||
task = '📌',
|
||||
lazy = '💤 ',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require('helpers').edit_cf('l', '/lua/lazy_init.lua')
|
||||
85
lua/opt.lua
Normal file
85
lua/opt.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt` and `:help option-list`
|
||||
|
||||
-- Make line numbers default
|
||||
vim.opt.number = true
|
||||
-- Line number indicates distance from cursor line
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.opt.showmode = false
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
-- Enable break indent
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.opt.undofile = true
|
||||
-- Store undo history in the /tmp directory
|
||||
vim.opt.undodir = '/tmp'
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.opt.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.opt.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
vim.opt.timeoutlen = 300
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
|
||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||
-- See `:help 'list'`
|
||||
-- and `:help 'listchars'`
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.opt.inccommand = 'split'
|
||||
|
||||
-- Show which line your cursor is on
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||
-- See `:help 'confirm'`
|
||||
vim.opt.confirm = true
|
||||
|
||||
-- How many columns text is indented when using reindent
|
||||
vim.opt.shiftwidth = 4
|
||||
-- How many columns a tab counts for
|
||||
vim.opt.tabstop = 4
|
||||
-- Set columns for tabs in insert mode
|
||||
vim.opt.softtabstop = 4
|
||||
-- Use spaces instead of tabs
|
||||
vim.opt.expandtab = true
|
||||
-- Automatically indent code
|
||||
vim.opt.smartindent = true
|
||||
|
||||
-- Save the file when switching buffers
|
||||
vim.opt.autowriteall = true
|
||||
|
||||
-- Add lines at 80 and 120 columns
|
||||
vim.opt.colorcolumn = '80,120'
|
||||
|
||||
require('helpers').edit_cf('o', '/lua/opt.lua')
|
||||
8
lua/plugins/autopairs.lua
Normal file
8
lua/plugins/autopairs.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- autopairs
|
||||
-- https://github.com/windwp/nvim-autopairs
|
||||
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {},
|
||||
}
|
||||
72
lua/plugins/avante.lua
Normal file
72
lua/plugins/avante.lua
Normal file
@@ -0,0 +1,72 @@
|
||||
require('helpers').edit_cf('pa', '/lua/plugins/avante.lua')
|
||||
|
||||
return {
|
||||
'yetone/avante.nvim',
|
||||
event = 'VeryLazy',
|
||||
version = false, -- Never set this value to "*"! Never!
|
||||
opts = {
|
||||
-- add any opts here
|
||||
-- for example
|
||||
provider = 'aihubmix',
|
||||
cursor_applying_provider = 'aihubmix_llama_versatile',
|
||||
aihubmix = {
|
||||
-- model = 'claude-3-7-sonnet-20250219',
|
||||
model = 'DeepSeek-V3',
|
||||
},
|
||||
openai = {
|
||||
endpoint = 'https://api.openai.com/v1',
|
||||
model = 'gpt-4o', -- your desired model (or use gpt-4o, etc.)
|
||||
timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models
|
||||
temperature = 0,
|
||||
max_completion_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models)
|
||||
--reasoning_effort = "medium", -- low|medium|high, only used for reasoning models
|
||||
},
|
||||
vendors = {
|
||||
aihubmix_llama_versatile = {
|
||||
__inherited_from = 'aihubmix',
|
||||
model = 'llama-3.3-70b-versatile',
|
||||
},
|
||||
},
|
||||
},
|
||||
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
|
||||
build = 'make',
|
||||
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'stevearc/dressing.nvim',
|
||||
'nvim-lua/plenary.nvim',
|
||||
'MunifTanjim/nui.nvim',
|
||||
--- The below dependencies are optional,
|
||||
'echasnovski/mini.pick', -- for file_selector provider mini.pick
|
||||
'nvim-telescope/telescope.nvim', -- for file_selector provider telescope
|
||||
'hrsh7th/nvim-cmp', -- autocompletion for avante commands and mentions
|
||||
'ibhagwan/fzf-lua', -- for file_selector provider fzf
|
||||
'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons
|
||||
'zbirenbaum/copilot.lua', -- for providers='copilot'
|
||||
{
|
||||
-- support for image pasting
|
||||
'HakonHarnes/img-clip.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
-- recommended settings
|
||||
default = {
|
||||
embed_image_as_base64 = false,
|
||||
prompt_for_file_name = false,
|
||||
drag_and_drop = {
|
||||
insert_mode = true,
|
||||
},
|
||||
-- required for Windows users
|
||||
use_absolute_path = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
-- Make sure to set this up properly if you have lazy=true
|
||||
'MeanderingProgrammer/render-markdown.nvim',
|
||||
opts = {
|
||||
file_types = { 'markdown', 'Avante' },
|
||||
},
|
||||
ft = { 'markdown', 'Avante' },
|
||||
},
|
||||
},
|
||||
}
|
||||
102
lua/plugins/blink.lua
Normal file
102
lua/plugins/blink.lua
Normal file
@@ -0,0 +1,102 @@
|
||||
-- Autocompletion
|
||||
return {
|
||||
'saghen/blink.cmp',
|
||||
event = 'VimEnter',
|
||||
version = '1.*',
|
||||
dependencies = {
|
||||
-- Compatibility for Avante with Blink (it typically only works with cmp)
|
||||
'Kaiser-Yang/blink-cmp-avante',
|
||||
-- Snippet Engine
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
version = '2.*',
|
||||
build = (function()
|
||||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
-- Remove the below condition to re-enable on windows.
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
{
|
||||
'rafamadriz/friendly-snippets',
|
||||
config = function()
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
'folke/lazydev.nvim',
|
||||
},
|
||||
--- @module 'blink.cmp'
|
||||
--- @type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
-- 'default' (recommended) for mappings similar to built-in completions
|
||||
-- <c-y> to accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
-- 'super-tab' for tab to accept
|
||||
-- 'enter' for enter to accept
|
||||
-- 'none' for no mappings
|
||||
--
|
||||
-- For an understanding of why the 'default' preset is recommended,
|
||||
-- you will need to read `:help ins-completion`
|
||||
--
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
||||
-- <c-space>: Open menu or open docs if already open
|
||||
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
|
||||
-- <c-e>: Hide menu
|
||||
-- <c-k>: Toggle signature help
|
||||
--
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
preset = 'default',
|
||||
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
},
|
||||
|
||||
appearance = {
|
||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- Adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = 'mono',
|
||||
},
|
||||
|
||||
completion = {
|
||||
-- By default, you may press `<c-space>` to show the documentation.
|
||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = { 'avante', 'lsp', 'path', 'snippets', 'lazydev' },
|
||||
providers = {
|
||||
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
|
||||
avante = { module = 'blink-cmp-avante', name = 'Avante', opts = {} },
|
||||
},
|
||||
},
|
||||
|
||||
snippets = { preset = 'luasnip' },
|
||||
|
||||
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
||||
-- which automatically downloads a prebuilt binary when enabled.
|
||||
--
|
||||
-- By default, we use the Lua implementation instead, but you may enable
|
||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
||||
--
|
||||
-- See :h blink-cmp-config-fuzzy for more information
|
||||
fuzzy = { implementation = 'lua' },
|
||||
|
||||
-- Shows a signature help window while you type arguments for a function
|
||||
signature = { enabled = true },
|
||||
},
|
||||
}
|
||||
22
lua/plugins/color.lua
Normal file
22
lua/plugins/color.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
-- You can easily change to a different colorscheme.
|
||||
return {
|
||||
-- Change the name of the colorscheme plugin below, and then
|
||||
-- change the command in the config to whatever the name of that colorscheme is.
|
||||
--
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
config = function()
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('tokyonight').setup {
|
||||
styles = {
|
||||
comments = { italic = false }, -- Disable italics in comments
|
||||
},
|
||||
}
|
||||
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
end,
|
||||
}
|
||||
40
lua/plugins/conform.lua
Normal file
40
lua/plugins/conform.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
return { -- Autoformat
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
else
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_format = 'fallback',
|
||||
}
|
||||
end
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
146
lua/plugins/debug.lua
Normal file
146
lua/plugins/debug.lua
Normal file
@@ -0,0 +1,146 @@
|
||||
-- debug.lua
|
||||
--
|
||||
-- Shows how to use the DAP plugin to debug your code.
|
||||
--
|
||||
-- Primarily focused on configuring the debugger for Go, but can
|
||||
-- be extended to other languages as well. That's why it's called
|
||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||
--
|
||||
return {
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = {
|
||||
-- Creates a beautiful debugger UI
|
||||
'rcarriga/nvim-dap-ui',
|
||||
|
||||
-- Required dependency for nvim-dap-ui
|
||||
'nvim-neotest/nvim-nio',
|
||||
|
||||
-- Installs the debug adapters for you
|
||||
'williamboman/mason.nvim',
|
||||
'jay-babu/mason-nvim-dap.nvim',
|
||||
|
||||
-- Add your own debuggers here
|
||||
'leoluz/nvim-dap-go',
|
||||
},
|
||||
keys = {
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
{
|
||||
'<F5>',
|
||||
function()
|
||||
require('dap').continue()
|
||||
end,
|
||||
desc = 'Debug: Start/Continue',
|
||||
},
|
||||
{
|
||||
'<F1>',
|
||||
function()
|
||||
require('dap').step_into()
|
||||
end,
|
||||
desc = 'Debug: Step Into',
|
||||
},
|
||||
{
|
||||
'<F2>',
|
||||
function()
|
||||
require('dap').step_over()
|
||||
end,
|
||||
desc = 'Debug: Step Over',
|
||||
},
|
||||
{
|
||||
'<F3>',
|
||||
function()
|
||||
require('dap').step_out()
|
||||
end,
|
||||
desc = 'Debug: Step Out',
|
||||
},
|
||||
{
|
||||
'<leader>b',
|
||||
function()
|
||||
require('dap').toggle_breakpoint()
|
||||
end,
|
||||
desc = 'Debug: Toggle Breakpoint',
|
||||
},
|
||||
{
|
||||
'<leader>B',
|
||||
function()
|
||||
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||
end,
|
||||
desc = 'Debug: Set Breakpoint',
|
||||
},
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
{
|
||||
'<F7>',
|
||||
function()
|
||||
require('dapui').toggle()
|
||||
end,
|
||||
desc = 'Debug: See last session result.',
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
|
||||
require('mason-nvim-dap').setup {
|
||||
-- Makes a best effort to setup the various debuggers with
|
||||
-- reasonable debug configurations
|
||||
automatic_installation = true,
|
||||
|
||||
-- You can provide additional configuration to the handlers,
|
||||
-- see mason-nvim-dap README for more information
|
||||
handlers = {},
|
||||
|
||||
-- You'll need to check that you have the required things installed
|
||||
-- online, please don't ask me how to install them :)
|
||||
ensure_installed = {
|
||||
-- Update this to ensure that you have the debuggers for the langs you want
|
||||
'delve',
|
||||
},
|
||||
}
|
||||
|
||||
-- Dap UI setup
|
||||
-- For more information, see |:help nvim-dap-ui|
|
||||
dapui.setup {
|
||||
-- Set icons to characters that are more likely to work in every terminal.
|
||||
-- Feel free to remove or use ones that you like more! :)
|
||||
-- Don't feel like these are good choices.
|
||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||
controls = {
|
||||
icons = {
|
||||
pause = '⏸',
|
||||
play = '▶',
|
||||
step_into = '⏎',
|
||||
step_over = '⏭',
|
||||
step_out = '⏮',
|
||||
step_back = 'b',
|
||||
run_last = '▶▶',
|
||||
terminate = '⏹',
|
||||
disconnect = '⏏',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Change breakpoint icons
|
||||
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
||||
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
|
||||
-- local breakpoint_icons = vim.g.have_nerd_font
|
||||
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
|
||||
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
|
||||
-- for type, icon in pairs(breakpoint_icons) do
|
||||
-- local tp = 'Dap' .. type
|
||||
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
|
||||
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
|
||||
-- end
|
||||
|
||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
|
||||
-- Install golang specific config
|
||||
require('dap-go').setup {
|
||||
delve = {
|
||||
-- On Windows delve must be run attached or it crashes.
|
||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||
detached = vim.fn.has 'win32' == 0,
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
37
lua/plugins/fugitive.lua
Normal file
37
lua/plugins/fugitive.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
return {
|
||||
'tpope/vim-fugitive',
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>gg', vim.cmd.Git)
|
||||
|
||||
local ThePrimeagen_Fugitive = vim.api.nvim_create_augroup('ThePrimeagen_Fugitive', {})
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd('BufWinEnter', {
|
||||
group = ThePrimeagen_Fugitive,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if vim.bo.ft ~= 'fugitive' then
|
||||
return
|
||||
end
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
vim.keymap.set('n', '<leader>gp', function()
|
||||
vim.cmd.Git 'push'
|
||||
end, opts)
|
||||
|
||||
-- rebase always
|
||||
vim.keymap.set('n', '<leader>gP', function()
|
||||
vim.cmd.Git { 'pull', '--rebase' }
|
||||
end, opts)
|
||||
|
||||
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
|
||||
-- needed if i did not set the branch up correctly
|
||||
vim.keymap.set('n', '<leader>gt', ':Git push -u origin ', opts)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<Leader>gu', '<cmd>diffget //2<CR>')
|
||||
vim.keymap.set('n', '<Leader>gh', '<cmd>diffget //3<CR>')
|
||||
end,
|
||||
}
|
||||
64
lua/plugins/gitsigns.lua
Normal file
64
lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
-- See `:help gitsigns`
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'git [s]tage hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'git [r]eset hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gitsigns.diffthis '@'
|
||||
end, { desc = 'git [D]iff against last commit' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
|
||||
end,
|
||||
},
|
||||
}
|
||||
8
lua/plugins/indent_blankline.lua
Normal file
8
lua/plugins/indent_blankline.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Add indentation guides even on blank lines
|
||||
return {
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help ibl`
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
}
|
||||
12
lua/plugins/lazydev.lua
Normal file
12
lua/plugins/lazydev.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
return {
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
opts = {
|
||||
library = {
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
58
lua/plugins/lint.lua
Normal file
58
lua/plugins/lint.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
-- Linting
|
||||
return {
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
markdown = { 'markdownlint' },
|
||||
}
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||
--
|
||||
-- However, note that this will enable a set of default linters,
|
||||
-- which will cause errors unless these tools are available:
|
||||
-- {
|
||||
-- clojure = { "clj-kondo" },
|
||||
-- dockerfile = { "hadolint" },
|
||||
-- inko = { "inko" },
|
||||
-- janet = { "janet" },
|
||||
-- json = { "jsonlint" },
|
||||
-- markdown = { "vale" },
|
||||
-- rst = { "vale" },
|
||||
-- ruby = { "ruby" },
|
||||
-- terraform = { "tflint" },
|
||||
-- text = { "vale" }
|
||||
-- }
|
||||
--
|
||||
-- You can disable the default linters by setting their filetypes to nil:
|
||||
-- lint.linters_by_ft['clojure'] = nil
|
||||
-- lint.linters_by_ft['dockerfile'] = nil
|
||||
-- lint.linters_by_ft['inko'] = nil
|
||||
-- lint.linters_by_ft['janet'] = nil
|
||||
-- lint.linters_by_ft['json'] = nil
|
||||
-- lint.linters_by_ft['markdown'] = nil
|
||||
-- lint.linters_by_ft['rst'] = nil
|
||||
-- lint.linters_by_ft['ruby'] = nil
|
||||
-- lint.linters_by_ft['terraform'] = nil
|
||||
-- lint.linters_by_ft['text'] = nil
|
||||
|
||||
-- Create autocommand which carries out the actual linting
|
||||
-- on the specified events.
|
||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
-- Only run the linter in buffers that you can modify in order to
|
||||
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
||||
-- describe the hovered symbol using Markdown.
|
||||
if vim.opt_local.modifiable:get() then
|
||||
lint.try_lint()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
261
lua/plugins/lsp.lua
Normal file
261
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,261 @@
|
||||
-- Main LSP Configuration
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||
-- Mason must be loaded before its dependents so we need to set it up here.
|
||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
||||
{ 'williamboman/mason.nvim', opts = {} },
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Allows extra capabilities provided by blink.cmp
|
||||
'saghen/blink.cmp',
|
||||
'folke/lazydev.nvim',
|
||||
},
|
||||
config = function()
|
||||
-- Brief aside: **What is LSP?**
|
||||
--
|
||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||
--
|
||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
||||
-- and language tooling communicate in a standardized fashion.
|
||||
--
|
||||
-- In general, you have a "server" which is some tool built to understand a particular
|
||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
||||
-- processes that communicate with some "client" - in this case, Neovim!
|
||||
--
|
||||
-- LSP provides Neovim with features like:
|
||||
-- - Go to definition
|
||||
-- - Find references
|
||||
-- - Autocompletion
|
||||
-- - Symbol Search
|
||||
-- - and more!
|
||||
--
|
||||
-- Thus, Language Servers are external tools that must be installed separately from
|
||||
-- Neovim. This is where `mason` and related plugins come into play.
|
||||
--
|
||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
||||
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
||||
|
||||
-- This function gets run when an LSP attaches to a particular buffer.
|
||||
-- That is to say, every time a new file is opened that is associated with
|
||||
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
||||
-- function will be executed to configure the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or 'n'
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
|
||||
|
||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
||||
---@param client vim.lsp.Client
|
||||
---@param method vim.lsp.protocol.Method
|
||||
---@param bufnr? integer some lsp support methods only in specific files
|
||||
---@return boolean
|
||||
local function client_supports_method(client, method, bufnr)
|
||||
if vim.fn.has 'nvim-0.11' == 1 then
|
||||
return client:supports_method(method, bufnr)
|
||||
else
|
||||
return client.supports_method(method, { bufnr = bufnr })
|
||||
end
|
||||
end
|
||||
|
||||
-- The following two autocommands are used to highlight references of the
|
||||
-- word under your cursor when your cursor rests there for a little while.
|
||||
-- See `:help CursorHold` for information about when this is executed
|
||||
--
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspDetach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- The following code creates a keymap to toggle inlay hints in your
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Diagnostic Config
|
||||
-- See :help vim.diagnostic.Opts
|
||||
vim.diagnostic.config {
|
||||
severity_sort = true,
|
||||
float = { border = 'rounded', source = 'if_many' },
|
||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
signs = vim.g.have_nerd_font and {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = ' ',
|
||||
[vim.diagnostic.severity.WARN] = ' ',
|
||||
[vim.diagnostic.severity.INFO] = ' ',
|
||||
[vim.diagnostic.severity.HINT] = ' ',
|
||||
},
|
||||
} or {},
|
||||
virtual_text = {
|
||||
source = 'if_many',
|
||||
spacing = 2,
|
||||
format = function(diagnostic)
|
||||
local diagnostic_message = {
|
||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||
}
|
||||
return diagnostic_message[diagnostic.severity]
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. Available keys are:
|
||||
-- - cmd (table): Override the default command used to start the server
|
||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
||||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||
-- ts_ls = {},
|
||||
--
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = { ... },
|
||||
-- filetypes = { ... },
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
--
|
||||
-- To check the current status of installed tools and/or manually install
|
||||
-- other tools, you can run
|
||||
-- :Mason
|
||||
--
|
||||
-- You can press `g?` for help in this menu.
|
||||
--
|
||||
-- `mason` had to be setup earlier: to configure its options see the
|
||||
-- `dependencies` table for `nvim-lspconfig` above.
|
||||
--
|
||||
-- You can add other tools here that you want Mason to install
|
||||
-- for you, so that they are available from within Neovim.
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua', -- Used to format Lua code
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
38
lua/plugins/mini.lua
Normal file
38
lua/plugins/mini.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
-- Collection of various small independent plugins/modules
|
||||
return {
|
||||
"echasnovski/mini.nvim",
|
||||
config = function()
|
||||
-- Better Around/Inside textobjects
|
||||
--
|
||||
-- Examples:
|
||||
-- - va) - [V]isually select [A]round [)]paren
|
||||
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
||||
-- - ci' - [C]hange [I]nside [']quote
|
||||
require("mini.ai").setup({ n_lines = 500 })
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
--
|
||||
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
||||
-- - sd' - [S]urround [D]elete [']quotes
|
||||
-- - sr)' - [S]urround [R]eplace [)] [']
|
||||
require("mini.surround").setup()
|
||||
|
||||
-- Simple and easy statusline.
|
||||
-- You could remove this setup call if you don't like it,
|
||||
-- and try some other statusline plugin
|
||||
local statusline = require("mini.statusline")
|
||||
-- set use_icons to true if you have a Nerd Font
|
||||
statusline.setup({ use_icons = vim.g.have_nerd_font })
|
||||
|
||||
-- You can configure sections in the statusline by overriding their
|
||||
-- default behavior. For example, here we set the section for
|
||||
-- cursor location to LINE:COLUMN
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return "%2l:%-2v"
|
||||
end
|
||||
|
||||
-- ... and there is more!
|
||||
-- Check out: https://github.com/echasnovski/mini.nvim
|
||||
end,
|
||||
}
|
||||
28
lua/plugins/neo-tree.lua
Normal file
28
lua/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
-- Neo-tree is a Neovim plugin to browse the file system
|
||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
|
||||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
},
|
||||
opts = {
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
['\\'] = 'close_window',
|
||||
},
|
||||
},
|
||||
filtered_items = {
|
||||
hide_dotfiles = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
105
lua/plugins/telescope.lua
Normal file
105
lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
-- See :help telescope
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
|
||||
-- `build` is used to run some command when the plugin is installed/updated.
|
||||
-- This is only run then, not every time Neovim starts up.
|
||||
build = "make",
|
||||
|
||||
-- `cond` is a condition used to determine whether this plugin should be
|
||||
-- installed and loaded.
|
||||
cond = function()
|
||||
return vim.fn.executable("make") == 1
|
||||
end,
|
||||
},
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
|
||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||
-- it can fuzzy find! It's more than just a "file finder", it can search
|
||||
-- many different aspects of Neovim, your workspace, LSP, and more!
|
||||
--
|
||||
-- The easiest way to use Telescope, is to start by doing something like:
|
||||
-- :Telescope help_tags
|
||||
--
|
||||
-- After running this command, a window will open up and you're able to
|
||||
-- type in the prompt window. You'll see a list of `help_tags` options and
|
||||
-- a corresponding preview of the help.
|
||||
--
|
||||
-- Two important keymaps to use while in Telescope are:
|
||||
-- - Insert mode: <c-/>
|
||||
-- - Normal mode: ?
|
||||
--
|
||||
-- This opens a window that shows you all of the keymaps for the current
|
||||
-- Telescope picker. This is really useful to discover what Telescope can
|
||||
-- do as well as how to actually do it!
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require("telescope").setup({
|
||||
-- You can put your default mappings / updates / etc. in here
|
||||
-- All the info you're looking for is in `:help telescope.setup()`
|
||||
--
|
||||
-- defaults = {
|
||||
-- mappings = {
|
||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
||||
-- },
|
||||
-- },
|
||||
-- pickers = {}
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable Telescope extensions if they are installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
|
||||
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
|
||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
|
||||
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set("n", "<leader>s/", function()
|
||||
builtin.live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end, { desc = "[S]earch [/] in Open Files" })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set("n", "<leader>sn", function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end, { desc = "[S]earch [N]eovim files" })
|
||||
end,
|
||||
}
|
||||
7
lua/plugins/todo-comments.lua
Normal file
7
lua/plugins/todo-comments.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Highlight todo, notes, etc in comments
|
||||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = { signs = false },
|
||||
}
|
||||
38
lua/plugins/treesitter.lua
Normal file
38
lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
-- Highlight, edit, and navigate code
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'diff',
|
||||
'html',
|
||||
'lua',
|
||||
'luadoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'query',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
},
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
||||
-- If you are experiencing weird indenting issues, add the language to
|
||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
},
|
||||
-- There are additional nvim-treesitter modules that you can use to interact
|
||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||
--
|
||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||
}
|
||||
54
lua/plugins/which-key.lua
Normal file
54
lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
-- See :help which-key
|
||||
return {
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||
opts = {
|
||||
-- delay between pressing a key and opening which-key (milliseconds)
|
||||
-- this setting is independent of vim.opt.timeoutlen
|
||||
delay = 0,
|
||||
icons = {
|
||||
-- set icon mappings to true if you have a Nerd Font
|
||||
mappings = vim.g.have_nerd_font,
|
||||
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
||||
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
|
||||
keys = vim.g.have_nerd_font and {} or {
|
||||
Up = '<Up> ',
|
||||
Down = '<Down> ',
|
||||
Left = '<Left> ',
|
||||
Right = '<Right> ',
|
||||
C = '<C-…> ',
|
||||
M = '<M-…> ',
|
||||
D = '<D-…> ',
|
||||
S = '<S-…> ',
|
||||
CR = '<CR> ',
|
||||
Esc = '<Esc> ',
|
||||
ScrollWheelDown = '<ScrollWheelDown> ',
|
||||
ScrollWheelUp = '<ScrollWheelUp> ',
|
||||
NL = '<NL> ',
|
||||
BS = '<BS> ',
|
||||
Space = '<Space> ',
|
||||
Tab = '<Tab> ',
|
||||
F1 = '<F1>',
|
||||
F2 = '<F2>',
|
||||
F3 = '<F3>',
|
||||
F4 = '<F4>',
|
||||
F5 = '<F5>',
|
||||
F6 = '<F6>',
|
||||
F7 = '<F7>',
|
||||
F8 = '<F8>',
|
||||
F9 = '<F9>',
|
||||
F10 = '<F10>',
|
||||
F11 = '<F11>',
|
||||
F12 = '<F12>',
|
||||
},
|
||||
},
|
||||
|
||||
-- Document existing key chains
|
||||
spec = {
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
" commentary.vim - Comment stuff out
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 1.3
|
||||
" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim
|
||||
|
||||
if exists("g:loaded_commentary") || v:version < 700
|
||||
finish
|
||||
endif
|
||||
let g:loaded_commentary = 1
|
||||
|
||||
function! s:surroundings() abort
|
||||
if &filetype =~ 'vue\|html\|svelte'
|
||||
if searchpair('<\(script\|style\)', '', '</\(script\|style\)>', 'Wn')
|
||||
let b:commentary_format="// %s"
|
||||
else
|
||||
let b:commentary_format=&commentstring
|
||||
endif
|
||||
endif
|
||||
return split(get(b:, 'commentary_format', substitute(substitute(substitute(
|
||||
\ &commentstring, '^$', '%s', ''), '\S\zs%s',' %s', '') ,'%s\ze\S', '%s ', '')), '%s', 1)
|
||||
endfunction
|
||||
|
||||
function! s:strip_white_space(l,r,line) abort
|
||||
let [l, r] = [a:l, a:r]
|
||||
if l[-1:] ==# ' ' && stridx(a:line,l) == -1 && stridx(a:line,l[0:-2]) == 0
|
||||
let l = l[:-2]
|
||||
endif
|
||||
if r[0] ==# ' ' && a:line[-strlen(r):] != r && a:line[1-strlen(r):] == r[1:]
|
||||
let r = r[1:]
|
||||
endif
|
||||
return [l, r]
|
||||
endfunction
|
||||
|
||||
function! s:go(...) abort
|
||||
if !a:0
|
||||
let &operatorfunc = matchstr(expand('<sfile>'), '[^. ]*$')
|
||||
return 'g@'
|
||||
elseif a:0 > 1
|
||||
let [lnum1, lnum2] = [a:1, a:2]
|
||||
else
|
||||
let [lnum1, lnum2] = [line("'["), line("']")]
|
||||
endif
|
||||
|
||||
let [l, r] = s:surroundings()
|
||||
let uncomment = 2
|
||||
let force_uncomment = a:0 > 2 && a:3
|
||||
for lnum in range(lnum1,lnum2)
|
||||
let line = matchstr(getline(lnum),'\S.*\s\@<!')
|
||||
let [l, r] = s:strip_white_space(l,r,line)
|
||||
if len(line) && (stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r)
|
||||
let uncomment = 0
|
||||
endif
|
||||
endfor
|
||||
|
||||
if get(b:, 'commentary_startofline')
|
||||
let indent = '^'
|
||||
else
|
||||
let indent = '^\s*'
|
||||
endif
|
||||
|
||||
let lines = []
|
||||
for lnum in range(lnum1,lnum2)
|
||||
let line = getline(lnum)
|
||||
if strlen(r) > 2 && l.r !~# '\\'
|
||||
let line = substitute(line,
|
||||
\'\M' . substitute(l, '\ze\S\s*$', '\\zs\\d\\*\\ze', '') . '\|' . substitute(r, '\S\zs', '\\zs\\d\\*\\ze', ''),
|
||||
\'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g')
|
||||
endif
|
||||
if force_uncomment
|
||||
if line =~ '^\s*' . l
|
||||
let line = substitute(line,'\S.*\s\@<!','\=submatch(0)[strlen(l):-strlen(r)-1]','')
|
||||
endif
|
||||
elseif uncomment
|
||||
let line = substitute(line,'\S.*\s\@<!','\=submatch(0)[strlen(l):-strlen(r)-1]','')
|
||||
else
|
||||
let line = substitute(line,'^\%('.matchstr(getline(lnum1),indent).'\|\s*\)\zs.*\S\@<=','\=l.submatch(0).r','')
|
||||
endif
|
||||
call add(lines, line)
|
||||
endfor
|
||||
call setline(lnum1, lines)
|
||||
let modelines = &modelines
|
||||
try
|
||||
set modelines=0
|
||||
silent doautocmd User CommentaryPost
|
||||
finally
|
||||
let &modelines = modelines
|
||||
endtry
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:textobject(inner) abort
|
||||
let [l, r] = s:surroundings()
|
||||
let lnums = [line('.')+1, line('.')-2]
|
||||
for [index, dir, bound, line] in [[0, -1, 1, ''], [1, 1, line('$'), '']]
|
||||
while lnums[index] != bound && line ==# '' || !(stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r)
|
||||
let lnums[index] += dir
|
||||
let line = matchstr(getline(lnums[index]+dir),'\S.*\s\@<!')
|
||||
let [l, r] = s:strip_white_space(l,r,line)
|
||||
endwhile
|
||||
endfor
|
||||
while (a:inner || lnums[1] != line('$')) && empty(getline(lnums[0]))
|
||||
let lnums[0] += 1
|
||||
endwhile
|
||||
while a:inner && empty(getline(lnums[1]))
|
||||
let lnums[1] -= 1
|
||||
endwhile
|
||||
if lnums[0] <= lnums[1]
|
||||
execute 'normal! 'lnums[0].'GV'.lnums[1].'G'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
command! -range -bar -bang Commentary call s:go(<line1>,<line2>,<bang>0)
|
||||
xnoremap <expr> <Plug>Commentary <SID>go()
|
||||
nnoremap <expr> <Plug>Commentary <SID>go()
|
||||
nnoremap <expr> <Plug>CommentaryLine <SID>go() . '_'
|
||||
onoremap <silent> <Plug>Commentary :<C-U>call <SID>textobject(get(v:, 'operator', '') ==# 'c')<CR>
|
||||
nnoremap <silent> <Plug>ChangeCommentary c:<C-U>call <SID>textobject(1)<CR>
|
||||
nmap <silent> <Plug>CommentaryUndo :echoerr "Change your <Plug>CommentaryUndo map to <Plug>Commentary<Plug>Commentary"<CR>
|
||||
|
||||
if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
|
||||
xmap gc <Plug>Commentary
|
||||
nmap gc <Plug>Commentary
|
||||
omap gc <Plug>Commentary
|
||||
nmap gcc <Plug>CommentaryLine
|
||||
if maparg('c','n') ==# '' && !exists('v:operator')
|
||||
nmap cgc <Plug>ChangeCommentary
|
||||
endif
|
||||
nmap gcu <Plug>Commentary<Plug>Commentary
|
||||
endif
|
||||
|
||||
" vim:set et sw=2:
|
||||
Reference in New Issue
Block a user