├── .gitignore
├── .mind
└── state.json
├── README.md
├── autoload
└── floaterm
│ └── wrapper
│ ├── broot.hjson
│ ├── broot.vim
│ ├── fzf.vim
│ ├── lf.vim
│ └── rg.vim
├── dashboard.png
├── init.lua
├── lazy-lock.json
├── lua
├── config
│ ├── ai
│ │ ├── init.lua
│ │ └── supermaven.lua
│ ├── comment
│ │ ├── comment.lua
│ │ ├── init.lua
│ │ └── todo.lua
│ ├── event.lua
│ ├── eyecandy
│ │ ├── context.lua
│ │ ├── dressing.lua
│ │ ├── hlargs.lua
│ │ ├── init.lua
│ │ ├── noicey.lua
│ │ ├── notify.lua
│ │ ├── symbol.lua
│ │ └── windows.lua
│ ├── git
│ │ └── init.lua
│ ├── init.lua
│ ├── languages
│ │ ├── flutter.lua
│ │ ├── go.lua
│ │ ├── init.lua
│ │ ├── markdown.lua
│ │ ├── rest.lua
│ │ ├── rust.lua
│ │ ├── tsc.lua
│ │ └── typescript.lua
│ ├── lsp
│ │ ├── format.lua
│ │ ├── init.lua
│ │ ├── inlay.lua
│ │ ├── lspconfig.lua
│ │ ├── lspsaga.lua
│ │ ├── mason.lua
│ │ ├── servers.lua
│ │ └── zero.lua
│ ├── motion
│ │ ├── demicolon.lua
│ │ ├── eyeliner.lua
│ │ ├── flash.lua
│ │ ├── init.lua
│ │ ├── surround.lua
│ │ └── tshjkl.lua
│ ├── navigation
│ │ ├── antelope.lua
│ │ ├── before.lua
│ │ ├── init.lua
│ │ ├── navigator.lua
│ │ ├── oil.lua
│ │ ├── tfm.lua
│ │ └── which-key.lua
│ ├── quickfix
│ │ ├── bqf.lua
│ │ ├── diaglist.lua
│ │ └── init.lua
│ ├── text-objects
│ │ ├── archer_text_objects.lua
│ │ ├── comment_text_objects.lua
│ │ ├── init.lua
│ │ ├── treesitter_text_objects.lua
│ │ └── various_text_objects.lua
│ ├── treesitter
│ │ ├── autopair.lua
│ │ ├── autotag.lua
│ │ ├── context.lua
│ │ ├── illuminate.lua
│ │ ├── init.lua
│ │ └── treesitter.lua
│ ├── util.lua
│ └── utils
│ │ ├── animate.lua
│ │ ├── barline.lua
│ │ ├── bookmarks.lua
│ │ ├── bracketed.lua
│ │ ├── caps.lua
│ │ ├── cmp.lua
│ │ ├── comment.lua
│ │ ├── dial.lua
│ │ ├── fold.lua
│ │ ├── hipatterns.lua
│ │ ├── icons.lua
│ │ ├── indentscope.lua
│ │ ├── init.lua
│ │ ├── lualine.lua
│ │ ├── move.lua
│ │ ├── multi.lua
│ │ ├── muren.lua
│ │ ├── persistence.lua
│ │ ├── rip.lua
│ │ ├── satellite.lua
│ │ └── theme.lua
├── core
│ ├── autocmds.lua
│ ├── colors.lua
│ ├── icons.lua
│ ├── keymaps.lua
│ ├── lazy.lua
│ ├── options.lua
│ └── settings.lua
└── plugins
│ ├── ai.lua
│ ├── comment.lua
│ ├── config.lua
│ ├── eyecandy.lua
│ ├── git.lua
│ ├── languages.lua
│ ├── lsp.lua
│ ├── mini.lua
│ ├── motion.lua
│ ├── navigation.lua
│ ├── quickfix.lua
│ ├── text-objects.lua
│ ├── treesitter.lua
│ └── utils.lua
└── stylua.toml
/.gitignore:
--------------------------------------------------------------------------------
1 | lua-language-server
2 | plugin
3 | swap-pane
4 | LuaFormatter
5 |
6 | node_modules
7 | package-lock.json
8 | package.json
9 | sessions
10 | lua/config-old
11 | lua/core-old
12 | lua/options-old
13 | lua/plugin-old
14 | .vim-bookmarks
15 | .supermaven/config.json
16 |
--------------------------------------------------------------------------------
/.mind/state.json:
--------------------------------------------------------------------------------
1 | {"contents":[{"text":"nvim"}],"type":1,"icon":" ","uid":"20240214101102","is_expanded":false}
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Neovim configuration
2 |
3 |
4 |
5 |
6 |
7 | # My Neovim Config [](https://github.com/sindresorhus/awesome)
8 |
9 | ## 📦 Package manager
10 |
11 | - [lazy.nvim](https://github.com/folke/lazy.nvim)
12 |
13 |
--------------------------------------------------------------------------------
/autoload/floaterm/wrapper/broot.hjson:
--------------------------------------------------------------------------------
1 | {
2 | verbs: [
3 | {
4 | invocation: terminal
5 | key: ctrl-l
6 | execution: "echo {line} {file}"
7 | leave_broot: true
8 | apply_to: file
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/autoload/floaterm/wrapper/broot.vim:
--------------------------------------------------------------------------------
1 | " vim:sw=2:
2 | " ============================================================================
3 | " FileName: broot.vim
4 | " Author: voldikss
5 | " GitHub: https://github.com/voldikss
6 | " ============================================================================
7 |
8 | let s:broot_default_confpath = fnamemodify('~/.config/broot/conf.hjson', ':p')
9 | let s:broot_wrapper_confpath = fnamemodify(expand(''), ':h') . '/broot.hjson'
10 | let s:broot_confpath = s:broot_wrapper_confpath . ';' . s:broot_default_confpath
11 |
12 | let s:broot_wrapper_config = [
13 | \ '{',
14 | \ ' verbs: [',
15 | \ ' {',
16 | \ ' invocation: terminal',
17 | \ ' key: ctrl-l',
18 | \ ' execution: "echo {line} {file}"',
19 | \ ' leave_broot: true',
20 | \ ' apply_to: file',
21 | \ ' }',
22 | \ ' ]',
23 | \ '}',
24 | \ ]
25 | call writefile(s:broot_wrapper_config, s:broot_wrapper_confpath)
26 |
27 | function! floaterm#wrapper#broot#(cmd, jobopts, config) abort
28 | let s:broot_tmpfile = tempname()
29 | let original_dir = getcwd()
30 | lcd %:p:h
31 |
32 | let cmdlist = split(a:cmd)
33 | let cmd = printf(
34 | \ '%s --conf "%s" > "%s"',
35 | \ a:cmd,
36 | \ s:broot_confpath,
37 | \ s:broot_tmpfile
38 | \ )
39 |
40 | exe "lcd " . original_dir
41 | let cmd = [&shell, &shellcmdflag, cmd]
42 | let jobopts = {'on_exit': funcref('s:broot_callback')}
43 | call floaterm#util#deep_extend(a:jobopts, jobopts)
44 | return [v:false, cmd]
45 | endfunction
46 |
47 | function! s:broot_callback(job, data, event, opener) abort
48 | if filereadable(s:broot_tmpfile)
49 | let filenames = readfile(s:broot_tmpfile)
50 | if !empty(filenames)
51 | if has('nvim')
52 | call floaterm#window#hide(bufnr('%'))
53 | endif
54 | let locations = []
55 | for filename in filenames
56 | let lnum_file = split(filename)
57 | let dict = {
58 | \ 'filename': fnamemodify(lnum_file[1], ':p'),
59 | \ 'lnum': lnum_file[0],
60 | \ }
61 | call add(locations, dict)
62 | endfor
63 | call floaterm#util#open(locations, a:opener)
64 | endif
65 | endif
66 | endfunction
67 |
--------------------------------------------------------------------------------
/autoload/floaterm/wrapper/fzf.vim:
--------------------------------------------------------------------------------
1 | " vim:sw=2:
2 | " ============================================================================
3 | " FileName: fzf.vim
4 | " Author: voldikss
5 | " GitHub: https://github.com/voldikss
6 | " ============================================================================
7 |
8 | function! floaterm#wrapper#fzf#(cmd, jobopts, config) abort
9 | let s:fzf_tmpfile = tempname()
10 | let cmd = a:cmd
11 | if cmd !~ '--preview'
12 | if executable('bat')
13 | let cmd .= ' --preview ' . shellescape('( [[ -f {} ]] && (bat --style=plain --color=always --theme=TwoDark --pager=never {} || cat {})) || ([[ -d {} ]] && (eza --icons -T --color=always --group-directories-first {} || tree -C {})) || echo {} 2> /dev/null | head -200')
14 | else
15 | let cmd .= ' --preview ' . shellescape('cat -n {}')
16 | endif
17 | endif
18 | let cmd .= ' > ' . s:fzf_tmpfile
19 | let cmd = [&shell, &shellcmdflag, cmd]
20 | let jobopts = {'on_exit': funcref('s:fzf_callback')}
21 | call floaterm#util#deep_extend(a:jobopts, jobopts)
22 | return [v:false, cmd]
23 | endfunction
24 |
25 | function! s:fzf_callback(job, data, event, opener) abort
26 | if filereadable(s:fzf_tmpfile)
27 | let filenames = readfile(s:fzf_tmpfile)
28 | if !empty(filenames)
29 | if has('$EDITOR')
30 | call floaterm#window#hide(bufnr('%'))
31 | endif
32 | let locations = []
33 | for filename in filenames
34 | let dict = {'filename': fnamemodify(filename, ':p')}
35 | call add(locations, dict)
36 | endfor
37 | call floaterm#util#open(locations, a:opener)
38 | endif
39 | endif
40 | endfunction
41 |
--------------------------------------------------------------------------------
/autoload/floaterm/wrapper/lf.vim:
--------------------------------------------------------------------------------
1 | " vim:sw=2:
2 | " ============================================================================
3 | " FileName: lf.vim
4 | " Author: benwoodward
5 | " GitHub: https://github.com/benwoodward
6 | " ============================================================================
7 |
8 | function! floaterm#wrapper#lf#(cmd, jobopts, config) abort
9 | let s:lf_tmpfile = tempname()
10 | let original_dir = getcwd()
11 | lcd %:p:h
12 |
13 | let cmdlist = split(a:cmd)
14 | let cmd = 'lf -selection-path="' . s:lf_tmpfile . '"'
15 | if len(cmdlist) > 1
16 | let cmd .= ' ' . join(cmdlist[1:], ' ')
17 | else
18 | if !has_key(a:config, 'cwd')
19 | if glob('%') != ''
20 | let cmd .= ' "' . expand('%:p') . '"'
21 | else
22 | let cmd .= ' "' . getcwd() . '"'
23 | endif
24 | endif
25 | endif
26 |
27 | exe "lcd " . original_dir
28 | let cmd = [&shell, &shellcmdflag, cmd]
29 | let jobopts = {'on_exit': funcref('s:lf_callback')}
30 | call floaterm#util#deep_extend(a:jobopts, jobopts)
31 | return [v:false, cmd]
32 | endfunction
33 |
34 | function! s:lf_callback(job, data, event, opener) abort
35 | if filereadable(s:lf_tmpfile)
36 | let filenames = readfile(s:lf_tmpfile)
37 | if !empty(filenames)
38 | if has('nvim')
39 | call floaterm#window#hide(bufnr('%'))
40 | endif
41 | let locations = []
42 | for filename in filenames
43 | let dict = {'filename': fnamemodify(filename, ':p')}
44 | call add(locations, dict)
45 | endfor
46 | call floaterm#util#open(locations, a:opener)
47 | endif
48 | endif
49 | endfunction
50 |
--------------------------------------------------------------------------------
/autoload/floaterm/wrapper/rg.vim:
--------------------------------------------------------------------------------
1 | " vim:sw=2:
2 | " ============================================================================
3 | " FileName: rg.vim
4 | " Author: voldikss
5 | " GitHub: https://github.com/voldikss
6 | " ============================================================================
7 |
8 | if executable('bat')
9 | let s:viewer = 'bat --style=plain --theme=TwoDark --pager=never --color=always {1} --highlight-line {2}'
10 | elseif executable('batcat')
11 | let s:viewer = 'batcat --style=numbers --color=always --highlight-line {2}'
12 | else
13 | let s:viewer = 'cat -n'
14 | endif
15 |
16 | function! floaterm#wrapper#rg#(cmd, jobopts, config) abort
17 | let FZF_DEFAULT_COMMAND = join([
18 | \ "rg .",
19 | \ "--column",
20 | \ "--line-number",
21 | \ "--no-heading",
22 | \ "--color=always",
23 | \ "--smart-case",
24 | \ join(split(a:cmd)[1:])
25 | \ ])
26 |
27 | let s:rg_tmpfile = tempname()
28 | let prog = 'fzf'
29 | let arglist = [
30 | \ '--ansi',
31 | \ '--multi',
32 | \ '--no-height',
33 | \ '--delimiter :',
34 | \ '--bind ctrl-/:toggle-preview' ,
35 | \ '--bind alt-a:select-all,alt-d:deselect-all',
36 | \ printf('--preview "%s {1}"', s:viewer)
37 | \ ]
38 | let cmd = printf('%s %s > %s', prog, join(arglist), s:rg_tmpfile)
39 | let cmd = [&shell, &shellcmdflag, cmd]
40 | let jobopts = {
41 | \ 'on_exit': funcref('s:rg_callback'),
42 | \ 'env': {'FZF_DEFAULT_COMMAND': FZF_DEFAULT_COMMAND}
43 | \ }
44 | call floaterm#util#deep_extend(a:jobopts, jobopts)
45 | return [v:false, cmd]
46 | endfunction
47 |
48 | function! s:rg_callback(job, data, event, opener) abort
49 | if filereadable(s:rg_tmpfile)
50 | let filenames = readfile(s:rg_tmpfile)
51 | if !empty(filenames)
52 | if has('nvim')
53 | call floaterm#window#hide(bufnr('%'))
54 | endif
55 | let locations = []
56 | for filename in filenames
57 | let parts = matchlist(filename, '\(.\{-}\)\s*:\s*\(\d\+\)\%(\s*:\s*\(\d\+\)\)\?\%(\s*:\(.*\)\)\?')
58 | let dict = {
59 | \ 'filename': fnamemodify(parts[1], ':p'),
60 | \ 'lnum': parts[2],
61 | \ 'text': parts[4]
62 | \ }
63 | call add(locations, dict)
64 | endfor
65 | call floaterm#util#open(locations, a:opener)
66 | endif
67 | endif
68 | endfunction
69 |
--------------------------------------------------------------------------------
/dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Pheon-Dev/nvim/756423ac0f07ff44b7579afe0d153b9815d25e01/dashboard.png
--------------------------------------------------------------------------------
/init.lua:
--------------------------------------------------------------------------------
1 | vim.loader.enable()
2 |
3 | require("core.lazy")
4 |
--------------------------------------------------------------------------------
/lazy-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
3 | "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
4 | "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
5 | "animation.nvim": { "branch": "main", "commit": "fb77091ab72ec9971aee0562e7081182527aaa6a" },
6 | "antelope": { "branch": "main", "commit": "3e73948cb13dff202141615b1e3e908767f97a5b" },
7 | "bars-N-lines.nvim": { "branch": "main", "commit": "8c87b17c19e970e95fec19b560d70b62a34c7b96" },
8 | "before.nvim": { "branch": "master", "commit": "187bafe2792a82d53cdb632971e4113cd703ac53" },
9 | "bufferlist.nvim": { "branch": "master", "commit": "47b5fe71399ecdead789465c94f655c442324d74" },
10 | "caps-word.nvim": { "branch": "main", "commit": "564548ef557e4f873b2e67f0ea91f25042cedfe8" },
11 | "catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" },
12 | "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
13 | "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
14 | "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
15 | "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
16 | "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
17 | "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
18 | "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" },
19 | "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
20 | "conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" },
21 | "crates.nvim": { "branch": "main", "commit": "bd35b13e94a292ee6e32c351e05ca2202dc9f070" },
22 | "demicolon.nvim": { "branch": "main", "commit": "ef47d03e863d4a02c97bb16ce60b9624edb76d26" },
23 | "diaglist.nvim": { "branch": "master", "commit": "afc124a0976d56db43cc840e62757193ccab7856" },
24 | "dial.nvim": { "branch": "master", "commit": "46b4375e84e8eb771129bff6b2b1e47746601ef9" },
25 | "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
26 | "eyeliner.nvim": { "branch": "main", "commit": "8f197eb30cecdf4c2cc9988a5eecc6bc34c0c7d6" },
27 | "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
28 | "flutter-tools.nvim": { "branch": "main", "commit": "ae8954dcb70e84f00f7df30dc917bfa2d8c9bd2c" },
29 | "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
30 | "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
31 | "helpview.nvim": { "branch": "main", "commit": "857aec1dab331252910da158ab6cbfbc65239c71" },
32 | "hlargs.nvim": { "branch": "main", "commit": "a5a7fdacc0ac2f7ca9d241e0e059cb85f0e733bc" },
33 | "inlay-hint.nvim": { "branch": "main", "commit": "eb5f0579537db271dfedd7f38460cdacb238176f" },
34 | "karen-yank.nvim": { "branch": "main", "commit": "817f50c9464ce557c8f7f8f4d4c8d2f7b81fc40c" },
35 | "kulala.nvim": { "branch": "main", "commit": "2cdc64d6c494af3bbee2be44218cc105ad43e8f9" },
36 | "lazy.nvim": { "branch": "main", "commit": "72aa3a2624be5dc240646084f7b6a38eb99eb2ce" },
37 | "lsp-zero.nvim": { "branch": "v3.x", "commit": "ab2a3413646fedd77aa0eab4214a6473e62f6a64" },
38 | "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
39 | "lspsaga.nvim": { "branch": "main", "commit": "5fce15331ac6c3a3ec3ac91ab0e85ed82f5cbba0" },
40 | "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
41 | "markview.nvim": { "branch": "main", "commit": "72cd34279e94ee96ee33bdf30a87b00e6d45319d" },
42 | "mason-lspconfig.nvim": { "branch": "main", "commit": "97d9f1d3ad205dece6bcafd1d71cf1507608f3c7" },
43 | "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
44 | "middleclass": { "branch": "master", "commit": "9fab4d5bca67262614960960ca35c4740eb2be2c" },
45 | "mini.animate": { "branch": "main", "commit": "d14190ac3040116540889e2ebc25f488b195799e" },
46 | "mini.bracketed": { "branch": "main", "commit": "1d1c774b5dcc9a55af3bfbd977571c31c4054223" },
47 | "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" },
48 | "mini.hipatterns": { "branch": "main", "commit": "f34975103a38b3f608219a1324cdfc58ea660b8b" },
49 | "mini.icons": { "branch": "main", "commit": "1c79feb7478ca773fa3dac5cadf43ced9180e861" },
50 | "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" },
51 | "mini.move": { "branch": "main", "commit": "4caa1c212f5ca3d1633d21cfb184808090ed74b1" },
52 | "mini.splitjoin": { "branch": "main", "commit": "3e92f6764e770ba392325cad3a4497adcada695f" },
53 | "multicursor.nvim": { "branch": "main", "commit": "f454cac9d03ccaf20008f4793f05b159f5547e78" },
54 | "muren.nvim": { "branch": "main", "commit": "818c09097dba1322b2ca099e35f7471feccfef93" },
55 | "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
56 | "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
57 | "nvim-bqf": { "branch": "main", "commit": "ebb6d2689e4427452180f17c53f29f7e460236f1" },
58 | "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" },
59 | "nvim-lspconfig": { "branch": "master", "commit": "87cdeb16895d64b306bfe9f440840ff55c2a76c0" },
60 | "nvim-notify": { "branch": "master", "commit": "bd9cd51f9ef2f6326fc2bc9931d0718c1794e247" },
61 | "nvim-rip-substitute": { "branch": "main", "commit": "f9eb81508e13c3dc7fce107829d9528c2d3cc053" },
62 | "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" },
63 | "nvim-treesitter": { "branch": "master", "commit": "556ac68cd33973a38d3f2abac47f361432593fe2" },
64 | "nvim-treesitter-context": { "branch": "master", "commit": "2bcf700b59bc92850ca83a1c02e86ba832e0fae0" },
65 | "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
66 | "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" },
67 | "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
68 | "nvim-ufo": { "branch": "main", "commit": "32cb247b893a384f1888b9cd737264159ecf183c" },
69 | "nvim-various-textobjs": { "branch": "main", "commit": "b43a13448c3c3a4fca027595f7b6fc3522758e00" },
70 | "nvim_context_vt": { "branch": "master", "commit": "10e13ec47a9bb341192d893e58cf91c61cde4935" },
71 | "oil-vcs-status": { "branch": "main", "commit": "729f65d5ac6f115df0b54ffd24a4f3f0e8834a47" },
72 | "oil.nvim": { "branch": "master", "commit": "c12fad2d225d8f81fadd48521d253607fe25465c" },
73 | "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" },
74 | "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
75 | "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
76 | "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
77 | "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
78 | "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
79 | "satellite.nvim": { "branch": "main", "commit": "bce591cb5e379bd989623993c604c774633e7ed9" },
80 | "sentiment.nvim": { "branch": "main", "commit": "ecde8d877881bb78fdb90060c0991e76770dbdbc" },
81 | "substitute.nvim": { "branch": "main", "commit": "97f49d16f8eea7967d41db4f657dd63af53eeba1" },
82 | "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
83 | "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" },
84 | "symbol-usage.nvim": { "branch": "main", "commit": "0f9b3da014b7e41559b643e7461fcabb2a7dc83a" },
85 | "targets.vim": { "branch": "master", "commit": "6325416da8f89992b005db3e4517aaef0242602e" },
86 | "tfm.nvim": { "branch": "main", "commit": "fb0de2c96bf303216ac5d91ce9bdb7f430030f8b" },
87 | "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
88 | "ts-comments.nvim": { "branch": "main", "commit": "872dcfa0418f4a33b7437fb4d9f4e89f2f000d74" },
89 | "tsc.nvim": { "branch": "main", "commit": "59abb6f3f24a3ca80708f694af4e2b727a1a3211" },
90 | "tshjkl.nvim": { "branch": "main", "commit": "3fe81ab2c15f014a78b752062238d6c110a08fc8" },
91 | "typescript-tools.nvim": { "branch": "master", "commit": "35e397ce467bedbbbb5bfcd0aa79727b59a08d4a" },
92 | "ultimate-autopair.nvim": { "branch": "v0.6", "commit": "9e3209190c22953566ae4e6436ad2b4ff4dabb95" },
93 | "vim-bookmarks": { "branch": "master", "commit": "9cc5fa7ecc23b052bd524d07c85356c64b92aeef" },
94 | "vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" },
95 | "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
96 | "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" },
97 | "vim-textobj-comment": { "branch": "master", "commit": "58ae4571b76a5bf74850698f23d235eef991dd4b" },
98 | "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" },
99 | "vim-wordmotion": { "branch": "master", "commit": "81d9bd298376ab0dc465c85d55afa4cb8d5f47a1" },
100 | "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" },
101 | "windows.nvim": { "branch": "main", "commit": "c7492552b23d0ab30325e90b56066ec51242adc8" }
102 | }
103 |
--------------------------------------------------------------------------------
/lua/config/ai/init.lua:
--------------------------------------------------------------------------------
1 | local config = require("config.ai")
2 |
3 | local M = {}
4 |
5 | M.supermaven = config.supermaven
6 |
7 | return M
8 |
--------------------------------------------------------------------------------
/lua/config/ai/supermaven.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function(_)
4 | --[[ require("supermaven-nvim").setup(M.opts)
5 |
6 | -- PENDING https://github.com/supermaven-inc/supermaven-nvim/issues/49
7 | require("supermaven-nvim.completion_preview").suggestion_group = "NonText" ]]
8 | require("supermaven-nvim").setup({
9 | keymaps = {
10 | accept_suggestion = "",
11 | accept_word = "",
12 | clear_suggestion = "",
13 | },
14 | ignore_filetypes = { cpp = true },
15 | --[[ color = {
16 | suggestion_color = "#ffffff",
17 | cterm = 244,
18 | }, ]]
19 | log_level = "info", -- set to "off" to disable logging completely
20 | disable_inline_completion = false, -- disables inline completion for use with cmp
21 | disable_keymaps = false, -- disables built in keymaps for more manual control
22 | })
23 | -- vim.cmd(":SupermavenUseFree")
24 |
25 | vim.api.nvim_create_autocmd("RecordingEnter", { command = "SupermavenStop" })
26 | vim.api.nvim_create_autocmd("RecordingLeave", { command = "SupermavenStart" })
27 | end
28 |
29 | return M
30 |
--------------------------------------------------------------------------------
/lua/config/comment/comment.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {
4 | "JoosepAlviste/nvim-ts-context-commentstring",
5 | }
6 |
7 | M.opts = {
8 | lang = {
9 | astro = "",
10 | c = "// %s",
11 | cpp = "// %s",
12 | css = "/* %s */",
13 | gleam = "// %s",
14 | glimmer = "{{! %s }}",
15 | graphql = "# %s",
16 | handlebars = "{{! %s }}",
17 | hcl = "# %s",
18 | html = "",
19 | ini = "; %s",
20 | php = "// %s",
21 | rego = "# %s",
22 | rescript = "// %s",
23 | sql = "-- %s",
24 | svelte = "",
25 | terraform = "# %s",
26 | tsx = {
27 | _ = "// %s",
28 | call_expression = "// %s",
29 | comment = "// %s",
30 | jsx_attribute = "// %s",
31 | jsx_element = "{/* %s */}",
32 | jsx_fragment = "{/* %s */}",
33 | spread_element = "// %s",
34 | statement_block = "// %s",
35 | },
36 | javascript = {
37 | _ = "// %s",
38 | call_expression = "// %s",
39 | comment = "// %s",
40 | jsx_attribute = "// %s",
41 | jsx_element = "{/* %s */}",
42 | jsx_fragment = "{/* %s */}",
43 | spread_element = "// %s",
44 | statement_block = "// %s",
45 | },
46 | twig = "{# %s #}",
47 | typescript = "// %s",
48 | vim = '" %s',
49 | vue = "",
50 | },
51 | }
52 | M.config = function()
53 | vim.g.skip_ts_context_commentstring_module = true
54 | require("ts_context_commentstring").setup({
55 | enable_autocmd = false,
56 | })
57 |
58 | require("Comment").setup({
59 | ---Add a space b/w comment and the line
60 | padding = true,
61 | ---Whether the cursor should stay at its position
62 | sticky = true,
63 | ---Lines to be ignored while (un)comment
64 | ignore = nil,
65 | ---LHS of toggle mappings in NORMAL mode
66 | toggler = {
67 | ---Line-comment toggle keymap
68 | line = "gcl",
69 | ---Block-comment toggle keymap
70 | block = "gbc",
71 | },
72 | ---LHS of operator-pending mappings in NORMAL and VISUAL mode
73 | opleader = {
74 | ---Line-comment keymap
75 | line = "gl",
76 | ---Block-comment keymap
77 | block = "gb",
78 | },
79 | ---LHS of extra mappings
80 | extra = {
81 | ---Add comment on the line above
82 | above = "gcO",
83 | ---Add comment on the line below
84 | below = "gco",
85 | ---Add comment at the end of line
86 | eol = "gcA",
87 | },
88 | ---Enable keybindings
89 | ---NOTE: If given `false` then the plugin won't create any mappings
90 | mappings = {
91 | ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
92 | basic = true,
93 | ---Extra mapping; `gco`, `gcO`, `gcA`
94 | extra = true,
95 | extended = true,
96 | },
97 | ---Function to call after (un)comment
98 | post_hook = nil,
99 | ---Function to call before (un)comment
100 | -- pre_hook = nil,
101 | pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
102 | -- pre_hook = function(ctx)
103 | -- local U = require("Comment.utils")
104 | --
105 | -- local location = nil
106 | -- if ctx.ctype == U.ctype.block then
107 | -- location = require("ts_context_commentstring.utils").get_cursor_location()
108 | -- elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
109 | -- location = require("ts_context_commentstring.utils").get_visual_start_location()
110 | -- end
111 | --
112 | -- return require("ts_context_commentstring.internal").calculate_commentstring({
113 | -- key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
114 | -- location = location,
115 | -- })
116 | -- end,
117 | })
118 | end
119 |
120 | return M
121 |
--------------------------------------------------------------------------------
/lua/config/comment/init.lua:
--------------------------------------------------------------------------------
1 | local config = require("config.comment")
2 |
3 | local M = {}
4 |
5 | M.comment = config.comment
6 | M.todo = config.todo
7 |
8 | return M
9 |
--------------------------------------------------------------------------------
/lua/config/comment/todo.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require("todo-comments").setup({
5 | signs = true, -- show icons in the signs column
6 | sign_priority = 8, -- sign priority
7 | -- keywords recognized as todo comments
8 | keywords = {
9 | FIX = {
10 | icon = " ", -- icon used for the sign, and in search results
11 | color = "error", -- can be a hex color, or a named color (see below)
12 | alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
13 | -- signs = false, -- configure signs for some keywords individually
14 | },
15 | TODO = { icon = " ", color = "info" },
16 | HACK = { icon = " ", color = "warning" },
17 | WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
18 | PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
19 | NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
20 | TEST = { icon = " ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
21 | },
22 | gui_style = {
23 | fg = "NONE", -- The gui style to use for the fg highlight group.
24 | bg = "BOLD", -- The gui style to use for the bg highlight group.
25 | },
26 | merge_keywords = true, -- when true, custom keywords will be merged with the defaults
27 | -- highlighting of the line containing the todo comment
28 | -- * before: highlights before the keyword (typically comment characters)
29 | -- * keyword: highlights of the keyword
30 | -- * after: highlights after the keyword (todo text)
31 | highlight = {
32 | multiline = true, -- enable multine todo comments
33 | multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
34 | multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
35 | before = "", -- "fg" or "bg" or empty
36 | keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
37 | after = "fg", -- "fg" or "bg" or empty
38 | pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
39 | comments_only = true, -- uses treesitter to match keywords in comments only
40 | max_line_len = 400, -- ignore lines longer than this
41 | exclude = {}, -- list of file types to exclude highlighting
42 | },
43 | -- list of named colors where we try to extract the guifg from the
44 | -- list of highlight groups or use the hex color if hl not found as a fallback
45 | colors = {
46 | error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
47 | warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
48 | info = { "DiagnosticInfo", "#2563EB" },
49 | hint = { "DiagnosticHint", "#10B981" },
50 | default = { "Identifier", "#7C3AED" },
51 | test = { "Identifier", "#FF00FF" },
52 | },
53 | search = {
54 | command = "rg",
55 | args = {
56 | "--color=never",
57 | "--no-heading",
58 | "--with-filename",
59 | "--line-number",
60 | "--column",
61 | },
62 | -- regex that will be used to match keywords.
63 | -- don't replace the (KEYWORDS) placeholder
64 | pattern = [[\b(KEYWORDS):]], -- ripgrep regex
65 | -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
66 | },
67 | })
68 | end
69 |
70 | return M
71 |
--------------------------------------------------------------------------------
/lua/config/event.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.default = { "BufReadPost", "BufNewFile" }
4 |
5 | M.read = {
6 | pre = "BufReadPre",
7 | post = "BufReadPost",
8 | }
9 |
10 | M.lazy = "VeryLazy"
11 |
12 | M.new = "WinNew"
13 |
14 | M.attach = "LspAttach"
15 |
16 | M.enter = {
17 | insert = "InsertEnter",
18 | vim = "VimEnter",
19 | ui = "UIEnter",
20 | cmd = "CmdlineEnter",
21 | }
22 |
23 | M.leave = {
24 | insert = "InsertLeave",
25 | cmd = "CmdlineLeave",
26 | }
27 |
28 | return M
29 |
--------------------------------------------------------------------------------
/lua/config/eyecandy/context.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require("nvim_context_vt").setup({
5 | -- Enable by default. You can disable and use :NvimContextVtToggle to maually enable.
6 | -- Default: true
7 | enabled = true,
8 |
9 | -- Override default virtual text prefix
10 | -- Default: '-->'
11 | prefix = " ",
12 |
13 | -- Override the internal highlight group name
14 | -- Default: 'ContextVt'
15 | highlight = "CustomContextVt",
16 |
17 | -- Disable virtual text for given filetypes
18 | -- Default: { 'markdown' }
19 | disable_ft = { "markdown" },
20 |
21 | -- Disable display of virtual text below blocks for indentation based languages like Python
22 | -- Default: false
23 | disable_virtual_lines = false,
24 |
25 | -- Same as above but only for spesific filetypes
26 | -- Default: {}
27 | disable_virtual_lines_ft = { "yaml" },
28 |
29 | -- How many lines required after starting position to show virtual text
30 | -- Default: 1 (equals two lines total)
31 | min_rows = 1,
32 |
33 | -- Same as above but only for spesific filetypes
34 | -- Default: {}
35 | min_rows_ft = {},
36 |
37 | -- Custom virtual text node parser callback
38 | -- Default: nil
39 | --[[ custom_parser = function(node, ft, opts)
40 | local utils = require("nvim_context_vt.utils")
41 |
42 | -- If you return `nil`, no virtual text will be displayed.
43 | if node:type() == "function" then
44 | return nil
45 | end
46 |
47 | -- This is the standard text
48 | return opts.prefix .. " " .. utils.get_node_text(node)[1]
49 | end,
50 |
51 | -- Custom node validator callback
52 | -- Default: nil
53 | custom_validator = function(node, ft, opts)
54 | -- Internally a node is matched against min_rows and configured targets
55 | local default_validator = require("nvim_context_vt.utils").default_validator
56 | if default_validator(node, ft) then
57 | -- Custom behaviour after using the internal validator
58 | if node:type() == "function" then
59 | return false
60 | end
61 | end
62 |
63 | return true
64 | end,
65 |
66 | -- Custom node virtual text resolver callback
67 | -- Default: nil
68 | custom_resolver = function(nodes, ft, opts)
69 | -- By default the last node is used
70 | return nodes[#nodes]
71 | end, ]]
72 | })
73 | end
74 |
75 | return M
76 |
--------------------------------------------------------------------------------
/lua/config/eyecandy/dressing.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {}
4 |
5 | M.event = {}
6 |
7 | M.keys = {}
8 |
9 | M.init = function()
10 | ---@diagnostic disable-next-line: duplicate-set-field
11 | vim.ui.select = function(...)
12 | require("lazy").load({ plugins = { "dressing.nvim" } })
13 | return vim.ui.select(...)
14 | end
15 | end
16 |
17 | M.config = function()
18 | require("dressing").setup {
19 | input = {
20 | override = function(conf)
21 | conf.col = -1
22 | conf.row = 0
23 | return conf
24 | end,
25 | },
26 | }
27 | end
28 | return M
29 |
--------------------------------------------------------------------------------
/lua/config/eyecandy/hlargs.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = { 'nvim-treesitter/nvim-treesitter' }
4 |
5 | M.config = function()
6 | require('hlargs').setup {
7 | color = "#ef9062",
8 | excluded_filetypes = {},
9 | paint_arg_declarations = true,
10 | paint_arg_usages = true,
11 | hl_priority = 10000,
12 | excluded_argnames = {
13 | declarations = {},
14 | usages = {
15 | python = { 'self', 'cls' },
16 | lua = { 'self' }
17 | }
18 | },
19 | performance = {
20 | parse_delay = 1,
21 | slow_parse_delay = 50,
22 | max_iterations = 400,
23 | max_concurrent_partial_parses = 30,
24 | debounce = {
25 | partial_parse = 3,
26 | partial_insert_mode = 100,
27 | total_parse = 700,
28 | slow_parse = 5000
29 | }
30 | }
31 | }
32 | -- (You may omit the settings whose defaults you're ok with)
33 | end
34 |
35 | return M
36 |
--------------------------------------------------------------------------------
/lua/config/eyecandy/init.lua:
--------------------------------------------------------------------------------
1 | local config = require("config.eyecandy")
2 |
3 | local M = {}
4 |
5 | M.dressing = config.dressing
6 | M.noicey = config.noicey
7 | M.notify = config.notify
8 | M.scroll = config.scroll
9 | M.hlargs = config.hlargs
10 | M.windows = config.windows
11 | M.context = config.context
12 | M.symbol = config.symbol
13 |
14 | return M
15 |
--------------------------------------------------------------------------------
/lua/config/eyecandy/notify.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | ---@param bufnr number
4 | local function highlightsInStacktrace(bufnr)
5 | vim.defer_fn(function()
6 | if not vim.api.nvim_buf_is_valid(bufnr) then
7 | return
8 | end
9 | vim.api.nvim_buf_call(bufnr, function()
10 | vim.fn.matchadd("WarningMsg", [[[^/]\+\.lua:\d\+\ze:]]) -- files with error
11 | vim.fn.matchadd("WarningMsg", [[E\d\+]]) -- vim error codes
12 | end)
13 | end, 1)
14 | end
15 |
16 | M.opts = {
17 | background_colour = "Normal",
18 | fps = 30,
19 | icons = {
20 | DEBUG = "",
21 | ERROR = "",
22 | INFO = "",
23 | TRACE = "✎",
24 | WARN = "",
25 | },
26 | level = 2,
27 | minimum_width = 50,
28 | render = "minimal", -- compact, minimal, simple, default
29 | stages = "slide",
30 | top_down = true,
31 | timeout = 3000,
32 | max_height = function()
33 | return math.floor(vim.o.lines * 0.75)
34 | end,
35 | max_width = function()
36 | return math.floor(vim.o.columns * 0.35)
37 | end,
38 |
39 | -- max_width = 50,
40 | -- minimum_width = 25, -- wider for title in border
41 | -- top_down = false,
42 | -- level = 0, -- minimum severity, 0 = show all
43 | -- stages = "slide",
44 | -- icons = { ERROR = "", WARN = "", INFO = "", DEBUG = "", TRACE = "" },
45 |
46 | -- PENDING https://github.com/rcarriga/nvim-notify/pull/280
47 | -- render = "wrapped-minimal",
48 | -- render = require("funcs.TEMP-wrapped-minimal"),
49 | on_open = function(win, record)
50 | if not vim.api.nvim_win_is_valid(win) then
51 | return
52 | end
53 |
54 | -- put title into border PENDING https://github.com/rcarriga/nvim-notify/issues/279
55 | local opts = { border = vim.g.borderStyle }
56 | local hasTitle = record.title[1] and record.title[1] ~= ""
57 | if hasTitle then
58 | local title = " " .. record.title[1] .. " "
59 | if record.level ~= "INFO" then
60 | title = " " .. record.icon .. title
61 | end
62 | local titleHl = ("Notify%sTitle"):format(record.level)
63 | opts.title = { { title, titleHl } }
64 | opts.title_pos = "left"
65 | end
66 | vim.api.nvim_win_set_config(win, opts)
67 |
68 | local bufnr = vim.api.nvim_win_get_buf(win)
69 | highlightsInStacktrace(bufnr)
70 | end,
71 | }
72 |
73 | M.config = function()
74 | require("notify").setup({
75 | M.opts,
76 | })
77 | local theme = require("core.colors")
78 |
79 | vim.api.nvim_set_hl(0, "NotifyERRORBorder", { fg = theme.color1, bg = theme.color0 })
80 | vim.api.nvim_set_hl(0, "NotifyWARNBorder", { fg = theme.color1, bg = theme.color0 })
81 | vim.api.nvim_set_hl(0, "NotifyINFOBorder", { fg = theme.color1, bg = theme.color0 })
82 | vim.api.nvim_set_hl(0, "NotifyDEBUGBorder", { fg = theme.color1, bg = theme.color0 })
83 | vim.api.nvim_set_hl(0, "NotifyTRACEBorder", { fg = theme.color1, bg = theme.color0 })
84 |
85 | vim.api.nvim_set_hl(0, "NotifyERRORIcon", { fg = theme.color87, bg = theme.color0 })
86 | vim.api.nvim_set_hl(0, "NotifyWARNIcon", { fg = theme.color88, bg = theme.color0 })
87 | vim.api.nvim_set_hl(0, "NotifyINFOIcon", { fg = theme.color89, bg = theme.color0 })
88 | vim.api.nvim_set_hl(0, "NotifyDEBUGIcon", { fg = theme.color90, bg = theme.color0 })
89 | vim.api.nvim_set_hl(0, "NotifyTRACEIcon", { fg = theme.color91, bg = theme.color0 })
90 |
91 | vim.api.nvim_set_hl(0, "NotifyERRORTitle", { fg = theme.color87, bg = theme.color0 })
92 | vim.api.nvim_set_hl(0, "NotifyWARNTitle", { fg = theme.color88, bg = theme.color0 })
93 | vim.api.nvim_set_hl(0, "NotifyINFOTitle", { fg = theme.color89, bg = theme.color0 })
94 | vim.api.nvim_set_hl(0, "NotifyDEBUGTitle", { fg = theme.color90, bg = theme.color0 })
95 | vim.api.nvim_set_hl(0, "NotifyTRACETitle", { fg = theme.color91, bg = theme.color0 })
96 |
97 | vim.api.nvim_set_hl(0, "NotifyERRORBody", { bg = theme.color0 })
98 | vim.api.nvim_set_hl(0, "NotifyWARNBody", { bg = theme.color0 })
99 | vim.api.nvim_set_hl(0, "NotifyINFOBody", { bg = theme.color0 })
100 | vim.api.nvim_set_hl(0, "NotifyDEBUGBody", { bg = theme.color0 })
101 | vim.api.nvim_set_hl(0, "NotifyTRACEBody", { bg = theme.color0 })
102 | end
103 |
104 | return M
105 |
--------------------------------------------------------------------------------
/lua/config/eyecandy/symbol.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local SymbolKind = vim.lsp.protocol.SymbolKind
5 |
6 | ---@type UserOpts
7 | require("symbol-usage").setup({
8 | ---@type table `nvim_set_hl`-like options for highlight virtual text
9 | hl = { link = "Comment" },
10 | ---@type lsp.SymbolKind[] Symbol kinds what need to be count (see `lsp.SymbolKind`)
11 | kinds = { SymbolKind.Function, SymbolKind.Method },
12 | ---Additional filter for kinds. Recommended use in the filetypes override table.
13 | ---fiterKind: function(data: { symbol:table, parent:table, bufnr:integer }): boolean
14 | ---`symbol` and `parent` is an item from `textDocument/documentSymbol` request
15 | ---See: #filter-kinds
16 | ---@type table
17 | kinds_filter = {},
18 | ---@type 'above'|'end_of_line'|'textwidth'|'signcolumn' `above` by default
19 | vt_position = "signcolumn",
20 | vt_priority = nil, ---@type integer Virtual text priority (see `nvim_buf_set_extmark`)
21 | ---Text to display when request is pending. If `false`, extmark will not be
22 | ---created until the request is finished. Recommended to use with `above`
23 | ---vt_position to avoid "jumping lines".
24 | ---@type string|table|false
25 | request_pending_text = "loading...",
26 | ---The function can return a string to which the highlighting group from `opts.hl` is applied.
27 | ---Alternatively, it can return a table of tuples of the form `{ { text, hl_group }, ... }`` - in this case the specified groups will be applied.
28 | ---If `vt_position` is 'signcolumn', then only a 1-2 length string or a `{{ icon, hl_group }}` table is expected.
29 | ---See `#format-text-examples`
30 | ---@type function(symbol: Symbol): string|table Symbol{ definition = integer|nil, implementation = integer|nil, references = integer|nil }
31 | -- text_format = function(symbol) end,
32 | references = { enabled = true, include_declaration = false },
33 | definition = { enabled = false },
34 | implementation = { enabled = false },
35 | ---@type { lsp?: string[], filetypes?: string[], cond?: function[] } Disables `symbol-usage.nvim' for specific LSPs, filetypes, or on custom conditions.
36 | ---The function in the `cond` list takes an argument `bufnr` and returns a boolean. If it returns true, `symbol-usage` will not run in that buffer.
37 | disable = { lsp = {}, filetypes = {}, cond = {} },
38 | ---@type UserOpts[] See default overridings in `lua/symbol-usage/langs.lua`
39 | -- filetypes = {},
40 | ---@type 'start'|'end' At which position of `symbol.selectionRange` the request to the lsp server should start. Default is `end` (try changing it to `start` if the symbol counting is not correct).
41 | symbol_request_pos = "end", -- Recommended redefine only in `filetypes` override table
42 | })
43 | end
44 |
45 | return M
46 |
--------------------------------------------------------------------------------
/lua/config/eyecandy/windows.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {
4 | "anuvyklack/middleclass",
5 | "anuvyklack/animation.nvim",
6 | }
7 |
8 | M.config = function()
9 | vim.o.winwidth = 10
10 | vim.o.winminwidth = 10
11 | vim.o.equalalways = false
12 | require("windows").setup()
13 |
14 | local function cmd(command)
15 | return table.concat({ "", command, "" })
16 | end
17 |
18 | -- :WindowsEnableAutowidth
19 | -- :WindowsDisableAutowidth
20 | -- :WindowsToggleAutowidth
21 |
22 | vim.keymap.set("n", "wf", cmd("WindowsMaximize"))
23 | vim.keymap.set("n", "wl", cmd("WindowsMaximizeVertically"))
24 | vim.keymap.set("n", "wh", cmd("WindowsMaximizeHorizontally"))
25 | vim.keymap.set("n", "we", cmd("WindowsEqualize"))
26 | end
27 |
28 | return M
29 |
--------------------------------------------------------------------------------
/lua/config/git/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.keys = {
4 | {
5 | "ga",
6 | mode = { "n" },
7 | function()
8 | require("gitsigns").stage_buffer()
9 | end,
10 | desc = "Stage Buffer",
11 | },
12 | {
13 | "gb",
14 | mode = { "n" },
15 | function()
16 | require("gitsigns").blame_line()
17 | end,
18 | desc = "Blame line",
19 | },
20 | {
21 | "gd",
22 | mode = { "n" },
23 | function()
24 | require("gitsigns").diff_this()
25 | end,
26 | desc = "Diff This",
27 | },
28 | {
29 | "gl",
30 | mode = { "n" },
31 | function()
32 | require("gitsigns").toggle_current_line_blame()
33 | end,
34 | desc = "Toggle Current Line Blame",
35 | },
36 | {
37 | "]h",
38 | mode = { "n" },
39 | function()
40 | require("gitsigns").next_hunk()
41 | end,
42 | desc = "Next Hunk",
43 | },
44 | {
45 | "[h",
46 | mode = { "n" },
47 | function()
48 | require("gitsigns").prev_hunk()
49 | end,
50 | desc = "Previous Hunk",
51 | },
52 | {
53 | "gu",
54 | mode = { "n" },
55 | function()
56 | require("gitsigns").undo_stage_hunk()
57 | end,
58 | desc = "Undo Stage Hunk",
59 | },
60 | {
61 | "gp",
62 | mode = { "n" },
63 | function()
64 | require("gitsigns").preview_hunk()
65 | end,
66 | desc = "Preview Hunk",
67 | },
68 | {
69 | "gr",
70 | mode = { "n" },
71 | function()
72 | require("gitsigns").reset_hunk()
73 | end,
74 | desc = "Reset Hunk",
75 | },
76 | {
77 | "gs",
78 | mode = { "n" },
79 | function()
80 | require("gitsigns").stage_hunk()
81 | end,
82 | desc = "Stage Hunk",
83 | },
84 | {
85 | "gt",
86 | mode = { "n" },
87 | function()
88 | require("gitsigns").select_hunk()
89 | end,
90 | desc = "Select Hunk",
91 | },
92 | {
93 | "gx",
94 | mode = { "n" },
95 | function()
96 | require("gitsigns").toggle_deleted()
97 | end,
98 | desc = "Toggle Deleted",
99 | },
100 | }
101 |
102 | M.config = function()
103 | require("gitsigns").setup({
104 | signs = {
105 | add = { text = "┃" },
106 | change = { text = "┃" },
107 | delete = { text = "_" },
108 | topdelete = { text = "‾" },
109 | changedelete = { text = "~" },
110 | untracked = { text = "┆" },
111 | },
112 | auto_attach = true,
113 | signcolumn = false,
114 | numhl = true, -- Toggle with `:Gitsigns toggle_numhl`
115 | linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
116 | word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
117 | watch_gitdir = {
118 | interval = 1000,
119 | follow_files = true,
120 | },
121 | attach_to_untracked = true,
122 | current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
123 | current_line_blame_opts = {
124 | virt_text = true,
125 | virt_text_pos = "right_align", -- 'eol' | 'overlay' | 'right_align'
126 | delay = 500,
127 | ignore_whitespace = true,
128 | },
129 | current_line_blame_formatter = ", - ",
130 | sign_priority = 6,
131 | update_debounce = 100,
132 | status_formatter = nil, -- Use default
133 | max_file_length = 40000, -- Disable if file is longer than this (in lines)
134 | preview_config = {
135 | -- Options passed to nvim_open_win
136 | border = "single",
137 | style = "minimal",
138 | relative = "cursor",
139 | row = 0,
140 | col = 1,
141 | },
142 | --[[ yadm = {
143 | enable = false,
144 | }, ]]
145 | })
146 | end
147 |
148 | return M
149 |
--------------------------------------------------------------------------------
/lua/config/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.enable = {
4 | multi = true,
5 | barline = true,
6 | rest = true,
7 | markdown = true,
8 | demicolon = true,
9 | caps = true,
10 | hippatterns = true,
11 | lsp = true,
12 | rip = true,
13 | tfm = true,
14 | supermaven = true,
15 | dial = true,
16 | quickfix = true,
17 | cmp = true,
18 | noice = true,
19 | windows = true,
20 | treesitter = true,
21 | rust_tools = true,
22 | rust_vim = true,
23 | crates = true,
24 | autotag = true,
25 | context = true,
26 | illuminate = true,
27 | theme = true,
28 | oil = true,
29 | yank = true,
30 | which_key = true,
31 | typescript = true,
32 | indentscope = true,
33 | satellite = true,
34 | move = true,
35 | splitjoin = true,
36 | dressing = true,
37 | flash = true,
38 | git_signs = true,
39 | go = false,
40 | plenary = true,
41 | todo_comments = true,
42 | comment = true,
43 | icons = true,
44 | bookmarks = true,
45 | popup = true,
46 | muren = true,
47 | sentiment = true,
48 | surround = true,
49 | vim_repeat = true,
50 | antelope = true,
51 | lualine = true,
52 | fold = true,
53 | floaterm = true,
54 | suda = true,
55 | diaglist = true,
56 | notify = true,
57 | hlargs = true,
58 | targets = true,
59 | navigator = true,
60 | tshjkl = true,
61 | before = true,
62 | eyeliner = true,
63 | wordmotion = true,
64 | treesitter_textobjects = true,
65 | various_textobjects = true,
66 | comment_textobjects = true,
67 | archer_textobjects = false,
68 | bracketed = true,
69 | codeium = true,
70 | helpview = true,
71 | }
72 |
73 | return M
74 |
--------------------------------------------------------------------------------
/lua/config/languages/flutter.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {
4 | "nvim-lua/plenary.nvim",
5 | "stevearc/dressing.nvim", -- optional for vim.ui.select
6 | }
7 |
8 | M.config = function()
9 | -- alternatively you can override the default configs
10 | require("flutter-tools").setup({
11 | ui = {
12 | -- the border type to use for all floating windows, the same options/formats
13 | -- used for ":h nvim_open_win" e.g. "single" | "shadow" | {}
14 | border = "rounded",
15 | -- This determines whether notifications are show with `vim.notify` or with the plugin's custom UI
16 | -- please note that this option is eventually going to be deprecated and users will need to
17 | -- depend on plugins like `nvim-notify` instead.
18 | notification_style = "plugin", -- "native" | "plugin",
19 | },
20 | decorations = {
21 | statusline = {
22 | -- set to true to be able use the 'flutter_tools_decorations.app_version' in your statusline
23 | -- this will show the current version of the flutter app from the pubspec.yaml file
24 | app_version = false,
25 | -- set to true to be able use the 'flutter_tools_decorations.device' in your statusline
26 | -- this will show the currently running device if an application was started with a specific
27 | -- device
28 | device = false,
29 | -- set to true to be able use the 'flutter_tools_decorations.project_config' in your statusline
30 | -- this will show the currently selected project configuration
31 | project_config = false,
32 | },
33 | },
34 | debugger = { -- integrate with nvim dap + install dart code debugger
35 | enabled = false,
36 | -- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
37 | -- see |:help dap.set_exception_breakpoints()| for more info
38 | exception_breakpoints = {},
39 | -- Whether to call toString() on objects in debug views like hovers and the
40 | -- variables list.
41 | -- Invoking toString() has a performance cost and may introduce side-effects,
42 | -- although users may expected this functionality. null is treated like false.
43 | evaluate_to_string_in_debug_views = true,
44 | register_configurations = function(paths)
45 | require("dap").configurations.dart = {
46 | --put here config that you would find in .vscode/launch.json
47 | }
48 | -- If you want to load .vscode launch.json automatically run the following:
49 | -- require("dap.ext.vscode").load_launchjs()
50 | end,
51 | },
52 | -- flutter_path = "", -- <-- this takes priority over the lookup
53 | flutter_lookup_cmd = nil, -- example "dirname $(which flutter)" or "asdf where flutter"
54 | root_patterns = { ".git", "pubspec.yaml" }, -- patterns to find the root of your flutter project
55 | fvm = false, -- takes priority over path, uses /.fvm/flutter_sdk if enabled
56 | widget_guides = {
57 | enabled = false,
58 | },
59 | closing_tags = {
60 | highlight = "ErrorMsg", -- highlight for the closing tag
61 | prefix = ">", -- character to use for close tag e.g. > Widget
62 | priority = 10, -- priority of virtual text in current line
63 | -- consider to configure this when there is a possibility of multiple virtual text items in one line
64 | -- see `priority` option in |:help nvim_buf_set_extmark| for more info
65 | enabled = true, -- set to false to disable
66 | },
67 | dev_log = {
68 | enabled = true,
69 | filter = nil, -- optional callback to filter the log
70 | -- takes a log_line as string argument; returns a boolean or nil;
71 | -- the log_line is only added to the output if the function returns true
72 | notify_errors = false, -- if there is an error whilst running then notify the user
73 | open_cmd = "15split", -- command to use to open the log buffer
74 | focus_on_open = false, -- focus on the newly opened log window
75 | },
76 | dev_tools = {
77 | autostart = false, -- autostart devtools server if not detected
78 | auto_open_browser = false, -- Automatically opens devtools in the browser
79 | },
80 | outline = {
81 | open_cmd = "30vnew", -- command to use to open the outline buffer
82 | auto_open = false, -- if true this will open the outline automatically when it is first populated
83 | },
84 | lsp = {
85 | color = { -- show the derived colours for dart variables
86 | enabled = false, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
87 | background = false, -- highlight the background
88 | background_color = nil, -- required, when background is transparent (i.e. background_color = { r = 19, g = 17, b = 24},)
89 | foreground = false, -- highlight the foreground
90 | virtual_text = true, -- show the highlight using virtual text
91 | virtual_text_str = "■", -- the virtual text character to highlight
92 | },
93 | -- on_attach = my_custom_on_attach,
94 | -- capabilities = my_custom_capabilities, -- e.g. lsp_status capabilities
95 | --- OR you can specify a function to deactivate or change or control how the config is created
96 | capabilities = function(config)
97 | config.specificThingIDontWant = false
98 | return config
99 | end,
100 | -- see the link below for details on each option:
101 | -- https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#client-workspace-configuration
102 | settings = {
103 | showTodos = true,
104 | completeFunctionCalls = true,
105 | analysisExcludedFolders = { "" },
106 | renameFilesWithClasses = "prompt", -- "always"
107 | enableSnippets = true,
108 | updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command.
109 | },
110 | },
111 | })
112 | end
113 |
114 | return M
115 |
--------------------------------------------------------------------------------
/lua/config/languages/go.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {
4 | "ray-x/guihua.lua",
5 | "neovim/nvim-lspconfig",
6 | "nvim-treesitter/nvim-treesitter",
7 | }
8 |
9 | M.config = function()
10 | require("go").setup({ lsp_inlay_hints = { enable = true } })
11 | end
12 |
13 | M.ft = { "go", 'gomod' }
14 |
15 | M.build = ':lua require("go.install").update_all_sync()'
16 |
17 | return M
18 |
--------------------------------------------------------------------------------
/lua/config/languages/init.lua:
--------------------------------------------------------------------------------
1 | local config = require("config.languages")
2 |
3 | local M = {}
4 |
5 | M.markdown = config.markdown
6 | M.rust = config.rust
7 | M.go = config.go
8 | M.typescript = config.typescript
9 | M.tsc = config.tsc
10 | M.rest = config.rest
11 | M.flutter = config.flutter
12 |
13 | return M
14 |
--------------------------------------------------------------------------------
/lua/config/languages/markdown.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {
4 | -- You will not need this if you installed the
5 | -- parsers manually
6 | -- Or if the parsers are in your $RUNTIMEPATH
7 | "nvim-treesitter/nvim-treesitter",
8 |
9 | "nvim-tree/nvim-web-devicons",
10 | }
11 |
12 | M.lazy = false
13 |
14 | M.config = function() end
15 |
16 | return M
17 |
--------------------------------------------------------------------------------
/lua/config/languages/rest.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.opts = {}
4 | M.opt = {
5 | -- split direction
6 | -- possible values: "vertical", "horizontal"
7 | split_direction = "vertical",
8 | -- default_view, body or headers or headers_body
9 | default_view = "body",
10 | -- dev, test, prod, can be anything
11 | -- see: https://learn.microsoft.com/en-us/aspnet/core/test/http-files?view=aspnetcore-8.0#environment-files
12 | default_env = "dev",
13 | -- enable/disable debug mode
14 | debug = false,
15 | -- default formatters/pathresolver for different content types
16 | --[[ contenttypes = {
17 | ["application/json"] = {
18 | ft = "json",
19 | formatter = { "jq", "." },
20 | pathresolver = require("kulala.parser.jsonpath").parse,
21 | },
22 | ["application/xml"] = {
23 | ft = "xml",
24 | formatter = { "xmllint", "--format", "-" },
25 | pathresolver = { "xmllint", "--xpath", "{{path}}", "-" },
26 | },
27 | ["text/html"] = {
28 | ft = "html",
29 | formatter = { "xmllint", "--format", "--html", "-" },
30 | pathresolver = {},
31 | },
32 | }, ]]
33 | -- can be used to show loading, done and error icons in inlay hints
34 | -- possible values: "on_request", "above_request", "below_request", or nil to disable
35 | -- If "above_request" or "below_request" is used, the icons will be shown above or below the request line
36 | -- Make sure to have a line above or below the request line to show the icons
37 | show_icons = "on_request",
38 | -- default icons
39 | icons = {
40 | inlay = {
41 | loading = "⏳",
42 | done = "✅",
43 | error = "❌",
44 | },
45 | lualine = "🐼",
46 | },
47 | -- additional cURL options
48 | -- see: https://curl.se/docs/manpage.html
49 | additional_curl_options = {},
50 | -- scratchpad default contents
51 | scratchpad_default_contents = {
52 | "@MY_TOKEN_NAME=my_token_value",
53 | "",
54 | "# @name scratchpad",
55 | "POST https://httpbin.org/post HTTP/1.1",
56 | "accept: application/json",
57 | "content-type: application/json",
58 | "",
59 | "{",
60 | ' "foo": "bar"',
61 | "}",
62 | },
63 | -- enable winbar
64 | winbar = false,
65 | -- enable reading vscode rest client environment variables
66 | vscode_rest_client_environmentvars = false,
67 | }
68 |
69 | return M
70 |
--------------------------------------------------------------------------------
/lua/config/languages/tsc.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local utils = require("tsc.utils")
5 | require("tsc").setup({
6 | run_as_monorepo = true,
7 | auto_open_qflist = true,
8 | auto_close_qflist = false,
9 | auto_focus_qflist = false,
10 | auto_start_watch_mode = false,
11 | bin_path = utils.find_tsc_bin(),
12 | enable_progress_notifications = false,
13 | flags = {
14 | noEmit = true,
15 | project = function()
16 | return utils.find_nearest_tsconfig()
17 | end,
18 | watch = true,
19 | build = true,
20 | },
21 | hide_progress_notifications_from_history = true,
22 | spinner = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" },
23 | pretty_errors = true,
24 | })
25 | -- require('notify')
26 |
27 | --[[ vim.notify = function(message, level, opts)
28 | return notify(message, level, opts) -- <-- Important to return the value from `nvim-notify`
29 | end ]]
30 | end
31 |
32 | return M
33 |
--------------------------------------------------------------------------------
/lua/config/languages/typescript.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }
4 |
5 | M.config = function()
6 | local api = require("typescript-tools.api")
7 |
8 | require("typescript-tools").setup {
9 | -- on_attach = function() ... end,
10 | handlers = {
11 | ["textDocument/publishDiagnostics"] = api.filter_diagnostics(
12 | -- Ignore 'This may be converted to an async function' diagnostics.
13 | { 80006 }
14 | ),
15 | },
16 | settings = {
17 | -- spawn additional tsserver instance to calculate diagnostics on it
18 | separate_diagnostic_server = true,
19 | -- "change"|"insert_leave" determine when the client asks the server about diagnostic
20 | publish_diagnostic_on = "insert_leave",
21 | -- array of strings("fix_all"|"add_missing_imports"|"remove_unused")
22 | -- specify commands exposed as code_actions
23 | expose_as_code_action = {},
24 | -- string|nil - specify a custom path to `tsserver.js` file, if this is nil or file under path
25 | -- not exists then standard path resolution strategy is applied
26 | tsserver_path = nil,
27 | -- specify a list of plugins to load by tsserver, e.g., for support `styled-components`
28 | -- (see 💅 `styled-components` support section)
29 | tsserver_plugins = {
30 | -- for TypeScript v4.9+
31 | "@styled/typescript-styled-plugin",
32 | -- or for older TypeScript versions
33 | -- "typescript-styled-plugin",
34 | },
35 | -- this value is passed to: https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
36 | -- memory limit in megabytes or "auto"(basically no limit)
37 | tsserver_max_memory = "auto",
38 | -- described below
39 | tsserver_file_preferences = {},
40 | tsserver_format_options = {}
41 | },
42 | }
43 | end
44 |
45 | return M
46 |
--------------------------------------------------------------------------------
/lua/config/lsp/format.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.cmd = { "ConformInfo" }
4 |
5 | M.keys = {
6 | {
7 | "M-s",
8 | function()
9 | vim.cmd(":w!")
10 | vim.cmd(":noh")
11 | require("conform").format({ async = true, lsp_fallback = true })
12 | end,
13 | mode = "",
14 | desc = "Format buffer",
15 | },
16 | }
17 |
18 | -- Everything in opts will be passed to setup()
19 | M.opts = {
20 | -- Define your formatters
21 | formatters_by_ft = {
22 | lua = { "stylua" },
23 | -- python = { "isort", "black" },
24 | -- python = { { "isort", "black" } },
25 | json = { "prettierd" },
26 | rust = { "rustfmt" },
27 | css = { "prettierd" },
28 | javascript = { "prettierd" },
29 | javascriptreact = { "prettierd" },
30 | typescript = { "prettierd" },
31 | typescriptreact = { "prettierd" },
32 | },
33 | -- Set up format-on-save
34 | format_on_save = { timeout_ms = 500, lsp_fallback = true },
35 | -- Customize formatters
36 | formatters = {
37 | shfmt = {
38 | prepend_args = { "-i", "2" },
39 | },
40 | },
41 | }
42 |
43 | M.init = function()
44 | -- If you want the formatexpr, here is the place to set it
45 | vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
46 | end
47 |
48 | M.config_conform = function()
49 | require("conform").setup({
50 | format_on_save = function(bufnr)
51 | -- Disable with a global or buffer-local variable
52 | if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
53 | return
54 | end
55 | return { timeout_ms = 500, lsp_fallback = true }
56 | end,
57 | })
58 |
59 | vim.api.nvim_create_user_command("FormatDisable", function(args)
60 | if args.bang then
61 | -- FormatDisable! will disable formatting just for this buffer
62 | vim.b.disable_autoformat = true
63 | else
64 | vim.g.disable_autoformat = true
65 | end
66 | end, {
67 | desc = "Disable autoformat-on-save",
68 | bang = true,
69 | })
70 | vim.api.nvim_create_user_command("FormatEnable", function()
71 | vim.b.disable_autoformat = false
72 | vim.g.disable_autoformat = false
73 | end, {
74 | desc = "Re-enable autoformat-on-save",
75 | })
76 | vim.api.nvim_create_user_command("Format", function(args)
77 | local range = nil
78 | if args.count ~= -1 then
79 | local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
80 | range = {
81 | start = { args.line1, 0 },
82 | ["end"] = { args.line2, end_line:len() },
83 | }
84 | end
85 | require("conform").format({ async = true, lsp_fallback = true, range = range })
86 | end, { range = true })
87 | end
88 |
89 | return M
90 |
--------------------------------------------------------------------------------
/lua/config/lsp/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | local config = require("config.lsp")
4 |
5 | M.lspconfig = config.lspconfig
6 | M.mason_lspconfig = config.mason_lspconfig
7 | M.mason = config.mason
8 | M.lspsaga = config.lspsaga
9 | M.format = config.format
10 | M.zero = config.zero
11 | M.inlay = config.inlay
12 |
13 | return M
14 |
--------------------------------------------------------------------------------
/lua/config/lsp/inlay.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | vim.api.nvim_create_autocmd("LspAttach", {
5 | callback = function(args)
6 | local bufnr = args.buf ---@type number
7 | local client = vim.lsp.get_client_by_id(args.data.client_id)
8 | if client.supports_method("textDocument/inlayHint") then
9 | vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
10 | vim.keymap.set("n", "in", function()
11 | vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
12 | end, { buffer = bufnr })
13 | end
14 | end,
15 | })
16 |
17 | require("inlay-hint").setup({
18 | -- Position of virtual text. Possible values:
19 | -- 'eol': right after eol character (default).
20 | -- 'right_align': display right aligned in the window.
21 | -- 'inline': display at the specified column, and shift the buffer
22 | -- text to the right as needed.
23 | virt_text_pos = "inline",
24 | -- Can be supplied either as a string or as an integer,
25 | -- the latter which can be obtained using |nvim_get_hl_id_by_name()|.
26 | highlight_group = "LspInlayHint",
27 | -- Control how highlights are combined with the
28 | -- highlights of the text.
29 | -- 'combine': combine with background text color. (default)
30 | -- 'replace': only show the virt_text color.
31 | hl_mode = "combine",
32 | -- line_hints: array with all hints present in current line.
33 | -- options: table with this plugin configuration.
34 | -- bufnr: buffer id from where the hints come from.
35 | display_callback = function(line_hints, options, bufnr)
36 | if options.virt_text_pos == "inline" then
37 | local lhint = {}
38 | for _, hint in pairs(line_hints) do
39 | local text = ""
40 | local label = hint.label
41 | if type(label) == "string" then
42 | text = label
43 | else
44 | for _, part in ipairs(label) do
45 | text = text .. part.value
46 | end
47 | end
48 | if hint.paddingLeft then
49 | text = " " .. text
50 | end
51 | if hint.paddingRight then
52 | text = text .. " "
53 | end
54 | lhint[#lhint + 1] = { text = text, col = hint.position.character }
55 | end
56 | return lhint
57 | elseif options.virt_text_pos == "eol" or options.virt_text_pos == "right_align" then
58 | local k1 = {}
59 | local k2 = {}
60 | table.sort(line_hints, function(a, b)
61 | return a.position.character < b.position.character
62 | end)
63 | for _, hint in pairs(line_hints) do
64 | local label = hint.label
65 | local kind = hint.kind
66 | local node = kind == 1
67 | and vim.treesitter.get_node({
68 | bufnr = bufnr,
69 | pos = {
70 | hint.position.line,
71 | hint.position.character - 1,
72 | },
73 | })
74 | or nil
75 | local node_text = node and vim.treesitter.get_node_text(node, bufnr, {}) or ""
76 | local text = ""
77 | if type(label) == "string" then
78 | text = label
79 | else
80 | for _, part in ipairs(label) do
81 | text = text .. part.value
82 | end
83 | end
84 | if kind == 1 then
85 | k1[#k1 + 1] = text:gsub(":%s*", node_text .. ": ")
86 | else
87 | k2[#k2 + 1] = text:gsub(":$", "")
88 | end
89 | end
90 | local text = ""
91 | if #k2 > 0 then
92 | text = "<- (" .. table.concat(k2, ",") .. ")"
93 | end
94 | if #text > 0 then
95 | text = text .. " "
96 | end
97 | if #k1 > 0 then
98 | text = text .. "=> " .. table.concat(k1, ", ")
99 | end
100 |
101 | return text
102 | end
103 | return nil
104 | end,
105 | })
106 | end
107 |
108 | return M
109 |
--------------------------------------------------------------------------------
/lua/config/lsp/lspconfig.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {
4 | -- "hrsh7th/cmp-nvim-lsp",
5 | "onsails/lspkind-nvim",
6 | "VonHeikemen/lsp-zero.nvim",
7 | "neovim/nvim-lspconfig",
8 | "mason.nvim",
9 | }
10 |
11 | M.servers = nil
12 |
13 | M.config = function(plugin)
14 | local lsp_zero = require("lsp-zero")
15 |
16 | lsp_zero.on_attach(function(client, buffer)
17 | lsp_zero.default_keymaps({ buffer = buffer })
18 | end)
19 |
20 | local server = require("config.lsp.servers")
21 | local lsp = require("lspconfig")
22 | local ui = require("lspconfig.ui.windows")
23 |
24 | ui.default_options.border = "rounded"
25 |
26 | lsp.lua_ls.setup(server.lua_ls)
27 | lsp.rust_analyzer.setup(server.rust_analyzer)
28 | lsp.clangd.setup(server.clangd)
29 | lsp.gopls.setup(server.gopls)
30 | lsp.ts_ls.setup(server.ts_ls)
31 | local function lspSymbol(name, icon)
32 | vim.fn.sign_define("DiagnosticSign" .. name, { text = icon, numhl = "DiagnosticDefault" .. name })
33 | end
34 | --[[ error = " ",
35 | warn = " ",
36 | info = " ",
37 | hint = " ",
38 | question = " ",
39 | error = "x ",
40 | warn = "! ",
41 | info = "i ",
42 | hint = "* ",
43 | question = "? ", ]]
44 | lspSymbol("Error", "x")
45 | lspSymbol("Information", "i")
46 | lspSymbol("Hint", "*")
47 | lspSymbol("Info", "i")
48 | lspSymbol("Warning", "!")
49 | require("config.lsp.lspsaga").config()
50 | end
51 |
52 | return M
53 |
--------------------------------------------------------------------------------
/lua/config/lsp/lspsaga.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {
4 | "nvim-treesitter/nvim-treesitter",
5 | "nvim-tree/nvim-web-devicons",
6 | }
7 |
8 | M.config = function()
9 | require("lspsaga").setup({
10 | defintion = {
11 | height = 0.5,
12 | width = 0.6,
13 | keys = {
14 | edit = "l",
15 | vsplit = "v",
16 | split = "b",
17 | tabe = "t",
18 | quit = { "q", "" },
19 | close = "x",
20 | },
21 | },
22 | outline = {
23 | win_position = "right",
24 | win_width = 30,
25 | auto_preview = true,
26 | detail = true,
27 | auto_close = true,
28 | close_after_jump = false,
29 | layout = "normal",
30 | max_height = 0.5,
31 | left_width = 0.3,
32 | keys = {
33 | toggle_or_jump = "l",
34 | quit = { "q", "", "h" },
35 | jump = "o",
36 | },
37 | },
38 | ui = {
39 | border = "rounded",
40 | devicon = true,
41 | title = true,
42 | expand = "⊟",
43 | code_action = " ",
44 | actionfix = " ",
45 | lines = { "╰", "├", "│", "─", "╭" },
46 | -- kind = {},
47 | kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
48 | imp_sign = "",
49 | },
50 | symbol_in_winbar = {
51 | enable = false,
52 | separator = " ",
53 | show_file = true,
54 | folded_level = 1,
55 | color_mode = true,
56 | delay = 1,
57 | },
58 | code_action = {
59 | num_shortcut = 2,
60 | show_server_name = false,
61 | extend_gitsigns = false,
62 | keys = {
63 | quit = { "q", "" },
64 | exec = "",
65 | },
66 | },
67 | rename = {
68 | in_select = true,
69 | auto_save = false,
70 | project_max_width = 0.5,
71 | project_max_height = 0.5,
72 | keys = {
73 | quit = { "q", "" },
74 | exec = "",
75 | select = "x",
76 | },
77 | },
78 | finder = {
79 | max_height = 0.6,
80 | max_width = 0.6,
81 | right_width = 0.3,
82 | default = "ref+imp",
83 | methods = {},
84 | layout = "float",
85 | filter = {},
86 | silent = false,
87 | keys = {
88 | vsplit = "v",
89 | split = "b",
90 | shuttle = "w",
91 | toggle_or_open = "l",
92 | quit = "q",
93 | close = "x",
94 | tabe = "t",
95 | tabnew = "T",
96 | },
97 | },
98 | diagnostic = {
99 | show_code_action = true,
100 | jump_num_shortcut = true,
101 | max_width = 0.6,
102 | max_height = 0.6,
103 | text_hl_follow = true,
104 | border_follow = true,
105 | extend_relatedInformation = false,
106 | show_layout = "float",
107 | show_normal_height = 10,
108 | max_show_width = 0.9,
109 | max_show_height = 0.6,
110 | diagnostic_only_current = false,
111 | keys = {
112 | quit = { "q", "" },
113 | exec_action = "o",
114 | toggle_or_jump = "",
115 | quit_in_show = { "q", "" },
116 | },
117 | },
118 | })
119 | local signs = {
120 | --[[ Error = "",
121 | Warn = "",
122 | Info = "",
123 | Hint = "",
124 | Question = "", ]]
125 | --[[ Error = "x",
126 | Warn = "!",
127 | Info = "i",
128 | Hint = "*",
129 | Question = "?", ]]
130 | Error = "",
131 | Warn = "",
132 | Info = "",
133 | Hint = "",
134 | Question = "",
135 | }
136 | for type, icon in pairs(signs) do
137 | local hl = "DiagnosticSign" .. type
138 | vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
139 | end
140 |
141 | vim.diagnostic.config({
142 | signs = true,
143 | update_in_insert = true,
144 | virtual_lines = true,
145 | severity_sort = true,
146 | -- No virtual text (distracting!), show popup window on hover.
147 | -- virtual_text = { spacing = 4, prefix = " " },
148 | -- virtual_text = true,
149 | virtual_text = {
150 | -- severity = { min = vim.diagnostic.severity.WARN },
151 | source = true,
152 | prefix = function(diagnostic) ---@param diagnostic Diagnostic
153 | if diagnostic.severity == 1 then
154 | return " "
155 | end
156 | if diagnostic.severity == 2 then
157 | return " "
158 | end
159 | if diagnostic.severity == 3 then
160 | return " "
161 | end
162 | if diagnostic.severity == 4 then
163 | return " "
164 | end
165 | if diagnostic.severity == 5 then
166 | return " "
167 | end
168 | end,
169 | },
170 | underline = true,
171 | --[[ underline = {
172 | -- Do not underline text when severity is low (INFO or HINT).
173 | severity = { min = vim.diagnostic.severity.WARN },
174 | }, ]]
175 | float = {
176 | source = "always",
177 | focusable = true,
178 | focus = false,
179 | border = "rounded",
180 |
181 | -- Customize how diagnostic message will be shown: show error code.
182 | format = function(diagnostic)
183 | -- See null-ls.nvim#632, neovim#17222 for how to pick up `code`
184 | local user_data
185 | user_data = diagnostic.user_data or {}
186 | user_data = user_data.lsp or user_data.null_ls or user_data
187 | -- TODO: symbol is specific to pylint (will be removed)
188 | local code = (diagnostic.symbol or diagnostic.code or user_data.symbol or user_data.code)
189 | if code then
190 | return string.format("%s (%s)", diagnostic.message, code)
191 | else
192 | return diagnostic.message
193 | end
194 | end,
195 | },
196 | })
197 |
198 | local map = vim.api.nvim_set_keymap
199 |
200 | map("n", "ia", ":Lspsaga code_action", { desc = "Code Action", silent = true })
201 | map("n", "if", ":Lspsaga finder", { desc = "Finder", silent = true })
202 | map("n", "ir", ":Lspsaga rename", { desc = "Rename", silent = true })
203 | map("n", "io", ":Lspsaga outline", { desc = "Outline", silent = true })
204 | map("n", "ip", ":Lspsaga peek_definition", { desc = "Peek Definition", silent = true })
205 | map("n", "it", ":Lspsaga peek_type_definition", { desc = "Peek Type Definition", silent = true })
206 | map("n", "ig", ":Lspsaga goto_type_definition", { desc = "Goto Type Definition", silent = true })
207 | map("n", "K", ":Lspsaga hover_doc", { desc = "Hover Doc", silent = true })
208 | map("n", "]d", ":Lspsaga diagnostic_jump_next", { desc = "Next Diagnostic", silent = true })
209 | map("n", "[d", ":Lspsaga diagnostic_jump_prev", { desc = "Previous Diagnostic", silent = true })
210 |
211 | vim.keymap.set("n", "[e", function()
212 | vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.ERROR })
213 | end)
214 | vim.keymap.set("n", "]e", function()
215 | vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR })
216 | end)
217 | vim.keymap.set("n", "[r", function()
218 | vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.HINT })
219 | end)
220 | vim.keymap.set("n", "]r", function()
221 | vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.HINT })
222 | end)
223 | vim.keymap.set("n", "[w", function()
224 | vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.WARN })
225 | end)
226 | vim.keymap.set("n", "]w", function()
227 | vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.WARN })
228 | end)
229 | vim.keymap.set("n", "[W", function()
230 | vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.INFO })
231 | end)
232 | vim.keymap.set("n", "]W", function()
233 | vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.INFO })
234 | end)
235 | -- map("n", "id", function()
236 | -- return vim.diagnostic.open_float
237 | -- end, { desc = "Line Diagnostics" })
238 | map("n", "il", ":LspInfo", { desc = "Lsp Info", silent = true })
239 | end
240 |
241 | return M
242 |
--------------------------------------------------------------------------------
/lua/config/lsp/mason.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 | M.mason_lspconfig = function()
3 | local lsp_zero = require('lsp-zero')
4 | require("mason-lspconfig").setup({
5 | automatic_installation = true,
6 | handlers = { lsp_zero.default_setup },
7 | ensure_installed = {
8 | "rust-analyzer",
9 | "clangd",
10 | "codelldb",
11 | "prettierd",
12 | "shfmt",
13 | "gopls",
14 | "lua_ls",
15 | "goimports-reviser",
16 | "bash-language-server",
17 | "lua-language-server",
18 | "prisma-language-server",
19 | "typescript-language-server",
20 | },
21 | })
22 | end
23 |
24 | M.build = "MasonUpdate"
25 |
26 | M.config = function()
27 | require("mason").setup({
28 | ui = {
29 | border = "rounded",
30 | icons = {
31 | package_installed = "✔",
32 | package_pending = "➜",
33 | package_uninstalled = "",
34 | },
35 | },
36 | })
37 | end
38 |
39 | return M
40 |
--------------------------------------------------------------------------------
/lua/config/lsp/servers.lua:
--------------------------------------------------------------------------------
1 | ---@type lspconfig.options
2 | local servers = {
3 | gopls = {
4 | cmd = { "gopls" },
5 | settings = {
6 | gopls = {
7 | experimentalPostfixCompletions = true,
8 | analyses = {
9 | unusedparams = true,
10 | shadow = true,
11 | },
12 | staticcheck = true,
13 | hints = {
14 | rassignVariableTypes = true,
15 | compositeLiteralFields = true,
16 | constantValues = true,
17 | functionTypeParameters = true,
18 | parameterNames = true,
19 | rangeVariableTypes = true,
20 | },
21 | },
22 | },
23 | init_options = {
24 | usePlaceholders = true,
25 | },
26 | },
27 | clangd = {},
28 | lua_ls = {
29 | -- enabled = false,
30 | -- cmd = { "/home/folke/projects/lua-language-server/bin/lua-language-server" },
31 | -- cmd = { 'lua-language-server' },
32 | single_file_support = true,
33 | settings = {
34 | Lua = {
35 | runtime = {
36 | -- Tell the language server which version of Lua you're using
37 | -- (most likely LuaJIT in the case of Neovim)
38 | version = "LuaJIT",
39 | },
40 | -- Make the server aware of Neovim runtime files
41 | workspace = {
42 | checkThirdParty = false,
43 | library = {
44 | vim.env.VIMRUNTIME,
45 | -- "${3rd}/luv/library"
46 | -- "${3rd}/busted/library",
47 | },
48 | -- or pull in all of 'runtimepath'. NOTE: this is a lot slower
49 | -- library = vim.api.nvim_get_runtime_file("", true)
50 | },
51 | completion = {
52 | workspaceWord = true,
53 | callSnippet = "Both",
54 | -- callSnippet = "Replace",
55 | },
56 | misc = {
57 | parameters = {
58 | -- "--log-level=trace",
59 | },
60 | },
61 | hint = {
62 | enable = true,
63 | setType = false,
64 | paramType = true,
65 | paramName = "Disable",
66 | semicolon = "Disable",
67 | arrayIndex = "Disable",
68 | },
69 | doc = {
70 | privateName = { "^_" },
71 | },
72 | type = {
73 | castNumberToInteger = true,
74 | },
75 | diagnostics = {
76 | globals = { "vim" },
77 | -- disable = { "incomplete-signature-doc", "trailing-space" },
78 | -- -- enable = false,
79 | -- groupSeverity = {
80 | -- strong = "Warning",
81 | -- strict = "Warning",
82 | -- },
83 | -- groupFileStatus = {
84 | -- ["ambiguity"] = "Opened",
85 | -- ["await"] = "Opened",
86 | -- ["codestyle"] = "None",
87 | -- ["duplicate"] = "Opened",
88 | -- ["global"] = "Opened",
89 | -- ["luadoc"] = "Opened",
90 | -- ["redefined"] = "Opened",
91 | -- ["strict"] = "Opened",
92 | -- ["strong"] = "Opened",
93 | -- ["type-check"] = "Opened",
94 | -- ["unbalanced"] = "Opened",
95 | -- ["unused"] = "Opened",
96 | -- },
97 | -- unusedLocalExclude = { "_*" },
98 | },
99 | format = {
100 | enable = true,
101 | defaultConfig = {
102 | indent_style = "space",
103 | indent_size = "2",
104 | continuation_indent_size = "2",
105 | },
106 | },
107 | },
108 | },
109 | },
110 | -- codelldb = {},
111 | -- bashls = {},
112 | -- cssls = {},
113 | ts_ls = {
114 | settings = {
115 | javascript = {
116 | inlayHints = {
117 | includeInlayEnumMemberValueHints = true,
118 | includeInlayFunctionLikeReturnTypeHints = true,
119 | includeInlayFunctionParameterTypeHints = true,
120 | includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all';
121 | includeInlayParameterNameHintsWhenArgumentMatchesName = true,
122 | includeInlayPropertyDeclarationTypeHints = true,
123 | includeInlayVariableTypeHints = true,
124 | },
125 | },
126 | typescript = {
127 | inlayHints = {
128 | includeInlayEnumMemberValueHints = true,
129 | includeInlayFunctionLikeReturnTypeHints = true,
130 | includeInlayFunctionParameterTypeHints = true,
131 | includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all';
132 | includeInlayParameterNameHintsWhenArgumentMatchesName = true,
133 | includeInlayPropertyDeclarationTypeHints = true,
134 | includeInlayVariableTypeHints = true,
135 | },
136 | },
137 | },
138 | },
139 | html = {},
140 | -- jsonls = {},
141 | -- pyright = {},
142 | -- yamlls = {},
143 | -- remark_ls = {},
144 | rust_analyzer = { -- rustup component add rust-analyzer
145 | cmd = { "rustup", "run", "stable", "rust-analyzer" },
146 | },
147 | -- sumneko_lua = {
148 | -- settings = {
149 | -- Lua = {
150 | -- workspace = {
151 | -- checkThirdParty = false,
152 | -- },
153 | -- hint = {
154 | -- enable = false,
155 | -- },
156 | -- },
157 | -- },
158 | -- },
159 | }
160 |
161 | return servers
162 |
--------------------------------------------------------------------------------
/lua/config/lsp/zero.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.branch = "v3.x"
4 |
5 | return M
6 |
--------------------------------------------------------------------------------
/lua/config/motion/demicolon.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {
4 | "nvim-treesitter/nvim-treesitter",
5 | "nvim-treesitter/nvim-treesitter-textobjects",
6 | }
7 |
8 | M.opts = {
9 | diagnostic = {
10 | -- See `:help vim.diagnostic.Opts.Float`
11 | float = {},
12 | },
13 | -- Create default keymaps
14 | keymaps = {
15 | -- Create `t`/`T`/`f`/`F` key mappings
16 | horizontal_motions = true,
17 | -- Create ]d/[d, etc. key mappings to jump to diganostics. See demicolon.keymaps.create_default_diagnostic_keymaps
18 | diagnostic_motions = false,
19 | -- Create `;` and `,` key mappings
20 | repeat_motions = true,
21 | },
22 | }
23 |
24 | return M
25 |
--------------------------------------------------------------------------------
/lua/config/motion/eyeliner.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require("eyeliner").setup({
5 | highlight_on_key = false,
6 | default_keymaps = false,
7 | dim = true, -- Optional
8 | })
9 |
10 | local function eyeliner_jump(key)
11 | local forward = vim.list_contains({ "t", "f" }, key)
12 | return function()
13 | require("eyeliner").highlight({ forward = forward })
14 | return require("demicolon.jump").horizontal_jump_repeatably(key)()
15 | end
16 | end
17 |
18 | local nxo = { "n", "x", "o" }
19 | local opts = { expr = true }
20 |
21 | vim.keymap.set(nxo, "f", eyeliner_jump("f"), opts)
22 | vim.keymap.set(nxo, "F", eyeliner_jump("F"), opts)
23 | vim.keymap.set(nxo, "t", eyeliner_jump("t"), opts)
24 | vim.keymap.set(nxo, "T", eyeliner_jump("T"), opts)
25 | end
26 |
27 | return M
28 |
--------------------------------------------------------------------------------
/lua/config/motion/init.lua:
--------------------------------------------------------------------------------
1 | local config = require("config.motion")
2 |
3 | local M = {}
4 |
5 | M.demicolon = config.demicolon
6 | M.flash = config.flash
7 | M.surround = config.surround
8 | M.eyeliner = config.eyeliner
9 | M.tshjkl = config.tshjkl
10 |
11 | return M
12 |
--------------------------------------------------------------------------------
/lua/config/motion/surround.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.version = "*"
4 |
5 | M.config = function()
6 | require("nvim-surround").setup({})
7 | end
8 |
9 | return M
10 |
--------------------------------------------------------------------------------
/lua/config/motion/tshjkl.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require('tshjkl').setup({
5 | keymaps = {
6 | toggle = 'k',
7 | },
8 | marks = {
9 | parent = {
10 | virt_text = { { 'h', 'ModeMsg' } },
11 | virt_text_pos = 'overlay'
12 | },
13 | child = {
14 | virt_text = { { 'l', 'ModeMsg' } },
15 | virt_text_pos = 'overlay'
16 | },
17 | prev = {
18 | virt_text = { { 'k', 'ModeMsg' } },
19 | virt_text_pos = 'overlay'
20 | },
21 | next = {
22 | virt_text = { { 'j', 'ModeMsg' } },
23 | virt_text_pos = 'overlay'
24 | }
25 | }
26 | })
27 | end
28 |
29 | return M
30 |
--------------------------------------------------------------------------------
/lua/config/navigation/antelope.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local antelope = require("antelope")
5 |
6 | antelope.setup({
7 | notifications = false,
8 | })
9 |
10 | local marks = {
11 | data = "Z",
12 | }
13 | vim.api.nvim_command("delmarks " .. marks.data)
14 |
15 | local mark_options = {
16 | filter = function(mark)
17 | return mark:match("[a-zA-Z]")
18 | end,
19 | actions = {
20 | split = "-",
21 | vertsplit = "/",
22 | tabsplit = "]",
23 | delete = "",
24 | },
25 | }
26 |
27 | local buffer_options = {
28 | handle = "auto", -- 'bufnr' or 'dynamic' or 'auto'
29 | show_icons = true,
30 | show_current = false, -- Include current buffer in the list
31 | show_modified = true, -- Show buffer modified indicator
32 | modified_icon = "⬤", -- Character to use as modified indicator
33 | grayout_current = true, -- Wheter to gray out current buffer entry
34 | force_delete = {}, -- List of filetypes / buftypes to use
35 | -- 'bdelete!' on, e.g. { 'terminal' }
36 | filter = nil, -- Function taking bufnr as parameter,
37 | -- returning true or false
38 | sort = nil, -- Comparator function (bufnr, bufnr) -> bool
39 | terminal_char = "\\", -- Character to use for terminal buffer handles
40 | -- when options.handle is 'dynamic'
41 | grayout = true, -- Gray out non matching entries
42 |
43 | -- A list of characters to use as handles when options.handle == 'auto'
44 | auto_handles = require("antelope.buffers.constant").auto_handles,
45 | auto_exclude_handles = {}, -- A list of characters not to use as handles when
46 | -- options.handle == 'auto', e.g. { '8', '9', 'j', 'k' }
47 | previous = {
48 | enable = true, -- Mark last used buffers with specified chars and colors
49 | depth = 2, -- Maximum number of buffers to mark
50 | chars = { "•" }, -- Characters to use as markers,
51 | -- last one is used when depth > #chars
52 | groups = { -- Highlight groups for markers,
53 | "String", -- last one is used when depth > #groups
54 | "Comment",
55 | },
56 | },
57 | -- A map of action to key that should be used to invoke it
58 | actions = {
59 | split = "-",
60 | vertsplit = "|",
61 | tabsplit = "]",
62 | delete = "",
63 | priority = "=",
64 | },
65 | }
66 |
67 | local tab_options = {
68 | show_icons = true,
69 | show_current = false,
70 | actions = {
71 | delete = "",
72 | },
73 | }
74 |
75 | -- antelope.tabpages(tab_options)
76 | -- antelope.marks(mark_options)
77 | antelope.buffers(buffer_options)
78 |
79 | local theme = require("core.colors")
80 |
81 | vim.api.nvim_set_hl(0, "AntelopeBorder", { fg = theme.color2, bg = theme.color0 })
82 | vim.api.nvim_set_hl(0, "AntelopeMarkLocation", { fg = theme.color4 })
83 | vim.api.nvim_set_hl(0, "AntelopeHandleMarkLocal", { fg = theme.color7, bg = theme.color0 })
84 |
85 | vim.api.nvim_set_hl(0, "AntelopeMark", { fg = theme.color23, bg = theme.color0 })
86 | vim.api.nvim_set_hl(0, "AntelopeHandleTabpage", { fg = theme.color7, bg = theme.color0 })
87 | end
88 |
89 | return M
90 |
--------------------------------------------------------------------------------
/lua/config/navigation/before.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local before = require("before")
5 | before.setup()
6 | vim.keymap.set("n", "", before.jump_to_last_edit, { desc = "Jump to last edit" })
7 | vim.keymap.set("n", "", before.jump_to_next_edit, { desc = "Jump to next edit" })
8 | vim.keymap.set("n", "oq", before.show_edits_in_quickfix, { desc = "Show edits in quickfix" })
9 | end
10 |
11 | return M
12 |
--------------------------------------------------------------------------------
/lua/config/navigation/init.lua:
--------------------------------------------------------------------------------
1 | local config = require("config.navigation")
2 |
3 | local M = {}
4 |
5 | M.antelope = config.antelope
6 | M.oil = config.oil
7 | M.tfm = config.tfm
8 | M.navigator = config.navigator
9 | M.before = config.before
10 | M.which_key = config.which_key
11 |
12 | return M
13 |
--------------------------------------------------------------------------------
/lua/config/navigation/navigator.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require("Navigator").setup()
5 | vim.keymap.set({ "n", "t" }, "", "NavigatorLeft")
6 | vim.keymap.set({ "n", "t" }, "", "NavigatorRight")
7 | vim.keymap.set({ "n", "t" }, "", "NavigatorUp")
8 | vim.keymap.set({ "n", "t" }, "", "NavigatorDown")
9 | vim.keymap.set({ "n", "t" }, "", "NavigatorPrevious")
10 | end
11 |
12 | return M
13 |
--------------------------------------------------------------------------------
/lua/config/navigation/tfm.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require("tfm").setup({
5 | -- TFM to use
6 | -- Possible choices: "ranger" | "nnn" | "lf" | "vifm" | "yazi" (default)
7 | file_manager = "yazi",
8 | -- Replace netrw entirely
9 | -- Default: false
10 | replace_netrw = true,
11 | -- Enable creation of commands
12 | -- Default: false
13 | -- Commands:
14 | -- Tfm: selected file(s) will be opened in the current window
15 | -- TfmSplit: selected file(s) will be opened in a horizontal split
16 | -- TfmVsplit: selected file(s) will be opened in a vertical split
17 | -- TfmTabedit: selected file(s) will be opened in a new tab page
18 | enable_cmds = false,
19 | -- Custom keybindings only applied within the TFM buffer
20 | -- Default: {}
21 | keybindings = {
22 | [""] = "q",
23 | -- Override the open mode (i.e. vertical/horizontal split, new tab)
24 | -- Tip: you can add an extra `` to the end of these to immediately open the selected file(s) (assuming the TFM uses `enter` to finalise selection)
25 | [""] = ":lua require('tfm').set_next_open_mode(require('tfm').OPEN_MODE.vsplit)",
26 | [""] = ":lua require('tfm').set_next_open_mode(require('tfm').OPEN_MODE.split)",
27 | [""] = ":lua require('tfm').set_next_open_mode(require('tfm').OPEN_MODE.tabedit)",
28 | },
29 | -- Customise UI. The below options are the default
30 | ui = {
31 | border = "rounded",
32 | --[[ height = 1,
33 | width = 1,
34 | x = 1,
35 | y = 1, ]]
36 | height = 1.0,
37 | width = 1.0,
38 | x = 1.0,
39 | y = 1.0,
40 | },
41 | })
42 | -- Set keymap so you can open the default terminal file manager (yazi)
43 | vim.api.nvim_set_keymap("n", "j", "", {
44 | noremap = true,
45 | callback = require("tfm").open,
46 | desc = "Open TFM",
47 | })
48 | end
49 |
50 | return M
51 |
--------------------------------------------------------------------------------
/lua/config/quickfix/bqf.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local fn = vim.fn
5 |
6 | function _G.qftf(info)
7 | local items
8 | local ret = {}
9 | -- The name of item in list is based on the directory of quickfix window.
10 | -- Change the directory for quickfix window make the name of item shorter.
11 | -- It's a good opportunity to change current directory in quickfixtextfunc :)
12 | --
13 | -- local alterBufnr = fn.bufname('#') -- alternative buffer is the buffer before enter qf window
14 | -- local root = getRootByAlterBufnr(alterBufnr)
15 | -- vim.cmd(('noa lcd %s'):format(fn.fnameescape(root)))
16 | --
17 | if info.quickfix == 1 then
18 | items = fn.getqflist({ id = info.id, items = 0 }).items
19 | else
20 | items = fn.getloclist(info.winid, { id = info.id, items = 0 }).items
21 | end
22 | local limit = 31
23 | local fnameFmt1, fnameFmt2 = '%-' .. limit .. 's', '…%.' .. (limit - 1) .. 's'
24 | local validFmt = '%s │%5d:%-3d│%s %s'
25 | for i = info.start_idx, info.end_idx do
26 | local e = items[i]
27 | local fname = ''
28 | local str
29 | if e.valid == 1 then
30 | if e.bufnr > 0 then
31 | fname = fn.bufname(e.bufnr)
32 | if fname == '' then
33 | fname = '[No Name]'
34 | else
35 | fname = fname:gsub('^' .. vim.env.HOME, '~')
36 | end
37 | -- char in fname may occur more than 1 width, ignore this issue in order to keep performance
38 | if #fname <= limit then
39 | fname = fnameFmt1:format(fname)
40 | else
41 | fname = fnameFmt2:format(fname:sub(1 - limit))
42 | end
43 | end
44 | local lnum = e.lnum > 99999 and -1 or e.lnum
45 | local col = e.col > 999 and -1 or e.col
46 | local qtype = e.type == '' and '' or ' ' .. e.type:sub(1, 1):upper()
47 | str = validFmt:format(fname, lnum, col, qtype, e.text)
48 | else
49 | str = e.text
50 | end
51 | table.insert(ret, str)
52 | end
53 | return ret
54 | end
55 |
56 | vim.o.qftf = '{info -> v:lua._G.qftf(info)}'
57 |
58 | require('bqf').setup({
59 | auto_enable = true,
60 | auto_resize_height = true, -- highly recommended enable
61 | preview = {
62 | win_height = 16,
63 | win_vheight = 12,
64 | delay_syntax = 80,
65 | border = { '┏', '━', '┓', '┃', '┛', '━', '┗', '┃' },
66 | show_title = true,
67 | should_preview_cb = function(bufnr, qwinid)
68 | local ret = true
69 | local bufname = vim.api.nvim_buf_get_name(bufnr)
70 | local fsize = vim.fn.getfsize(bufname)
71 | if fsize > 100 * 1024 then
72 | -- skip file size greater than 100k
73 | ret = false
74 | elseif bufname:match('^fugitive://') then
75 | -- skip fugitive buffer
76 | ret = false
77 | end
78 | return ret
79 | end
80 | },
81 | -- make `drop` and `tab drop` to become preferred
82 | func_map = {
83 | drop = 'l',
84 | openc = 'o',
85 | split = 'b',
86 | vsplit = 'v',
87 | tabdrop = 't',
88 | prevfile = 'p',
89 | nextfile = 'n',
90 | pscrollup = "",
91 | pscrolldown = "",
92 | -- tabc = '',
93 | ptogglemode = 'F',
94 | fzffilter = 'f',
95 | },
96 | filter = {
97 | fzf = {
98 | action_for = { ['ctrl-s'] = 'split', ['ctrl-t'] = 'tab drop' },
99 | extra_opts = { '--bind', 'ctrl-o:toggle-all', '--bind', 'ctrl-j:down', '--bind', 'ctrl-k:up' }
100 | }
101 | }
102 | })
103 | local theme = require("core.colors")
104 |
105 | vim.api.nvim_set_hl(0, "BqfPreviewBorder", { fg = theme.color2, bg = theme.color0 })
106 | vim.api.nvim_set_hl(0, "BqfPreviewTitle", { fg = theme.color101, bg = theme.color0 })
107 | vim.api.nvim_set_hl(0, "BqfPreviewThumb", { fg = theme.color99, bg = theme.color0 })
108 | vim.api.nvim_set_hl(0, "BqfPreviewRange", { fg = theme.color0, bg = theme.color89 })
109 | end
110 |
111 | return M
112 |
--------------------------------------------------------------------------------
/lua/config/quickfix/diaglist.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require("diaglist").init({
5 | -- optional settings
6 | -- below are defaults
7 | debug = false,
8 |
9 | -- increase for noisy servers
10 | debounce_ms = 150,
11 | })
12 | end
13 |
14 | return M
15 |
--------------------------------------------------------------------------------
/lua/config/quickfix/init.lua:
--------------------------------------------------------------------------------
1 | local config = require("config.quickfix")
2 |
3 | local M = {}
4 |
5 | M.bqf = config.bqf
6 | M.diaglist = config.diaglist
7 |
8 | return M
9 |
--------------------------------------------------------------------------------
/lua/config/text-objects/archer_text_objects.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = { "arsham/arshlib.nvim" }
4 |
5 | local mappings = {
6 | space = {
7 | before = "[",
8 | after = "]",
9 | -- before = "",
10 | -- after = "",
11 | },
12 | ending = {
13 | period = {
14 | add = ".",
15 | remove = ">",
16 | },
17 | comma = {
18 | add = ",",
19 | remove = "lt",
20 | },
21 | semicolon = {
22 | add = ";",
23 | remove = ":",
24 | },
25 | },
26 | brackets = "",
27 | augment_vim = {
28 | jumplist = 4, -- put in jumplist if count of j/k is more than 4
29 | },
30 | }
31 |
32 | local textobj = {
33 | next_obj = false,
34 | --[[ next_obj = {
35 | i_next = "in",
36 | a_next = "an",
37 | }, ]]
38 | -- i_ i. i: i, i; i| i/ i\ i* i+ i- i#
39 | -- a_ a. a: a, a; a| a/ a\ a* a+ a- a#
40 | in_chars = { "_", ".", ":", ",", ";", "|", "/", "\\", "*", "+", "-", "#" },
41 | line = false,
42 | --[[ line = {
43 | i_line = "il",
44 | a_line = "al",
45 | }, ]]
46 | backtick = "`",
47 | numeric = {
48 | i_number = "in",
49 | a_number = "an",
50 | },
51 | fold = {
52 | i_block = "iz",
53 | a_block = "az",
54 | },
55 | context = { "ix", "ax" }, -- n lines from above and below.
56 | last_changed = { "iC", "aC" }, -- last pasted or changed text.
57 | }
58 |
59 | M.config = function()
60 | require("archer").config({
61 | mappings = mappings,
62 | textobj = textobj, -- false, textobj
63 | })
64 | end
65 |
66 | return M
67 |
--------------------------------------------------------------------------------
/lua/config/text-objects/comment_text_objects.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 |
4 | M.keys = {
5 | { "ic", mode = { "o", "x" }, desc = "Select comment block" },
6 | { "ac", mode = { "o", "x" }, desc = "Select comment block" },
7 | }
8 |
9 | M.dependencies = { "kana/vim-textobj-user" }
10 |
11 |
12 | return M
13 |
--------------------------------------------------------------------------------
/lua/config/text-objects/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | local config = require("config.text-objects")
4 |
5 | M.treesitter_text_objects = config.treesitter_text_objects
6 | M.comment_text_objects = config.comment_text_objects
7 | M.archer_text_objects = config.archer_text_objects
8 | M.various_text_objects = config.various_text_objects
9 |
10 | return M
11 |
--------------------------------------------------------------------------------
/lua/config/text-objects/treesitter_text_objects.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | local function starts_with(str, start)
4 | return str:sub(1, #start) == start
5 | end
6 |
7 | local function treesitter_selection_mode(info)
8 | -- * query_string: eg '@function.inner'
9 | -- * method: eg 'v' or 'o'
10 | --print(info['method']) -- visual, operator-pending
11 | if starts_with(info["query_string"], "@function.") then
12 | return "V"
13 | end
14 | return "v"
15 | end
16 |
17 | local goto_next_start = {
18 | ["]f"] = "@function.outer",
19 | ["]m"] = "@call.outer",
20 | ["]l"] = "@conditional.outer",
21 | ["]o"] = "@loop.outer",
22 | ["]s"] = "@statement.outer",
23 | ["]a"] = "@parameter.outer",
24 | ["]c"] = "@comment.outer",
25 | ["]b"] = "@block.outer",
26 | ["]r"] = "@number.inner",
27 | -- ["]l"] = { query = "@class.outer", desc = "next class start" },
28 | ["]]f"] = "@function.inner",
29 | ["]]m"] = "@call.inner",
30 | ["]]l"] = "@conditional.inner",
31 | ["]]o"] = "@loop.inner",
32 | ["]]a"] = "@parameter.inner",
33 | ["]]b"] = "@block.inner",
34 | -- ["]]l"] = { query = "@class.inner", desc = "next class start" },
35 | }
36 | local goto_next_end = {
37 | ["]F"] = "@function.outer",
38 | ["]M"] = "@call.outer",
39 | ["]L"] = "@conditional.outer",
40 | ["]O"] = "@loop.outer",
41 | ["]S"] = "@statement.outer",
42 | ["]A"] = "@parameter.outer",
43 | ["]C"] = "@comment.outer",
44 | ["]B"] = "@block.outer",
45 | -- ["]L"] = "@class.outer",
46 | ["]R"] = "@number.inner",
47 | ["]]F"] = "@function.inner",
48 | ["]]M"] = "@call.inner",
49 | ["]]L"] = "@conditional.inner",
50 | ["]]O"] = "@loop.inner",
51 | ["]]A"] = "@parameter.inner",
52 | ["]]B"] = "@block.inner",
53 | -- ["]]L"] = "@class.inner",
54 | }
55 | local goto_previous_start = {
56 | ["[f"] = "@function.outer",
57 | ["[m"] = "@call.outer",
58 | ["[l"] = "@conditional.outer",
59 | ["[o"] = "@loop.outer",
60 | ["[s"] = "@statement.outer",
61 | ["[a"] = "@parameter.outer",
62 | ["[c"] = "@comment.outer",
63 | ["[b"] = "@block.outer",
64 | -- ["[l"] = "@class.outer",
65 | ["[r"] = "@number.inner",
66 | ["[[f"] = "@function.inner",
67 | ["[[m"] = "@call.inner",
68 | ["[[l"] = "@conditional.inner",
69 | ["[[o"] = "@loop.inner",
70 | ["[[a"] = "@parameter.inner",
71 | ["[[b"] = "@block.inner",
72 | -- ["[[l"] = "@class.inner",
73 | }
74 | local goto_previous_end = {
75 | ["[F"] = "@function.outer",
76 | ["[M"] = "@call.outer",
77 | ["[L"] = "@conditional.outer",
78 | ["[O"] = "@loop.outer",
79 | ["[S"] = "@statement.outer",
80 | ["[A"] = "@parameter.outer",
81 | ["[C"] = "@comment.outer",
82 | ["[B"] = "@block.outer",
83 | -- ["[L"] = "@class.outer",
84 | ["[R"] = "@number.inner",
85 | ["[[F"] = "@function.inner",
86 | ["[[M"] = "@call.inner",
87 | ["[[L"] = "@conditional.inner",
88 | ["[[O"] = "@loop.inner",
89 | ["[[A"] = "@parameter.inner",
90 | ["[[B"] = "@block.inner",
91 | -- ["[[L"] = "@class.inner",
92 | }
93 |
94 | M.treesitter_textobjects = {
95 | select = {
96 | enable = true,
97 |
98 | -- Automatically jump forward to textobj, similar to targets.vim
99 | lookahead = true,
100 |
101 | keymaps = {
102 | -- You can use the capture groups defined in textobjects.scm
103 | ["af"] = "@function.outer",
104 | ["if"] = "@function.inner",
105 | -- ["al"] = "@class.outer",
106 | -- ["il"] = { query = "@class.inner", desc = "Select inner part of a class region" }, -- You can optionally set descriptions to the mappings (used in the desc parameter of nvim_buf_set_keymap) which plugins like which-key display
107 | -- ["ab"] = "@block.outer",
108 | -- ["ib"] = "@block.inner",
109 | -- ["al"] = "@conditional.outer",
110 | -- ["il"] = "@conditional.inner",
111 | ["ao"] = "@loop.outer",
112 | ["io"] = "@loop.inner",
113 | ["aa"] = "@parameter.outer",
114 | ["ia"] = "@parameter.inner",
115 | ["am"] = "@call.outer",
116 | ["im"] = "@call.inner",
117 | ["ir"] = "@number.inner",
118 | ["ag"] = "@assignment.outer",
119 | ["ig"] = "@assignment.inner",
120 | ["i,"] = "@assignment.lhs",
121 | ["i."] = "@assignment.rhs",
122 | -- ["ic"] = "@comment.outer",
123 | -- ["ac"] = "@comment.outer",
124 | --["afr"] = "@frame.outer",
125 | --["ifr"] = "@frame.inner",
126 | --["aat"] = "@attribute.outer",
127 | --["iat"] = "@attribute.inner",
128 | --["asc"] = "@scopename.inner",
129 | --["isc"] = "@scopename.inner",
130 | ["as"] = { query = "@scope", query_group = "locals" },
131 | ["is"] = "@statement.outer",
132 | -- ["ar"] = { query = "@start", query_group = "aerial" },
133 | },
134 | -- You can choose the select mode (default is charwise 'v')
135 | --
136 | -- Can also be a function which gets passed a table with the keys
137 | -- * query_string: eg '@function.inner'
138 | -- * method: eg 'v' or 'o'
139 | -- and should return the mode ('v', 'V', or '') or a table
140 | -- mapping query_strings to modes.
141 | selection_modes = treesitter_selection_mode,
142 | -- selection_modes = { ["@function.outer"] = "V" },
143 | -- if you set this to `true` (default is `false`) then any textobject is
144 | -- extended to include preceding or succeeding whitespace. succeeding
145 | -- whitespace has priority in order to act similarly to eg the built-in
146 | -- `ap`.
147 | --
148 | -- can also be a function which gets passed a table with the keys
149 | -- * query_string: eg '@function.inner'
150 | -- * selection_mode: eg 'v'
151 | -- and should return true of false
152 | include_surrounding_whitespace = false,
153 | },
154 | swap = {
155 | enable = false,
156 | swap_next = {
157 | [")f"] = "@function.outer",
158 | [")c"] = "@comment.outer",
159 | [")a"] = "@parameter.inner",
160 | [")b"] = "@block.outer",
161 | [")l"] = "@class.outer",
162 | [")s"] = "@statement.outer",
163 | },
164 | swap_previous = {
165 | ["(f"] = "@function.outer",
166 | ["(c"] = "@comment.outer",
167 | ["(a"] = "@parameter.inner",
168 | ["(b"] = "@block.outer",
169 | ["(l"] = "@class.outer",
170 | ["(s"] = "@statement.outer",
171 | },
172 | },
173 | move = {
174 | enable = false,
175 | set_jumps = true, -- whether to set jumps in the jumplist
176 | goto_next_start = goto_next_start,
177 | goto_next_end = goto_next_end,
178 | goto_previous_start = goto_previous_start,
179 | goto_previous_end = goto_previous_end,
180 | },
181 | lsp_interop = {
182 | enable = false,
183 | floating_preview_opts = { border = "rounded" },
184 | peek_definition_code = {
185 | [""] = "@function.outer",
186 | ["df"] = "@function.outer",
187 | ["dF"] = "@class.outer",
188 | },
189 | },
190 | }
191 |
192 | return M
193 |
--------------------------------------------------------------------------------
/lua/config/text-objects/various_text_objects.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.opts = {
4 | useDefaultKeymaps = true,
5 | }
6 |
7 | M.config = function()
8 | require("various-textobjs").setup({})
9 | -- TEXT OBJECTS
10 | local keymap = vim.keymap.set
11 |
12 | --indentation
13 | -- keymap({ "o", "x" }, "ii", "lua require('various-textobjs').indentation(true, true)")
14 | -- keymap({ "o", "x" }, "ai", "lua require('various-textobjs').indentation(false, true)")
15 | keymap({ "o", "x" }, "iI", "lua require('various-textobjs').indentation(true, true)")
16 | keymap({ "o", "x" }, "aI", "lua require('various-textobjs').indentation(false, false)")
17 | keymap({ "o", "x" }, "ri", "lua require('various-textobjs').restOfIndentation()")
18 | -- paragraphs
19 | keymap({ "o", "x" }, "rp", "lua require('various-textobjs').restOfParagraph()")
20 | -- subwords
21 | keymap({ "o", "x" }, "iS", "lua require('various-textobjs').subword(true)")
22 | keymap({ "o", "x" }, "aS", "lua require('various-textobjs').subword(false)")
23 | -- near closing brackets
24 | keymap({ "o", "x" }, "%", "lua require('various-textobjs').toNextClosingBracket()")
25 | -- entire buffer
26 | keymap({ "o", "x" }, "ae", "lua require('various-textobjs').entireBuffer()")
27 | -- near end of line
28 | keymap({ "o", "x" }, "n", "lua require('various-textobjs').nearEoL()")
29 | -- line characterwise
30 | keymap({ "o", "x" }, "ih", "lua require('various-textobjs').lineCharacterwise(true)")
31 | keymap({ "o", "x" }, "ah", "lua require('various-textobjs').lineCharacterwise(false)")
32 | -- column
33 | keymap({ "o", "x" }, "ij", "lua require('various-textobjs').column()")
34 | -- value
35 | keymap({ "o", "x" }, "iv", "lua require('various-textobjs').value(true)")
36 | keymap({ "o", "x" }, "av", "lua require('various-textobjs').value(false)")
37 | -- key
38 | keymap({ "o", "x" }, "ik", "lua require('various-textobjs').key(true)")
39 | keymap({ "o", "x" }, "ak", "lua require('various-textobjs').key(false)")
40 | -- url
41 | keymap({ "o", "x" }, "vu", "lua require('various-textobjs').url()")
42 | -- diagnostic
43 | keymap({ "o", "x" }, "!", "lua require('various-textobjs').diagnostic()")
44 | -- fold
45 | keymap({ "o", "x" }, "iz", "lua require('various-textobjs').closedFold(true)")
46 | keymap({ "o", "x" }, "az", "lua require('various-textobjs').closedFold(false)")
47 | -- chain member
48 | keymap({ "o", "x" }, "im", "lua require('various-textobjs').chainMember(true)")
49 | keymap({ "o", "x" }, "am", "lua require('various-textobjs').chainMember(false)")
50 | -- window
51 | keymap({ "o", "x" }, "gw", "lua require('various-textobjs').visibleInWindow()")
52 | keymap({ "o", "x" }, "gW", "lua require('various-textobjs').restOfWindow()")
53 | --[[ vim.keymap.set("n", "dsi", function()
54 | -- select inner indentation
55 | require("various-textobjs").indentation(true, true)
56 |
57 | -- plugin only switches to visual mode when textobj found
58 | local notOnIndentedLine = vim.fn.mode():find("V") == nil
59 | if notOnIndentedLine then return end
60 |
61 | -- dedent indentation
62 | vim.cmd.normal { "<", bang = true }
63 |
64 | -- delete surrounding lines
65 | local endBorderLn = vim.api.nvim_buf_get_mark(0, ">")[1] + 1
66 | local startBorderLn = vim.api.nvim_buf_get_mark(0, "<")[1] - 1
67 | vim.cmd(tostring(endBorderLn) .. " delete") -- delete end first so line index is not shifted
68 | vim.cmd(tostring(startBorderLn) .. " delete")
69 | end, { desc = "Delete surrounding indentation" }) ]]
70 | end
71 |
72 | return M
73 |
--------------------------------------------------------------------------------
/lua/config/treesitter/autopair.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.branch = 'v0.6'
4 |
5 | M.config = function()
6 | require("ultimate-autopair").setup({
7 | --
8 | })
9 | end
10 |
11 | return M
12 |
--------------------------------------------------------------------------------
/lua/config/treesitter/autotag.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local filetypes = {
5 | "html",
6 | "javascript",
7 | "typescript",
8 | "javascriptreact",
9 | "typescriptreact",
10 | "svelte",
11 | "vue",
12 | "java",
13 | "tsx",
14 | "jsx",
15 | "rescript",
16 | "xml",
17 | "php",
18 | "markdown",
19 | "astro",
20 | "glimmer",
21 | "handlebars",
22 | "hbs",
23 | }
24 | local skip_tags = {
25 | "area",
26 | "base",
27 | "br",
28 | "col",
29 | "command",
30 | "embed",
31 | "hr",
32 | "img",
33 | "slot",
34 | "input",
35 | "keygen",
36 | "link",
37 | "meta",
38 | "param",
39 | "source",
40 | "track",
41 | "wbr",
42 | "menuitem",
43 | }
44 |
45 | require("nvim-ts-autotag").setup({
46 | --[[ autotag = {
47 | enable = true,
48 | filetypes = filetypes,
49 | skip_tags = skip_tags,
50 | }, ]]
51 |
52 | opts = {
53 | -- Defaults
54 | enable_close = true, -- Auto close tags
55 | enable_rename = true, -- Auto rename pairs of tags
56 | enable_close_on_slash = false, -- Auto close on trailing
57 | },
58 | -- Also override individual filetype configs, these take priority.
59 | -- Empty by default, useful if one of the "opts" global settings
60 | -- doesn't work well in a specific filetype
61 | per_filetype = {
62 | ["html"] = {
63 | enable_close = false,
64 | },
65 | },
66 | })
67 | end
68 | return M
69 |
--------------------------------------------------------------------------------
/lua/config/treesitter/context.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.keys = {
4 | {
5 | "[k",
6 | function()
7 | require("treesitter-context").go_to_context()
8 | end,
9 | },
10 | }
11 |
12 | M.config = function()
13 | require("treesitter-context").setup({
14 | enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
15 | max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
16 | min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
17 | line_numbers = true,
18 | multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
19 | trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
20 | mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline'
21 | -- Separator between context and content. Should be a single character string, like '-'.
22 | -- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
23 | separator = nil,
24 | zindex = 20, -- The Z-index of the context window
25 | on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
26 | })
27 | local theme = require("core.colors")
28 | vim.api.nvim_set_hl(0, "TreesitterContext", { bg = theme.color01 })
29 | vim.api.nvim_set_hl(0, "TreesitterContextLineNumber", { link = "Comment" })
30 | vim.api.nvim_set_hl(0, "TreesitterContextSeparator", { bg = theme.color01 })
31 | vim.api.nvim_set_hl(0, "TreesitterContextLineNumberBottom", { bg = theme.color01 })
32 | vim.api.nvim_set_hl(0, "TreesitterContextBottom", { bg = theme.color01 })
33 | --[[ vim.keymap.set("n", "]k", function()
34 | require("treesitter-context").go_to_context(vim.v.count1)
35 | end, { silent = true }) ]]
36 | end
37 |
38 | return M
39 |
--------------------------------------------------------------------------------
/lua/config/treesitter/illuminate.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | -- default configuration
5 | require("illuminate").configure({
6 | -- providers: provider used to get references in the buffer, ordered by priority
7 | providers = {
8 | "lsp",
9 | "treesitter",
10 | "regex",
11 | },
12 | -- delay: delay in milliseconds
13 | delay = 100,
14 | -- filetype_overrides: filetype specific overrides.
15 | -- The keys are strings to represent the filetype while the values are tables that
16 | -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
17 | filetype_overrides = {},
18 | -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
19 | filetypes_denylist = {
20 | "dirvish",
21 | "dashboard",
22 | "fugitive",
23 | "harpoon",
24 | "buffalo",
25 | "flaaterm",
26 | "NvimTree",
27 | },
28 | -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist
29 | filetypes_allowlist = {},
30 | -- modes_denylist: modes to not illuminate, this overrides modes_allowlist
31 | -- See `:help mode()` for possible values
32 | modes_denylist = {},
33 | -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist
34 | -- See `:help mode()` for possible values
35 | modes_allowlist = {},
36 | -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
37 | -- Only applies to the 'regex' provider
38 | -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
39 | providers_regex_syntax_denylist = {},
40 | -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist
41 | -- Only applies to the 'regex' provider
42 | -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
43 | providers_regex_syntax_allowlist = {},
44 | -- under_cursor: whether or not to illuminate under the cursor
45 | under_cursor = true,
46 | -- large_file_cutoff: number of lines at which to use large_file_config
47 | -- The `under_cursor` option is disabled when this cutoff is hit
48 | large_file_cutoff = nil,
49 | -- large_file_config: config to use for large files (based on large_file_cutoff).
50 | -- Supports the same keys passed to .configure
51 | -- If nil, vim-illuminate will be disabled for large files.
52 | large_file_overrides = nil,
53 | -- min_count_to_highlight: minimum number of matches required to perform highlighting
54 | min_count_to_highlight = 1,
55 | })
56 | local theme = require("core.colors")
57 |
58 | vim.api.nvim_set_hl(0, "IlluminatedWordText", { fg = theme.color99, bg = theme.color1 })
59 | vim.api.nvim_set_hl(0, "IlluminatedWordRead", { fg = theme.color99, bg = theme.color1 })
60 | vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { fg = theme.color89, bg = theme.color1 })
61 | end
62 |
63 | M.keys = {
64 | {
65 | "]]",
66 | function()
67 | require("illuminate").goto_next_reference(false)
68 | end,
69 | desc = "Next Reference",
70 | },
71 | {
72 | "[[",
73 | function()
74 | require("illuminate").goto_prev_reference(false)
75 | end,
76 | desc = "Prev Reference",
77 | },
78 | }
79 |
80 | return M
81 |
--------------------------------------------------------------------------------
/lua/config/treesitter/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | local config = require("config.treesitter")
4 |
5 | M.treesitter = config.treesitter
6 | M.context = config.context
7 | M.autopair = config.autopair
8 | M.autotag = config.autotag
9 | M.illuminate = config.illuminate
10 |
11 | return M
12 |
--------------------------------------------------------------------------------
/lua/config/treesitter/treesitter.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.build = function()
4 | require("nvim-treesitter.install").update({ with_sync = true })
5 | end
6 |
7 | M.dependencies = {
8 | "nvim-treesitter/nvim-treesitter-textobjects",
9 | }
10 |
11 | M.config = function()
12 | local textobjects = require("config.text-objects.treesitter_text_objects").treesitter_textobjects
13 |
14 | require("nvim-treesitter.configs").setup({
15 | sync_install = false,
16 | ensure_installed = {
17 | "bash",
18 | "go",
19 | "html",
20 | "prisma",
21 | "dart",
22 | -- "http",
23 | -- "javascript",
24 | "kdl",
25 | "json",
26 | "rasi",
27 | "yuck",
28 | "lua",
29 | "markdown",
30 | "markdown_inline",
31 | "norg",
32 | "org",
33 | "python",
34 | "query",
35 | "regex",
36 | "rust",
37 | "tsx",
38 | "typescript",
39 | "vim",
40 | "hjson",
41 | "yaml",
42 | },
43 | highlight = {
44 | enable = true,
45 |
46 | -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
47 | -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
48 | -- the name of the parser)
49 | -- list of language that will be disabled
50 | disable = { "c", "rust" },
51 | -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
52 | --[[ disable = function(lang, buf)
53 | local max_filesize = 100 * 1024 -- 100 KB
54 | local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
55 | if ok and stats and stats.size > max_filesize then
56 | return true
57 | end
58 | end, ]]
59 |
60 | additional_vim_regex_highlighting = false,
61 | },
62 | -- matchup = {
63 | -- enable = true, -- mandatory, false will disable the whole extension
64 | -- },
65 | -- autotag = { enable = true },
66 | rainbow = {
67 | enable = true,
68 | -- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
69 | extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
70 | max_file_lines = nil, -- Do not enable for files with more than n lines, int
71 | -- colors = {}, -- table of hex strings
72 | -- termcolors = {} -- table of colour name strings
73 | },
74 | autopairs = { enable = true },
75 | indent = { enable = true },
76 | textobjects = textobjects,
77 | textsubjects = {
78 | enable = false,
79 | prev_selection = ",", -- (Optional) keymap to select the previous selection
80 | keymaps = {
81 | ["."] = "textsubjects-smart",
82 | [";"] = "textsubjects-container-outer",
83 | ["i;"] = "textsubjects-container-inner",
84 | },
85 | },
86 | refactor = {},
87 | endwise = {
88 | enable = false,
89 | },
90 | })
91 | end
92 |
93 | return M
94 |
--------------------------------------------------------------------------------
/lua/config/util.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 | --------------------------------------------------------------------------------
3 |
4 | ---runs :normal with bang
5 | ---@param cmdStr string
6 | function M.normal(cmdStr)
7 | vim.cmd.normal({ cmdStr, bang = true })
8 | end
9 |
10 | ---@nodiscard
11 | ---@param path string
12 | function M.fileExists(path)
13 | return vim.uv.fs_stat(path) ~= nil
14 | end
15 |
16 | ---@param msg string
17 | ---@param title string
18 | ---@param level? "info"|"trace"|"debug"|"warn"|"error"
19 | function M.notify(title, msg, level)
20 | if not level then
21 | level = "info"
22 | end
23 | vim.notify(msg, vim.log.levels[level:upper()], { title = title })
24 | end
25 |
26 | function M.copyAndNotify(text)
27 | vim.fn.setreg("+", text)
28 | vim.notify(text, vim.log.levels.INFO, { title = "Copied" })
29 | end
30 |
31 | ---@param hlName string name of highlight group
32 | ---@param key "fg"|"bg"|"bold"
33 | ---@nodiscard
34 | ---@return string|nil the value, or nil if hlgroup or key is not available
35 | function M.getHlValue(hlName, key)
36 | local hl
37 | repeat
38 | -- follow linked highlights
39 | hl = vim.api.nvim_get_hl(0, { name = hlName })
40 | hlName = hl.link
41 | until not hl.link
42 | local value = hl[key]
43 | if value then
44 | return ("#%06x"):format(value)
45 | else
46 | local msg = ("No %s available for highlight group %q"):format(key, hlName)
47 | M.notify("getHighlightValue", msg, "warn")
48 | end
49 | end
50 |
51 | function M.leaveVisualMode()
52 | local escKey = vim.api.nvim_replace_termcodes("", false, true, true)
53 | vim.api.nvim_feedkeys(escKey, "nx", false)
54 | end
55 |
56 | --------------------------------------------------------------------------------
57 |
58 | ---Creates autocommand triggered by Colorscheme change, that modifies a
59 | ---highlight group. Mostly useful for setting up colorscheme modifications
60 | ---specific to plugins, that should persist across colorscheme changes triggered
61 | ---by switching between dark and light mode.
62 | ---@param hlgroup string
63 | ---@param modification table
64 | function M.colorschemeMod(hlgroup, modification)
65 | vim.api.nvim_create_autocmd({ "ColorScheme", "VimEnter" }, {
66 | callback = function()
67 | vim.api.nvim_set_hl(0, hlgroup, modification)
68 | end,
69 | })
70 | end
71 |
72 | ---ensures unique keymaps https://www.reddit.com/r/neovim/comments/16h2lla/can_you_make_neovim_warn_you_if_your_config_maps/
73 | ---@param modes string|string[]
74 | ---@param lhs string
75 | ---@param rhs string|function
76 | ---@param opts? { unique: boolean, desc: string, buffer: boolean|number, nowait: boolean, remap: boolean }
77 | function M.uniqueKeymap(modes, lhs, rhs, opts)
78 | if not opts then
79 | opts = {}
80 | end
81 | if opts.unique == nil then
82 | opts.unique = true
83 | end
84 | vim.keymap.set(modes, lhs, rhs, opts)
85 | end
86 |
87 | --------------------------------------------------------------------------------
88 |
89 | M.textobjRemaps = {
90 | c = "}", -- [c]urly brace
91 | r = "]", -- [r]ectangular bracket
92 | m = "W", -- [m]assive word
93 | q = '"', -- [q]uote
94 | z = "'", -- [z]ingle quote
95 | e = "`", -- t[e]mplate string / inline cod[e]
96 | }
97 | M.extraTextobjMaps = {
98 | func = "f",
99 | call = "l",
100 | wikilink = "R",
101 | condition = "o",
102 | }
103 |
104 | --------------------------------------------------------------------------------
105 | return M
106 |
--------------------------------------------------------------------------------
/lua/config/utils/animate.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local config = -- No need to copy this inside `setup()`. Will be used automatically.
5 | {
6 | -- Cursor path
7 | cursor = {
8 | -- Whether to enable this animation
9 | enable = true,
10 |
11 | -- Timing of animation (how steps will progress in time)
12 | -- timing = --,
13 |
14 | -- Path generator for visualized cursor movement
15 | -- path = --,
16 | },
17 |
18 | -- Vertical scroll
19 | scroll = {
20 | -- Whether to enable this animation
21 | enable = true,
22 |
23 | -- Timing of animation (how steps will progress in time)
24 | -- timing = --,
25 |
26 | -- Subscroll generator based on total scroll
27 | -- subscroll = --,
28 | },
29 |
30 | -- Window resize
31 | resize = {
32 | -- Whether to enable this animation
33 | enable = true,
34 |
35 | -- Timing of animation (how steps will progress in time)
36 | -- timing = --,
37 |
38 | -- Subresize generator for all steps of resize animations
39 | -- subresize = --,
40 | },
41 |
42 | -- Window open
43 | open = {
44 | -- Whether to enable this animation
45 | enable = true,
46 |
47 | -- Timing of animation (how steps will progress in time)
48 | -- timing = --,
49 |
50 | -- Floating window config generator visualizing specific window
51 | -- winconfig = --,
52 |
53 | -- 'winblend' (window transparency) generator for floating window
54 | -- winblend = --,
55 | },
56 |
57 | -- Window close
58 | close = {
59 | -- Whether to enable this animation
60 | enable = true,
61 |
62 | -- Timing of animation (how steps will progress in time)
63 | -- timing = --,
64 |
65 | -- Floating window config generator visualizing specific window
66 | -- winconfig = --,
67 |
68 | -- 'winblend' (window transparency) generator for floating window
69 | -- winblend = --,
70 | },
71 | }
72 | require("mini.animate").setup(config)
73 | end
74 |
75 | return M
76 |
--------------------------------------------------------------------------------
/lua/config/utils/barline.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.opts = {
4 | exclude_filetypes = {},
5 | exclude_buftypes = {},
6 |
7 | statuscolumn = false,
8 | statusline = false,
9 | tabline = false,
10 | }
11 |
12 | return M
13 |
--------------------------------------------------------------------------------
/lua/config/utils/bookmarks.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local map = vim.api.nvim_set_keymap
5 | map("n", "mm", "BookmarkToggle", { noremap = true, silent = true })
6 | map("n", "mi", "BookmarkAnnotate", { noremap = true, silent = true })
7 | map("n", "ma", "BookmarkShowAll", { noremap = true, silent = true })
8 | map("n", "mn", "BookmarkNext", { noremap = true, silent = true })
9 | map("n", "mp", "BookmarkPrev", { noremap = true, silent = true })
10 | map("n", "mc", "BookmarkClear", { noremap = true, silent = true })
11 | map("n", "mx", "BookmarkClearAll", { noremap = true, silent = true })
12 | map("n", "mk", "BookmarkMoveUp", { noremap = true, silent = true })
13 | map("n", "mj", "BookmarkMoveDown", { noremap = true, silent = true })
14 | map("n", "mg", "BookmarkMoveToLine", { noremap = true, silent = true })
15 | end
16 |
17 | return M
18 |
--------------------------------------------------------------------------------
/lua/config/utils/bracketed.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | -- No need to copy this inside `setup()`. Will be used automatically.
5 | local config = -- No need to copy this inside `setup()`. Will be used automatically.
6 | {
7 | -- First-level elements are tables describing behavior of a target:
8 | --
9 | -- - - single character suffix. Used after `[` / `]` in mappings.
10 | -- For example, with `b` creates `[B`, `[b`, `]b`, `]B` mappings.
11 | -- Supply empty string `''` to not create mappings.
12 | --
13 | -- - - table overriding target options.
14 | --
15 | -- See `:h MiniBracketed.config` for more info.
16 |
17 | buffer = { suffix = "b", options = {} },
18 | comment = { suffix = "c", options = {} },
19 | conflict = { suffix = "x", options = {} },
20 | diagnostic = { suffix = "d", options = {} },
21 | file = { suffix = "f", options = {} },
22 | indent = { suffix = "i", options = {} },
23 | jump = { suffix = "j", options = {} },
24 | location = { suffix = "LL", options = {} },
25 | oldfile = { suffix = "o", options = {} },
26 | quickfix = { suffix = "q", options = {} },
27 | treesitter = { suffix = "t", options = {} },
28 | undo = { suffix = "u", options = {} },
29 | window = { suffix = "w", options = {} },
30 | yank = { suffix = "y", options = {} },
31 | }
32 | require("mini.bracketed").setup(config)
33 | end
34 |
35 | return M
36 |
--------------------------------------------------------------------------------
/lua/config/utils/caps.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.opts = {}
4 |
5 | M.keys = {
6 | {
7 | mode = { "i", "n" },
8 | "",
9 | "lua require('caps-word').toggle()",
10 | },
11 | }
12 |
13 | return M
14 |
--------------------------------------------------------------------------------
/lua/config/utils/comment.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | -- No need to copy this inside `setup()`. Will be used automatically.
5 | local config =
6 | { -- No need to copy this inside `setup()`. Will be used automatically.
7 | -- Options which control module behavior
8 | options = {
9 | -- Function to compute custom 'commentstring' (optional)
10 | custom_commentstring = nil,
11 |
12 | -- Whether to ignore blank lines
13 | ignore_blank_line = false,
14 |
15 | -- Whether to recognize as comment only lines without indent
16 | start_of_line = false,
17 |
18 | -- Whether to ensure single space pad for comment parts
19 | pad_comment_parts = true,
20 | },
21 |
22 | -- Module mappings. Use `''` (empty string) to disable one.
23 | mappings = {
24 | -- Toggle comment (like `gcip` - comment inner paragraph) for both
25 | -- Normal and Visual modes
26 | comment = 'gc',
27 |
28 | -- Toggle comment on current line
29 | comment_line = 'gcc',
30 |
31 | -- Toggle comment on visual selection
32 | comment_visual = 'gc',
33 |
34 | -- Define 'comment' textobject (like `dgc` - delete whole comment block)
35 | textobject = 'gc',
36 | },
37 |
38 | -- Hook functions to be executed at certain stage of commenting
39 | hooks = {
40 | -- Before successful commenting. Does nothing by default.
41 | pre = function() end,
42 | -- After successful commenting. Does nothing by default.
43 | post = function() end,
44 | },
45 | }
46 | require("mini.move").setup(config)
47 | end
48 |
49 | return M
50 |
--------------------------------------------------------------------------------
/lua/config/utils/dial.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = {}
4 |
5 | M.event = { "BufReadPost", "BufNewFile" }
6 |
7 | M.keys = {
8 | {
9 | "",
10 | function()
11 | return require("dial.map").inc_normal()
12 | end,
13 | expr = true,
14 | desc = "Increment",
15 | },
16 | {
17 | "",
18 | function()
19 | return require("dial.map").dec_normal()
20 | end,
21 | expr = true,
22 | desc = "Decrement",
23 | },
24 | }
25 |
26 | M.config = function()
27 | local augend = require("dial.augend")
28 | require("dial.config").augends:register_group({
29 | default = {
30 | augend.integer.alias.decimal,
31 | augend.integer.alias.hex,
32 | augend.date.alias["%Y/%m/%d"],
33 | augend.constant.alias.bool,
34 | augend.semver.alias.semver,
35 | augend.constant.new({ elements = { "let", "const" } }),
36 | },
37 | })
38 | end
39 | return M
40 |
--------------------------------------------------------------------------------
/lua/config/utils/fold.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.dependencies = { "kevinhwang91/promise-async" }
4 |
5 | M.keys = {
6 | {
7 | "zl",
8 | mode = { "n" },
9 | "za",
10 | desc = "Open all folds",
11 | },
12 | {
13 | "zj",
14 | mode = { "n" },
15 | function()
16 | require("ufo").openAllFolds()
17 | end,
18 | desc = "Open all folds",
19 | },
20 | {
21 | "zk",
22 | mode = { "n" },
23 | function()
24 | require("ufo").closeAllFolds()
25 | end,
26 | desc = "Close all folds",
27 | },
28 | {
29 | "zh",
30 | mode = { "n" },
31 | function()
32 | require("ufo").openFoldsExceptKinds()
33 | end,
34 | desc = "Open folds except kinds",
35 | },
36 | {
37 | "zg",
38 | mode = { "n" },
39 | function()
40 | require("ufo").closeFoldsWith()
41 | end,
42 | desc = "Close folds with",
43 | },
44 | {
45 | "zi",
46 | mode = { "n" },
47 | function()
48 | local winid = require("ufo").peekFoldedLinesUnderCursor()
49 | if not winid then
50 | vim.lsp.buf.hover()
51 | end
52 | end,
53 | desc = "Preview fold",
54 | },
55 | }
56 |
57 | M.config = function()
58 | local ufo = require("ufo")
59 | local ftMap = {
60 | vim = "indent",
61 | python = { "indent" },
62 | typescript = { "indent" },
63 | rust = { "indent" },
64 | go = { "indent" },
65 | lua = { "indent" },
66 | git = "",
67 | }
68 |
69 | local handler = function(virtText, lnum, endLnum, width, truncate, ctx)
70 | local newVirtText = {}
71 | local suffix = (" ... %d lines hidden ..."):format(endLnum - lnum)
72 | local sufWidth = vim.fn.strdisplaywidth(suffix)
73 | local targetWidth = width - sufWidth
74 | local curWidth = 0
75 | for _, chunk in ipairs(virtText) do
76 | local chunkText = chunk[1]
77 | local chunkWidth = vim.fn.strdisplaywidth(chunkText)
78 | if targetWidth > curWidth + chunkWidth then
79 | table.insert(newVirtText, chunk)
80 | else
81 | chunkText = truncate(chunkText, targetWidth - curWidth)
82 | local hlGroup = chunk[2]
83 | table.insert(newVirtText, { chunkText, hlGroup })
84 | chunkWidth = vim.fn.strdisplaywidth(chunkText)
85 | -- str width returned from truncate() may less than 2nd argument, need padding
86 | if curWidth + chunkWidth < targetWidth then
87 | suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
88 | end
89 | break
90 | end
91 | curWidth = curWidth + chunkWidth
92 | end
93 |
94 | table.insert(newVirtText, { suffix, "MoreMsg" })
95 | return newVirtText
96 | end
97 |
98 | local function custom_selector(bufnr)
99 | local function handleFallbackException(err, providerName)
100 | if type(err) == "string" and err:match("UfoFallbackException") then
101 | return require("ufo").getFolds(bufnr, providerName)
102 | else
103 | return require("promise").reject(err)
104 | end
105 | end
106 |
107 | return require("ufo")
108 | .getFolds(bufnr, "lsp")
109 | -- :catch(function(err)
110 | -- return handleFallbackException(err, "treesitter")
111 | -- end)
112 | :catch(
113 | function(err)
114 | return handleFallbackException(err, "indent")
115 | end
116 | )
117 | end
118 |
119 | ufo.setup({
120 | fold_virt_text_handler = handler,
121 | open_fold_hl_timeout = 150,
122 | --[[ close_fold_kinds_for_ft = { "imports", "comment" }, ]]
123 | preview = {
124 | win_config = {
125 | border = "rounded",
126 | winblend = 0,
127 | },
128 | mappings = {
129 | scrollU = "",
130 | scrollD = "",
131 | },
132 | },
133 | provider_selector = function(bufnr, filetype, buftype)
134 | return ftMap[filetype] or custom_selector
135 | end,
136 | enable_get_fold_virt_text = true,
137 | })
138 |
139 | -- buffer scope handler
140 | -- will override global handler if it is existed
141 | local bufnr = vim.api.nvim_get_current_buf()
142 | ufo.setFoldVirtTextHandler(bufnr, handler)
143 |
144 | local theme = require("core.colors")
145 | -- TODO: hover highlights
146 | vim.api.nvim_set_hl(0, "Folded", { bg = theme.color93, fg = theme.color26 })
147 | vim.api.nvim_set_hl(0, "FoldColumn", { bg = theme.color19, fg = theme.color99 })
148 | end
149 |
150 | return M
151 |
--------------------------------------------------------------------------------
/lua/config/utils/hipatterns.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local hipatterns = require("mini.hipatterns")
5 | hipatterns.setup({
6 | highlighters = {
7 | -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE'
8 | fixme = { pattern = "%f[%w]()FIXME()%f[%W]", group = "MiniHipatternsFixme" },
9 | hack = { pattern = "%f[%w]()HACK()%f[%W]", group = "MiniHipatternsHack" },
10 | todo = { pattern = "%f[%w]()TODO()%f[%W]", group = "MiniHipatternsTodo" },
11 | note = { pattern = "%f[%w]()NOTE()%f[%W]", group = "MiniHipatternsNote" },
12 |
13 | -- Highlight hex color strings (`#rrggbb`) using that color
14 | hex_color = hipatterns.gen_highlighter.hex_color(),
15 | },
16 | })
17 | end
18 |
19 | return M
20 |
--------------------------------------------------------------------------------
/lua/config/utils/icons.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.opts = {}
4 |
5 | M.specs = {
6 | { "nvim-tree/nvim-web-devicons", enabled = false, optional = true },
7 | }
8 |
9 | M.init = function()
10 | package.preload["nvim-web-devicons"] = function()
11 | -- needed since it will be false when loading and mini will fail
12 | package.loaded["nvim-web-devicons"] = {}
13 | require("mini.icons").mock_nvim_web_devicons()
14 | return package.loaded["nvim-web-devicons"]
15 | end
16 | end
17 |
18 | return M
19 |
--------------------------------------------------------------------------------
/lua/config/utils/indentscope.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | vim.api.nvim_create_autocmd("FileType", {
5 | pattern = {
6 | "dashboard",
7 | "lazy",
8 | "yankbank",
9 | "Mason",
10 | "floaterm",
11 | "oil",
12 | },
13 | callback = function()
14 | vim.b.miniindentscope_disable = true
15 | end,
16 | })
17 | require("mini.indentscope").setup({
18 | symbol = "│",
19 | -- symbol = "┊",
20 | -- Draw options
21 | draw = {
22 | -- Delay (in ms) between event and start of drawing scope indicator
23 | delay = 100,
24 |
25 | -- Animation rule for scope's first drawing. A function which, given
26 | -- next and total step numbers, returns wait time (in ms). See
27 | -- |MiniIndentscope.gen_animation| for builtin options. To disable
28 | -- animation, use `require('mini.indentscope').gen_animation.none()`.
29 | -- animation = --,
30 |
31 | -- Symbol priority. Increase to display on top of more symbols.
32 | priority = 2,
33 | },
34 |
35 | -- Module mappings. Use `''` (empty string) to disable one.
36 | mappings = {
37 | -- Textobjects
38 | object_scope = "ii",
39 | object_scope_with_border = "ai",
40 |
41 | -- Motions (jump to respective border line; if not present - body line)
42 | goto_top = "[i",
43 | goto_bottom = "]i",
44 | },
45 |
46 | -- Options which control scope computation
47 | options = {
48 | -- Type of scope's border: which line(s) with smaller indent to
49 | -- categorize as border. Can be one of: 'both', 'top', 'bottom', 'none'.
50 | border = "both",
51 |
52 | -- Whether to use cursor column when computing reference indent.
53 | -- Useful to see incremental scopes with horizontal cursor movements.
54 | indent_at_cursor = true,
55 |
56 | -- Whether to first check input line to be a border of adjacent scope.
57 | -- Use it if you want to place cursor on function header to get scope of
58 | -- its body.
59 | try_as_border = true,
60 | },
61 | })
62 | end
63 |
64 | return M
65 |
--------------------------------------------------------------------------------
/lua/config/utils/init.lua:
--------------------------------------------------------------------------------
1 | local config = require("config.utils")
2 |
3 | local M = {}
4 |
5 | M.satellite = config.satellite
6 | M.barline = config.barline
7 | M.multi = config.multi
8 | M.caps = config.caps
9 | M.persistence = config.persistence
10 | M.hipatterns = config.hipatterns
11 | M.icons = config.icons
12 | M.cmp = config.cmp
13 | M.lualine = config.lualine
14 | M.scroll = config.scroll
15 | M.theme = config.theme
16 | M.dial = config.dial
17 | M.fold = config.fold
18 | M.muren = config.muren
19 | M.move = config.move
20 | M.comment = config.comment
21 | M.marks = config.marks
22 | M.bracketed = config.bracketed
23 | M.animate = config.animate
24 | M.indentscope = config.indentscope
25 | M.rip = config.rip
26 |
27 | return M
28 |
--------------------------------------------------------------------------------
/lua/config/utils/lualine.lua:
--------------------------------------------------------------------------------
1 | local enable = require("config").enable
2 |
3 | local M = {}
4 |
5 | M.config = function()
6 | local lualine = require("lualine")
7 | local noice = require("noice")
8 |
9 | -- local latte = require("catppuccin.palettes").get_palette "latte"
10 | -- local frappe = require("catppuccin.palettes").get_palette "frappe"
11 | -- local macchiato = require("catppuccin.palettes").get_palette "macchiato"
12 | local mocha = require("catppuccin.palettes").get_palette("mocha")
13 |
14 | local colors = mocha
15 | local theme = require("core.colors")
16 |
17 | local conditions = {
18 | buffer_not_empty = function()
19 | return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
20 | end,
21 | hide_in_width = function()
22 | return vim.fn.winwidth(0) > 80
23 | end,
24 | check_git_workspace = function()
25 | local filepath = vim.fn.expand("%:p:h")
26 | local gitdir = vim.fn.finddir(".git", filepath .. ";")
27 | return gitdir and #gitdir > 0 and #gitdir < #filepath
28 | end,
29 | }
30 |
31 | -- Config
32 | local config = {
33 | options = {
34 | icons_enabled = true,
35 | disabled_filetypes = {
36 | statusline = {
37 | "dashboard",
38 | "floaterm",
39 | },
40 | },
41 | component_separators = { left = "", right = "" },
42 | section_separators = { left = "", right = "" },
43 | ignore_focus = {},
44 | always_divide_middle = true,
45 | globalstatus = false,
46 | refresh = {
47 | statusline = 1000,
48 | },
49 | -- nightfly, palenight
50 | -- theme = "catppuccin",
51 | theme = {
52 | normal = { c = { fg = colors.fg, bg = theme.color01 } },
53 | },
54 | },
55 | statusline = {},
56 | sections = {
57 | lualine_a = {},
58 | lualine_b = {},
59 | lualine_y = {},
60 | lualine_c = {},
61 | lualine_x = {},
62 | },
63 | inactive_sections = {
64 | lualine_a = {},
65 | lualine_b = {},
66 | lualine_y = {},
67 | lualine_z = {},
68 | lualine_c = {},
69 | lualine_x = {},
70 | },
71 | extensions = {},
72 | }
73 |
74 | local function sec_left(component)
75 | table.insert(config.sections.lualine_c, component)
76 | table.insert(config.inactive_sections.lualine_c, component)
77 | end
78 |
79 | local function sec_right(component)
80 | table.insert(config.sections.lualine_x, component)
81 | end
82 |
83 | local my_colors = {
84 | n = theme.color37,
85 | i = theme.color101,
86 | c = theme.color89,
87 | v = theme.color27,
88 | V = theme.color27,
89 | R = theme.color99,
90 | }
91 |
92 | local mode_color = {
93 | n = my_colors.n,
94 | i = my_colors.i,
95 | v = my_colors.v,
96 | [""] = colors.magenta,
97 | V = my_colors.V,
98 | c = my_colors.c,
99 | no = my_colors.n,
100 | s = colors.violet,
101 | S = colors.violet,
102 | [""] = colors.violet,
103 | ic = colors.blue,
104 | R = my_colors.R,
105 | Rv = my_colors.R,
106 | cv = colors.green,
107 | ce = colors.green,
108 | r = colors.magenta,
109 | rm = colors.magenta,
110 | ["r?"] = colors.magenta,
111 | ["!"] = colors.green,
112 | t = colors.green,
113 | gui = "bold",
114 | }
115 |
116 | sec_left({
117 | "mode",
118 | --[[ function()
119 | return mode[vim.fn.mode()]
120 | end, ]]
121 | -- "mode",
122 | color = function()
123 | return { bg = mode_color[vim.fn.mode()], fg = theme.color0 }
124 | end,
125 | -- padding = { right = 1, left = 3 },
126 | })
127 | -- filename
128 | sec_left({
129 | "filename",
130 | cond = conditions.buffer_not_empty,
131 | color = { fg = colors.fg },
132 | file_status = true, -- Displays file status (readonly status, modified status)
133 | newfile_status = false, -- Display new file status (new file means no write after created)
134 | path = 1, -- 0: Just the filename
135 | -- 1: Relative path
136 | -- 2: Absolute path
137 | -- 3: Absolute path, with tilde as the home directory
138 |
139 | shorting_target = 40, -- Shortens path to leave 40 spaces in the window
140 | symbols = {
141 | -- for other components. (terrible name, any suggestions?)
142 | readonly = " ", -- Text to show when the file is non-modifiable or readonly.
143 | modified = " ", -- Text to show when the file is modified.
144 | unnamed = " ", -- Text to show for unnamed buffers.
145 | newfile = " ", -- Text to show for newly created file before first write
146 | },
147 | })
148 |
149 | -- git diffs
150 | sec_left({
151 | "diff",
152 | -- symbols = { added = " ", modified = " ", removed = " ", renamed = " ", ignored = " " },
153 | symbols = { added = " + ", modified = " ~ ", removed = " - ", renamed = " → ", ignored = " / " },
154 | diff_color = {
155 | added = { fg = colors.green },
156 | modified = { fg = colors.orange },
157 | removed = { fg = colors.red },
158 | },
159 | cond = conditions.hide_in_width,
160 | padding = { right = 1, left = 1 },
161 | })
162 |
163 | -- search count
164 | sec_left({
165 | "searchcount",
166 | color = { fg = colors.green },
167 | })
168 |
169 | -- sep
170 | sec_left({
171 | function()
172 | return "%="
173 | end,
174 | })
175 |
176 | --[[ -- cool-substitute
177 | sec_left({
178 | function()
179 | local sub = require("cool-substitute.status")
180 | -- sub.status_with_icons -- return status with icons (nerdfonts)
181 | -- sub.status_no_icons -- return status without icons
182 | -- sub.status_color() -- return the color depending on the status of editing
183 | return sub.status_with_icons()
184 | end,
185 | color = function()
186 | return { fg = require("cool-substitute.status").status_color() }
187 | end,
188 | }) ]]
189 |
190 | -- macros etc
191 | sec_left({
192 | noice.api.statusline.mode.get,
193 | cond = noice.api.statusline.mode.has,
194 | color = { fg = "#ff9e64" },
195 | padding = { right = 1, left = 1 },
196 | })
197 |
198 | -- lazy updates
199 | sec_right({
200 | require("lazy.status").updates,
201 | cond = require("lazy.status").has_updates,
202 | color = { fg = "#ff9e64" },
203 | })
204 |
205 | -- diagnosticcs
206 | sec_right({
207 | "diagnostics",
208 | sources = { "nvim_diagnostic" },
209 | symbols = {
210 | --[[ error = " ",
211 | warn = " ",
212 | info = " ",
213 | hint = " ",
214 | question = " ", ]]
215 | error = "x ",
216 | warn = "! ",
217 | info = "i ",
218 | hint = "* ",
219 | question = "? ",
220 | },
221 | diagnostics_color = {
222 | color_error = { fg = colors.red },
223 | color_warn = { fg = colors.yellow },
224 | color_info = { fg = colors.cyan },
225 | },
226 | padding = { right = 1, left = 1 },
227 | })
228 |
229 | -- -- tabs
230 | -- sec_right({
231 | -- function()
232 | -- local tabpages = require("buffalo").tabpages()
233 | -- return " " .. tabpages
234 | -- end,
235 | -- color = { fg = colors.grey },
236 | -- })
237 |
238 | -- buffers
239 | sec_right({
240 | function()
241 | local buffers = require("antelope.buffers").buffers()
242 | return " " .. buffers --
243 | end,
244 | -- color = "Keyword",
245 | })
246 |
247 | -- volume
248 | -- sec_right({
249 | -- function()
250 | -- local enabled = require("pigeon.config").options.volume.enabled
251 | -- local volume = require("pigeon.volume").volume()
252 | --
253 | -- if enabled then
254 | -- return volume
255 | -- else
256 | -- return ""
257 | -- end
258 | -- end,
259 | -- color = "Keyword",
260 | -- })
261 |
262 | --[[ sec_right({
263 | function()
264 | return " " .. "%3{codeium#GetStatusString()} "
265 | end,
266 | color = { fg = colors.grey },
267 | }) ]]
268 |
269 | --[[ -- branch
270 | sec_right({
271 | -- "branch",
272 | -- icon = { "", align = "left" },
273 | -- color = { fg = colors.yellow, ng = colors.bg },
274 | -- color = "Comment",
275 | function()
276 | return ""
277 | end,
278 | padding = { right = 1, left = 0 },
279 | }) ]]
280 |
281 | lualine.setup(config)
282 | end
283 |
284 | return M
285 |
--------------------------------------------------------------------------------
/lua/config/utils/move.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | -- No need to copy this inside `setup()`. Will be used automatically.
5 | local config = {
6 | -- Module mappings. Use `''` (empty string) to disable one.
7 | mappings = {
8 | -- Move visual selection in Visual mode. Defaults are Alt (Meta) + hjkl.
9 | -- left = 'H',
10 | -- right = 'L',
11 | -- down = 'J',
12 | -- up = 'K',
13 | left = '_',
14 | right = '+',
15 | down = '-',
16 | up = '=',
17 |
18 | -- Move current line in Normal mode
19 | line_left = '_',
20 | line_right = '+',
21 | line_down = '-',
22 | line_up = '=',
23 | },
24 |
25 | -- Options which control moving behavior
26 | options = {
27 | -- Automatically reindent selection during linewise vertical move
28 | reindent_linewise = true,
29 | },
30 | }
31 | require("mini.move").setup(config)
32 | end
33 |
34 | return M
35 |
--------------------------------------------------------------------------------
/lua/config/utils/multi.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | local mc = require("multicursor-nvim")
5 |
6 | mc.setup()
7 |
8 | -- use MultiCursorCursor and MultiCursorVisual to customize
9 | -- additional cursors appearance
10 | vim.cmd.hi("link", "MultiCursorCursor", "Cursor")
11 | vim.cmd.hi("link", "MultiCursorVisual", "Visual")
12 |
13 | vim.keymap.set("n", "", function()
14 | if mc.hasCursors() then
15 | mc.clearCursors()
16 | else
17 | -- default handler
18 | end
19 | end)
20 |
21 | -- add cursors above/below the main cursor
22 | vim.keymap.set("n", "", function()
23 | mc.addCursor("k")
24 | end)
25 | vim.keymap.set("n", "", function()
26 | mc.addCursor("j")
27 | end)
28 |
29 | -- add a cursor and jump to the next word under cursor
30 | vim.keymap.set("n", "", function()
31 | mc.addCursor("*")
32 | end)
33 |
34 | -- jump to the next word under cursor but do not add a cursor
35 | vim.keymap.set("n", "", function()
36 | mc.skipCursor("*")
37 | end)
38 |
39 | -- add and remove cursors with control + left click
40 | vim.keymap.set("n", "", mc.handleMouse)
41 | end
42 |
43 | return M
44 |
--------------------------------------------------------------------------------
/lua/config/utils/muren.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require("muren").setup({
5 | -- general
6 | create_commands = true,
7 | filetype_in_preview = true,
8 | -- default togglable options
9 | two_step = false,
10 | all_on_line = true,
11 | preview = true,
12 | -- keymaps
13 | keys = {
14 | close = "q",
15 | toggle_side = "",
16 | toggle_options_focus = "",
17 | toggle_option_under_cursor = "",
18 | scroll_preview_up = "",
19 | scroll_preview_down = "",
20 | do_replace = "",
21 | },
22 | -- ui sizes
23 | patterns_width = 30,
24 | patterns_height = 10,
25 | options_width = 15,
26 | preview_height = 16,
27 | -- options order in ui
28 | order = {
29 | "buffer",
30 | "two_step",
31 | "all_on_line",
32 | "preview",
33 | },
34 | -- highlights used for options ui
35 | hl = {
36 | options = {
37 | on = "@string",
38 | off = "@variable.builtin",
39 | },
40 | },
41 | })
42 | end
43 |
44 | return M
45 |
--------------------------------------------------------------------------------
/lua/config/utils/persistence.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.opts = {
4 | dir = vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/"), -- directory where session files are saved
5 | options = { "buffers", "curdir", "tabpages", "winsize" }, -- sessionoptions used for saving
6 | pre_save = nil, -- a function to call before saving the session
7 | save_empty = false, -- don't save if there are no open file buffers
8 | }
9 |
10 | return M
11 |
--------------------------------------------------------------------------------
/lua/config/utils/rip.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.cmd = "RipSubstitute"
4 |
5 | M.keys = {
6 | {
7 | "r",
8 | function()
9 | require("rip-substitute").sub()
10 | end,
11 | mode = { "n", "x" },
12 | desc = " rip substitute",
13 | },
14 | }
15 |
16 | M.config = function()
17 | -- default settings
18 | require("rip-substitute").setup({
19 | popupWin = {
20 | title = " rip-substitute",
21 | border = "single",
22 | matchCountHlGroup = "Keyword",
23 | noMatchHlGroup = "ErrorMsg",
24 | hideSearchReplaceLabels = false,
25 | position = "top", -- "top"|"bottom"
26 | },
27 | prefill = {
28 | normal = "cursorWord", -- "cursorWord"|false
29 | visual = "selectionFirstLine", -- "selectionFirstLine"|false
30 | startInReplaceLineIfPrefill = false,
31 | },
32 | keymaps = {
33 | -- normal & visual mode
34 | confirm = "",
35 | abort = "q",
36 | prevSubst = "",
37 | nextSubst = "",
38 | insertModeConfirm = "", -- (except this one, obviously)
39 | },
40 | incrementalPreview = {
41 | matchHlGroup = "IncSearch",
42 | rangeBackdrop = {
43 | enabled = true,
44 | blend = 50, -- between 0 and 100
45 | },
46 | },
47 | regexOptions = {
48 | -- pcre2 enables lookarounds and backreferences, but performs slower
49 | pcre2 = true,
50 | ---@type "case-sensitive"|"ignore-case"|"smart-case"
51 | casing = "case-sensitive",
52 | -- disable if you use named capture groups (see README for details)
53 | autoBraceSimpleCaptureGroups = true,
54 | },
55 | editingBehavior = {
56 | -- Experimental. When typing `()` in the `search` line, automatically
57 | -- adds `$n` to the `replace` line.
58 | autoCaptureGroups = false,
59 | },
60 | notificationOnSuccess = true,
61 | })
62 | end
63 |
64 | return M
65 |
--------------------------------------------------------------------------------
/lua/config/utils/satellite.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.config = function()
4 | require("satellite").setup({
5 | current_only = false,
6 | winblend = 50,
7 | zindex = 40,
8 | excluded_filetypes = {},
9 | width = 2,
10 | handlers = {
11 | cursor = {
12 | enable = true,
13 | -- Supports any number of symbols
14 | symbols = { "⎺", "⎻", "⎼", "⎽" },
15 | -- symbols = { '⎻', '⎼' }
16 | -- Highlights:
17 | -- - SatelliteCursor (default links to NonText
18 | },
19 | search = {
20 | enable = true,
21 | -- Highlights:
22 | -- - SatelliteSearch (default links to Search)
23 | -- - SatelliteSearchCurrent (default links to SearchCurrent)
24 | },
25 | diagnostic = {
26 | enable = true,
27 | signs = { "-", "=", "≡" },
28 | min_severity = vim.diagnostic.severity.HINT,
29 | -- Highlights:
30 | -- - SatelliteDiagnosticError (default links to DiagnosticError)
31 | -- - SatelliteDiagnosticWarn (default links to DiagnosticWarn)
32 | -- - SatelliteDiagnosticInfo (default links to DiagnosticInfo)
33 | -- - SatelliteDiagnosticHint (default links to DiagnosticHint)
34 | },
35 | gitsigns = {
36 | enable = true,
37 | signs = { -- can only be a single character (multibyte is okay)
38 | add = "│",
39 | change = "│",
40 | delete = "-",
41 | },
42 | -- Highlights:
43 | -- SatelliteGitSignsAdd (default links to GitSignsAdd)
44 | -- SatelliteGitSignsChange (default links to GitSignsChange)
45 | -- SatelliteGitSignsDelete (default links to GitSignsDelete)
46 | },
47 | marks = {
48 | enable = true,
49 | show_builtins = false, -- shows the builtin marks like [ ] < >
50 | key = "m",
51 | -- Highlights:
52 | -- SatelliteMark (default links to Normal)
53 | },
54 | quickfix = {
55 | signs = { "-", "=", "≡" },
56 | -- Highlights:
57 | -- SatelliteQuickfix (default links to WarningMsg)
58 | },
59 | },
60 | })
61 | end
62 |
63 | return M
64 |
--------------------------------------------------------------------------------
/lua/config/utils/theme.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | M.name = "catppuccin"
4 |
5 | M.lazy = false
6 |
7 | M.priority = 1000
8 |
9 | M.config = function()
10 | local theme = require("core.colors")
11 |
12 | require("catppuccin").setup({
13 | integrations = {
14 | cmp = true,
15 | gitsigns = true,
16 | ufo = true,
17 | treesitter = true,
18 | noice = false,
19 | lsp_saga = false,
20 | mini = {
21 | enabled = true,
22 | indentscope_color = "",
23 | },
24 | illuminate = {
25 | enabled = true,
26 | lsp = false,
27 | },
28 | },
29 | })
30 |
31 | -- setup must be called before loading
32 | vim.cmd.colorscheme("catppuccin-mocha")
33 |
34 | -- local normal_hl = vim.api.nvim_get_hl_by_name("Normal", true)
35 | vim.api.nvim_set_hl(0, "WinBar", { bg = theme.color0 })
36 | vim.api.nvim_set_hl(0, "WinBarNC", { bg = theme.color0 })
37 | vim.api.nvim_set_hl(0, "SagaWinbarSep", { bg = theme.color0 })
38 | vim.api.nvim_set_hl(0, "SagaWinbarFolder", { bg = theme.color0 })
39 | vim.api.nvim_set_hl(0, "SagaWinbarFileName", { bg = theme.color0 })
40 | vim.api.nvim_set_hl(0, "SagaWinbarFolderName", { bg = theme.color0 })
41 |
42 | -- Eyeliner
43 | -- vim.api.nvim_set_hl(0, 'EyelinerPrimary', { bold = true, underline = true })
44 | -- vim.api.nvim_set_hl(0, 'EyelinerSecondary', { underline = true })
45 |
46 | -- Float Term
47 | vim.api.nvim_set_hl(0, "FloatermBorder", { fg = theme.color2, bg = theme.color0 })
48 |
49 | vim.api.nvim_set_hl(0, "WinSeparator", {
50 | fg = theme.color2,
51 | bg = theme.color0,
52 | })
53 |
54 | vim.api.nvim_set_hl(0, "StatusLineNC", {
55 | fg = theme.color2,
56 | bg = theme.color0,
57 | })
58 |
59 | --[[ vim.api.nvim_set_hl(0, "StatusLine", {
60 | fg = theme.color2,
61 | bg = theme.color0,
62 | }) ]]
63 |
64 | -- GitSigns
65 |
66 | vim.api.nvim_set_hl(0, "GitSignsAddLnInline", { fg = theme.colour7 })
67 | vim.api.nvim_set_hl(0, "GitSignsChangeLnInline", { fg = theme.color99 })
68 | vim.api.nvim_set_hl(0, "GitSignsDeleteLnInline", { fg = theme.color16 })
69 | vim.api.nvim_set_hl(0, "GitSignsAdd", { fg = theme.color7 })
70 | vim.api.nvim_set_hl(0, "GitSignsAddNr", { fg = theme.color7 })
71 | vim.api.nvim_set_hl(0, "GitSignsAddLn", { fg = theme.color7 })
72 | vim.api.nvim_set_hl(0, "GitSignsChange", { fg = theme.color99 })
73 | vim.api.nvim_set_hl(0, "GitSignsChangeNr", { fg = theme.color99 })
74 | vim.api.nvim_set_hl(0, "GitSignsChangeLn", { fg = theme.color99 })
75 | vim.api.nvim_set_hl(0, "GitSignsDelete", { fg = theme.color16 })
76 | vim.api.nvim_set_hl(0, "GitSignsDeleteNr", { fg = theme.color16 })
77 | vim.api.nvim_set_hl(0, "GitSignsDeleteLn", { fg = theme.color16 })
78 | -- vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { fg = theme.color05, bg = theme.color1 })
79 | vim.api.nvim_set_hl(0, "GitBlame", { fg = theme.color68, bg = theme.color101 })
80 | vim.api.nvim_set_hl(0, "CustomContextVt", { link = "Comment" })
81 | vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { link = "Comment" })
82 |
83 | vim.api.nvim_set_hl(0, "LspSignatureActiveParameter", { bg = theme.color1 })
84 | vim.api.nvim_set_hl(0, "CodeiumSuggestion", { fg = theme.color3 })
85 |
86 | vim.api.nvim_set_hl(0, "Visual", { bg = theme.color61 })
87 | vim.api.nvim_set_hl(0, "Search", { fg = theme.color1, bg = theme.color89 })
88 | -- vim.api.nvim_set_hl(0, "IncSearch", { fg = theme.color89, bg = theme.color0 })
89 | vim.api.nvim_set_hl(0, "VirtColumn", { fg = theme.color1 })
90 | vim.api.nvim_set_hl(0, "ColorColumn", { bg = theme.color1 })
91 | -- vim.api.nvim_set_hl(0, "CursorLineNR", { fg = theme.color20 })
92 | vim.api.nvim_set_hl(0, "Title", { link = "Keyword" })
93 | vim.api.nvim_set_hl(0, "CursorLineNR", { link = "Comment" })
94 | -- vim.api.nvim_set_hl(0, "Title", { fg = theme.color101, bg = theme.color0 })
95 |
96 | -- CMP
97 | vim.api.nvim_set_hl(0, "CmpPmenu", { bg = theme.color0 })
98 | vim.api.nvim_set_hl(0, "PmenuSel", { bg = theme.color1 })
99 | vim.api.nvim_set_hl(0, "CmpBorder", { fg = theme.color2, bg = theme.color0 })
100 | vim.api.nvim_set_hl(0, "CmpDocBorder", { fg = theme.color2, bg = theme.color0 })
101 | -- vim.api.nvim_set_hl(0, "Pmenu", { bg = theme.color1 })
102 | -- vim.api.nvim_set_hl(0, "PmenuExtra", { fg = theme.color2, bg = theme.color1 })
103 | -- vim.api.nvim_set_hl(0, "PmenuKind", { fg = theme.color2, bg = theme.color1 })
104 | -- vim.api.nvim_set_hl(0, "PmenuKindSel", { fg = theme.color2, bg = theme.color1 })
105 | -- vim.api.nvim_set_hl(0, "PmenuExtraSel", { fg = theme.color2, bg = theme.color1 })
106 | -- vim.api.nvim_set_hl(0, "PmenuSbar", { fg = theme.color89, bg = theme.color1 })
107 | -- vim.api.nvim_set_hl(0, "PmenuThumb", { fg = theme.color99, bg = theme.color1 })
108 |
109 | -- Popup
110 | vim.api.nvim_set_hl(0, "FloatBorder", { fg = theme.color2, bg = theme.color0 })
111 | vim.api.nvim_set_hl(0, "NormalFloat", { bg = theme.color0 })
112 |
113 | -- Match
114 | vim.api.nvim_set_hl(0, "MatchParen", { fg = theme.color99 })
115 | vim.api.nvim_set_hl(0, "MatchWord", { fg = theme.color100 })
116 | vim.api.nvim_set_hl(0, "MatchParenCur", { fg = theme.color100 })
117 | vim.api.nvim_set_hl(0, "MatchWordCur", { fg = theme.color100 })
118 |
119 | -- Indent
120 | vim.api.nvim_set_hl(0, "MiniIndentscopeSymbol", { fg = theme.color24 })
121 |
122 | -- Mason
123 | vim.api.nvim_set_hl(0, "MasonNormal", { bg = theme.color0 })
124 |
125 | -- Lazy
126 | vim.api.nvim_set_hl(0, "LazyNormal", { bg = theme.color0 })
127 | -- vim.api.nvim_set_hl(0, "LazyButtonActive", { bg = theme.color0, fg = theme.color89 })
128 | -- vim.api.nvim_set_hl(0, "LazyProgressDone", { bg = theme.color0, fg = theme.color89 })
129 | -- vim.api.nvim_set_hl(0, "LazyProgressTodo", { bg = theme.color0, fg = theme.color89 })
130 | end
131 |
132 | return M
133 |
--------------------------------------------------------------------------------
/lua/core/autocmds.lua:
--------------------------------------------------------------------------------
1 | local function augroup(name)
2 | return vim.api.nvim_create_augroup("nvim_" .. name, { clear = true })
3 | end
4 |
5 | vim.api.nvim_create_autocmd("BufWritePre", {
6 | pattern = "*",
7 | callback = function(args)
8 | require("conform").format({ bufnr = args.buf })
9 | end,
10 | })
11 |
12 | -- Check if we need to reload the file when it changed
13 | vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
14 | group = augroup("checktime"),
15 | command = "checktime",
16 | })
17 |
18 | -- Highlight on yank
19 | vim.api.nvim_create_autocmd("TextYankPost", {
20 | group = augroup("highlight_yank"),
21 | callback = function()
22 | vim.highlight.on_yank()
23 | end,
24 | })
25 | -- resize splits if window got resized
26 | vim.api.nvim_create_autocmd({ "VimResized" }, {
27 | group = augroup("resize_splits"),
28 | callback = function()
29 | local current_tab = vim.fn.tabpagenr()
30 | vim.cmd("tabdo wincmd =")
31 | vim.cmd("tabnext " .. current_tab)
32 | end,
33 | })
34 |
35 | -- go to last loc when opening a buffer
36 | vim.api.nvim_create_autocmd("BufReadPost", {
37 | group = augroup("last_loc"),
38 | callback = function(event)
39 | local exclude = { "gitcommit" }
40 | local buf = event.buf
41 | if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then
42 | return
43 | end
44 | vim.b[buf].lazyvim_last_loc = true
45 | local mark = vim.api.nvim_buf_get_mark(buf, '"')
46 | local lcount = vim.api.nvim_buf_line_count(buf)
47 | if mark[1] > 0 and mark[1] <= lcount then
48 | pcall(vim.api.nvim_win_set_cursor, 0, mark)
49 | end
50 | end,
51 | })
52 |
53 | -- close some filetypes with
54 | vim.api.nvim_create_autocmd("FileType", {
55 | group = augroup("close_with_q"),
56 | pattern = {
57 | "PlenaryTestPopup",
58 | "help",
59 | "lspinfo",
60 | "man",
61 | "notify",
62 | "qf",
63 | "query",
64 | "spectre_panel",
65 | "startuptime",
66 | "tsplayground",
67 | "neotest-output",
68 | "checkhealth",
69 | "neotest-summary",
70 | "neotest-output-panel",
71 | },
72 | callback = function(event)
73 | vim.bo[event.buf].buflisted = false
74 | vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true })
75 | end,
76 | })
77 |
78 | -- wrap and check for spell in text filetypes
79 | vim.api.nvim_create_autocmd("FileType", {
80 | group = augroup("wrap_spell"),
81 | pattern = { "gitcommit", "markdown" },
82 | callback = function()
83 | vim.opt_local.wrap = true
84 | vim.opt_local.spell = true
85 | end,
86 | })
87 |
88 | -- Auto create dir when saving a file, in case some intermediate directory does not exist
89 | vim.api.nvim_create_autocmd({ "BufWritePre" }, {
90 | group = augroup("auto_create_dir"),
91 | callback = function(event)
92 | if event.match:match("^%w%w+://") then
93 | return
94 | end
95 | local file = vim.loop.fs_realpath(event.match) or event.match
96 | vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
97 | end,
98 | })
99 |
100 | -- restore the session for the current directory
101 | vim.api.nvim_set_keymap("n", "'", [[lua require("persistence").load()]], {})
102 |
103 | -- restore the last session
104 | vim.api.nvim_set_keymap("n", "ql", [[lua require("persistence").load({ last = true })]], {})
105 |
106 | -- stop Persistence => session won't be saved on exit
107 | vim.api.nvim_set_keymap("n", "qd", [[lua require("persistence").stop()]], {})
108 |
--------------------------------------------------------------------------------
/lua/core/colors.lua:
--------------------------------------------------------------------------------
1 | local theme = {
2 | color29 = "#565656",
3 | color85 = "#808080",
4 | color92 = "#d8d8d8",
5 | color63 = "#1e2030",
6 | color57 = "#1f2335",
7 | color0 = "#1e1e2e",
8 | color01 = "#24273a",
9 | color02 = "#21222c",
10 | color64 = "#222436",
11 | color58 = "#24283b",
12 | color1 = "#282a36",
13 | color93 = "#2a2e40",
14 | color94 = "#292a30",
15 | color59 = "#292e42",
16 | color65 = "#2f334d",
17 | color95 = "#332e55",
18 | color96 = "#103234",
19 | color97 = "#404254",
20 | color61 = "#3b4261",
21 | color60 = "#414868",
22 | color66 = "#444a73",
23 | color2 = "#44475a",
24 | color04 = "#585b70",
25 | color05 = "#cdd6f4",
26 | color06 = "#6c7086",
27 | color24 = "#545c7e",
28 | color36 = "#394b70",
29 | color28 = "#565f89",
30 | color68 = "#828bb8",
31 | color26 = "#737aa2",
32 | color3 = "#6272a4",
33 | color03 = "#51afef",
34 | color62 = "#3d59a1",
35 | color70 = "#3e68d7",
36 | color67 = "#c8d3f5",
37 | color22 = "#c0caf5",
38 | color23 = "#a9b1d6",
39 | color98 = "#e0d8f4",
40 | color21 = "#f8f8f2",
41 | color83 = "#8aa2f7",
42 | color71 = "#82aaff",
43 | color69 = "#7a88cf",
44 | color72 = "#86e1fc",
45 | color73 = "#65bcff",
46 | color79 = "#41a6b5",
47 | color90 = "#51afef",
48 | color55 = "#536c9e",
49 | color38 = "#1098f8",
50 | color19 = "#8be9fd",
51 | color47 = "#41a6b5",
52 | color84 = "#10f0f0",
53 | color18 = "#26d7fd",
54 | color6 = "#8be9fd",
55 | color32 = "#2ac3de",
56 | color30 = "#7dcfff",
57 | color31 = "#6790eb",
58 | color33 = "#0db9d7",
59 | color34 = "#89ddff",
60 | color35 = "#b4f9f8",
61 | color37 = "#7aa2f7",
62 | color20 = "#b1f0fd",
63 | color54 = "#266d6a",
64 | color51 = "#1abc9c",
65 | color12 = "#96faaf",
66 | color7 = "#50fa7b",
67 | color13 = "#0dfa49",
68 | color17 = "#59b690",
69 | color48 = "#62ff00",
70 | color49 = "#73daca",
71 | color50 = "#10e070",
72 | color80 = "#4fd6be",
73 | color78 = "#c3e88d",
74 | color89 = "#A9FF68",
75 | color25 = "#c678dd",
76 | color5 = "#bd93f9",
77 | color8 = "#ffa6d9",
78 | color4 = "#ff33a8",
79 | color15 = "#ff79c6",
80 | color14 = "#8c42ab",
81 | color27 = "#ff8fff",
82 | color39 = "#bb9af7",
83 | color40 = "#ff007c",
84 | color74 = "#fca7ea",
85 | color75 = "#c099ff",
86 | color91 = "#D484FF",
87 | color86 = "#a9a1e1",
88 | color41 = "#c66bfe",
89 | color42 = "#9d7cd8",
90 | color43 = "#c34bfe",
91 | color44 = "#ff9e64",
92 | color9 = "#ffd4a6",
93 | color100 = "#f1fa8c",
94 | color101 = "#ffff0f",
95 | color10 = "#ffb86c",
96 | color11 = "#ff9c33",
97 | color77 = "#ffc777",
98 | color88 = "#F79000",
99 | color99 = "#FF8800",
100 | color45 = "#f1fa8c",
101 | color46 = "#e0af68",
102 | color76 = "#ff966c",
103 | color52 = "#db4b4b",
104 | color16 = "#ff5555",
105 | color81 = "#ff757f",
106 | color82 = "#c53b53",
107 | color87 = "#ec5f67",
108 | color53 = "#f7768e",
109 | color56 = "#b2555b",
110 | }
111 | return theme
112 |
--------------------------------------------------------------------------------
/lua/core/keymaps.lua:
--------------------------------------------------------------------------------
1 | local enable = require("config").enable
2 |
3 | vim.g.mapleader = " "
4 | local map = vim.api.nvim_set_keymap
5 |
6 | -- Saving and ESC on insert Mode
7 | map("i", "jj", "", { noremap = true, silent = true })
8 | -- map("i", "'", ",", { noremap = true, silent = true })
9 | -- map("n", "", ":lua vim.lsp.buf.format():w! | noh", { noremap = true, silent = true })
10 | -- map("n", "", ":lua require('format-on-save').format():w! | noh", { noremap = true, silent = true })
11 |
12 | -- Windows
13 | -- map("n", "", "p", { noremap = true, silent = true })
14 | -- map("n", "", "w", { noremap = true, silent = true })
15 | -- map("n", "", "l", { noremap = true, silent = true })
16 | -- map("n", "", "h", { noremap = true, silent = true })
17 | -- map("n", "", "k", { noremap = true, silent = true })
18 | -- map("n", "", "j", { noremap = true, silent = true })
19 | map("n", "", "x", { noremap = true, silent = true })
20 |
21 | -- Lua
22 | vim.keymap.set("n", "rs", require("substitute").operator, { noremap = true })
23 | vim.keymap.set("n", "rss", require("substitute").line, { noremap = true })
24 | vim.keymap.set("n", "rS", require("substitute").eol, { noremap = true })
25 | vim.keymap.set("x", "rs", require("substitute").visual, { noremap = true })
26 |
27 | --[[ map("n", "