├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .jukit └── .jukit_info.json ├── after ├── ftplugin │ ├── cpp.vim │ ├── go.vim │ ├── haskell.lua │ ├── help.vim │ ├── json.vim │ ├── jsonc.vim │ ├── julia.lua │ ├── lua.lua │ ├── make.vim │ ├── markdown.vim │ ├── norg.lua │ ├── octo.lua │ ├── proto.vim │ ├── python.lua │ ├── qf.lua │ ├── sql.vim │ ├── toml.lua │ ├── vim.vim │ ├── yaml.vim │ └── zig.vim ├── indent │ ├── python.vim │ └── typescriptreact.vim ├── plugin │ ├── after_lsp.lua │ └── python-env.lua ├── queries │ ├── c │ │ └── highlights.scm │ ├── comment │ │ └── highlights.scm │ ├── cpp │ │ └── highlights.scm │ ├── go │ │ └── highlights.scm │ ├── java │ │ └── highlights.scm │ ├── javascript │ │ └── highlights.scm │ ├── lua │ │ └── highlights.scm │ ├── luap │ │ └── highlights.scm │ ├── proto │ │ ├── folds.scm │ │ └── highlights.scm │ ├── python │ │ └── highlights.scm │ └── rust │ │ └── highlights.scm └── syntax │ ├── jsonc.vim │ ├── log.vim │ ├── make.vim │ ├── qf.lua │ └── sh.lua ├── dotfyle.json ├── init.lua ├── lua ├── core │ ├── _utils.lua │ ├── after_init.lua │ ├── autocmd.lua │ ├── autocmd_optional.lua │ ├── cmd.lua │ ├── globals.lua │ ├── helper.lua │ ├── init.lua │ ├── options.lua │ └── pack.lua ├── keymaps │ └── init.lua ├── lambda │ ├── event.lua │ ├── fzf.lua │ ├── helper.lua │ ├── highlights.lua │ ├── init.lua │ ├── options.lua │ └── styles.lua ├── lazy_specs │ ├── ai │ │ └── init.lua │ ├── buffer │ │ └── init.lua │ ├── care │ │ ├── config.lua │ │ └── init.lua │ ├── clipboard │ │ └── init.lua │ ├── docs │ │ ├── config.lua │ │ └── init.lua │ ├── folke │ │ ├── config.lua │ │ ├── init.lua │ │ └── noice.lua │ ├── git │ │ └── init.lua │ ├── hydra │ │ ├── api │ │ │ ├── ai.lua │ │ │ ├── browse.lua │ │ │ ├── buffer.lua │ │ │ ├── commentbox.lua │ │ │ ├── dap.lua │ │ │ ├── docs_neotest.lua │ │ │ ├── fold.lua │ │ │ ├── genghis.lua │ │ │ ├── git.lua │ │ │ ├── harpoon.lua │ │ │ ├── neotest.lua │ │ │ ├── octo.lua │ │ │ ├── parenth_mode.lua │ │ │ ├── python.lua │ │ │ ├── refactor.lua │ │ │ ├── runner.lua │ │ │ ├── sad.lua │ │ │ ├── swap_surf.lua │ │ │ ├── telescope.lua │ │ │ ├── temp_file │ │ │ ├── test_gen.lua │ │ │ └── tmux.lua │ │ ├── hydra_utils.lua │ │ ├── junk │ │ │ ├── api_ai.lua │ │ │ ├── git.lua │ │ │ ├── readme.md │ │ │ └── repl_python.lua │ │ ├── make_hydra.lua │ │ ├── normal │ │ │ ├── repl.lua │ │ │ ├── tab.lua │ │ │ ├── text_case.lua │ │ │ ├── vim_options.lua │ │ │ ├── window.lua │ │ │ └── yanky.lua │ │ ├── readme.norg │ │ ├── repl_utils.lua │ │ ├── setup.lua │ │ └── utils_rewrite.lua │ ├── init.lua │ ├── lsp │ │ └── init.lua │ ├── misc │ │ └── init.lua │ ├── movement │ │ ├── config.lua │ │ ├── emergency_harpoon_string.lua │ │ ├── flash │ │ │ ├── keybinds │ │ │ │ ├── asterisk.lua │ │ │ │ ├── init.lua │ │ │ │ ├── jump.lua │ │ │ │ ├── lsp.lua │ │ │ │ ├── misc.lua │ │ │ │ └── treesitter.lua │ │ │ ├── nav │ │ │ │ └── lib.lua │ │ │ ├── readme.md │ │ │ └── setup.lua │ │ ├── harpoon.lua │ │ ├── init.lua │ │ ├── leap.lua │ │ ├── leap.old.lua │ │ ├── plugins.lua │ │ └── syntax_surfer.lua │ ├── notes │ │ ├── config.lua │ │ ├── init.lua │ │ ├── neorg.lua │ │ ├── neorg.norg │ │ └── norg │ │ │ ├── autocmd.lua │ │ │ ├── commands.lua │ │ │ ├── keybinds.lua │ │ │ └── utils.lua │ ├── runner │ │ └── init.lua │ ├── tools │ │ └── init.lua │ ├── treesitter │ │ └── init.lua │ ├── ui │ │ ├── config.lua │ │ └── init.lua │ ├── user │ │ └── init.lua │ └── windows │ │ └── init.lua ├── overseer │ ├── component │ │ └── user │ │ │ ├── attach_toggleterm.lua │ │ │ ├── dispose_now.lua │ │ │ ├── init.lua │ │ │ ├── load_prof.lua │ │ │ ├── send_on_open.lua │ │ │ └── start_open.lua │ └── template │ │ └── user │ │ ├── config.lua │ │ ├── haskell.lua │ │ ├── init.lua │ │ ├── julia.lua │ │ ├── logs.lua │ │ ├── misc.lua │ │ ├── python.lua │ │ ├── run_bins.lua │ │ ├── runners.lua │ │ └── track_history.lua ├── plugins │ ├── completion │ │ ├── cmp │ │ │ ├── config.lua │ │ │ ├── extra.lua │ │ │ ├── init.lua │ │ │ ├── mappings.lua │ │ │ ├── sources.lua │ │ │ └── utils.lua │ │ ├── config.lua │ │ ├── init.lua │ │ └── snippets │ │ │ ├── all.lua │ │ │ ├── choice_popup.lua │ │ │ ├── init.lua │ │ │ ├── latex │ │ │ ├── tex.lua │ │ │ └── tex_math.lua │ │ │ ├── luasnip.lua │ │ │ └── sniputils.lua │ ├── documentation │ │ ├── config.lua │ │ └── plugins.lua │ ├── editor │ │ ├── config.lua │ │ ├── init.lua │ │ └── plugins.lua │ ├── fun │ │ └── plugins.lua │ ├── git │ │ ├── config.lua │ │ └── plugins.lua │ ├── init.lua │ ├── lang │ │ ├── config.lua │ │ ├── dap │ │ │ └── init.lua │ │ ├── init.lua │ │ └── plugins.lua │ ├── lsp │ │ ├── config.lua │ │ ├── init.lua │ │ ├── lint_format.lua │ │ └── lsp │ │ │ ├── config │ │ │ ├── capabilities.lua │ │ │ ├── config.lua │ │ │ └── init.lua │ │ │ ├── mason │ │ │ ├── init.lua │ │ │ ├── lsp_servers.lua │ │ │ └── python.lua │ │ │ ├── null-ls │ │ │ └── with.lua │ │ │ ├── providers │ │ │ ├── c.lua │ │ │ ├── julials.lua │ │ │ ├── latex │ │ │ │ ├── ltex.lua │ │ │ │ └── texlab.lua │ │ │ └── python │ │ │ │ ├── basedpyright.lua │ │ │ │ ├── jedi_language_server.lua │ │ │ │ ├── pylance.lua │ │ │ │ ├── pylsp.lua │ │ │ │ ├── pylyzer.lua │ │ │ │ ├── python_lsp_server.lua │ │ │ │ ├── ruff.lua │ │ │ │ ├── sourcery.lua │ │ │ │ └── utils │ │ │ │ ├── init.lua │ │ │ │ └── python_help.lua │ │ │ └── utils.lua │ ├── mini │ │ ├── config.lua │ │ └── plugins.lua │ ├── python │ │ ├── config.lua │ │ ├── init.lua │ │ └── plugins.lua │ ├── runner │ │ └── init.lua │ ├── search │ │ ├── config.lua │ │ ├── init.lua │ │ ├── plugins.lua │ │ └── telescope │ │ │ ├── telescope.lua │ │ │ └── telescope_commands.lua │ ├── startup │ │ └── init.lua │ ├── test │ │ ├── config.lua │ │ ├── init.lua │ │ └── misc │ │ │ └── init.lua │ ├── tmux │ │ └── plugins.lua │ ├── tools │ │ ├── config.lua │ │ ├── plugins.lua │ │ └── toggleterm.lua │ ├── tpope │ │ └── plugins.lua │ ├── treesitter │ │ ├── config.lua │ │ ├── init.lua │ │ ├── plugins.lua │ │ └── treesitter.lua │ ├── ui │ │ ├── heirline │ │ │ ├── statuscolumn.lua │ │ │ ├── statusline.lua │ │ │ └── winbar.lua │ │ └── init.lua │ ├── user │ │ └── plugins.lua │ └── windows │ │ ├── config.lua │ │ └── plugins.lua ├── rocks_bulk_install.lua ├── rocks_utils │ ├── init.lua │ ├── rocks.lua │ └── utils.lua ├── utils │ ├── abbreviations │ │ ├── dictionary.lua │ │ └── utils.lua │ ├── extended_lib │ │ └── helpers.lua │ ├── helpers │ │ ├── asyncmake.lua │ │ ├── git.lua │ │ ├── helper.lua │ │ └── selfunc.lua │ ├── logs │ │ └── log.lua │ ├── plugins │ │ ├── abbreviations.lua │ │ ├── auto_normal.lua │ │ ├── croc.lua │ │ ├── cursor.lua │ │ ├── custom_neorg_save.lua │ │ ├── numbers.lua │ │ ├── save_clipboard_on_exit.lua │ │ ├── scratch.lua │ │ └── stalk.lua │ ├── telescope.lua │ ├── treesitter_utils.lua │ └── ui │ │ ├── highlights.lua │ │ └── kind.lua └── vscripts │ └── init.lua ├── lux.toml ├── plugin ├── env.lua ├── filetypes.lua ├── lastplace.lua ├── lsp.lua ├── number.lua └── test intro.lua ├── readme.md ├── rocks.toml ├── rocks_update.lua ├── scripts ├── diffdir.vim ├── log-autocmds.vim ├── sort.vim └── tools.vim ├── snippets ├── conf.json ├── lua.json ├── lua │ ├── generated.lua │ └── lua.lua ├── norg │ └── norg.lua ├── package.json ├── python.json ├── python │ ├── generated.lua │ └── python.lua └── snip │ ├── lua.json │ └── package.json ├── spell ├── en.utf-8.add ├── en.utf-8.add.spl ├── en.utf-8.spl └── en.utf-8.sug ├── startup ├── hyperfine.sh ├── quick_startup_test.sh ├── startup.sh └── tmp ├── test_updater.lua └── updater.lua /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | pull_request: 9 | branches: 10 | - main 11 | 12 | jobs: 13 | lint: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v3 18 | 19 | - name: Stylua 20 | uses: JohnnyMorganz/stylua-action@v1.1.2 21 | with: 22 | token: ${{ secrets.GITHUB_TOKEN }} 23 | args: --check . 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | log 4 | tags 5 | *.ti 6 | ytmmusic_auth 7 | test.* 8 | *.py 9 | -------------------------------------------------------------------------------- /.jukit/.jukit_info.json: -------------------------------------------------------------------------------- 1 | {"terminal": "kitty"} -------------------------------------------------------------------------------- /after/ftplugin/cpp.vim: -------------------------------------------------------------------------------- 1 | setlocal shiftwidth=2 2 | setlocal foldmethod=indent 3 | -------------------------------------------------------------------------------- /after/ftplugin/go.vim: -------------------------------------------------------------------------------- 1 | setlocal iskeyword+=" 2 | setlocal noexpandtab 3 | setlocal shiftwidth=4 4 | setlocal softtabstop=4 5 | setlocal tabstop=4 6 | -------------------------------------------------------------------------------- /after/ftplugin/haskell.lua: -------------------------------------------------------------------------------- 1 | local ht = require("haskell-tools") 2 | local buffer = vim.api.nvim_get_current_buf() 3 | local def_opts = { noremap = true, silent = true } 4 | ht.start_or_attach({ 5 | hls = { 6 | on_attach = function(client, bufnr) 7 | local opts = vim.tbl_extend("keep", def_opts, { buffer = bufnr }) 8 | -- haskell-language-server relies heavily on codeLenses, 9 | -- so auto-refresh (see advanced configuration) is enabled by default 10 | vim.keymap.set("n", "ca", vim.lsp.codelens.run, opts) 11 | vim.keymap.set("n", "hs", ht.hoogle.hoogle_signature, opts) 12 | vim.keymap.set("n", "ea", ht.lsp.buf_eval_all, opts) 13 | end, 14 | }, 15 | }) 16 | 17 | -- Suggested keymaps that do not depend on haskell-language-server: 18 | local bufnr = vim.api.nvim_get_current_buf() 19 | -- set buffer = bufnr in ftplugin/haskell.lua 20 | local opts = { noremap = true, silent = true, buffer = bufnr } 21 | 22 | -- Toggle a GHCi repl for the current package 23 | vim.keymap.set("n", "rr", ht.repl.toggle, opts) 24 | -- Toggle a GHCi repl for the current buffer 25 | vim.keymap.set("n", "rf", function() 26 | ht.repl.toggle(vim.api.nvim_buf_get_name(0)) 27 | end, def_opts) 28 | vim.keymap.set("n", "rq", ht.repl.quit, opts) 29 | -------------------------------------------------------------------------------- /after/ftplugin/help.vim: -------------------------------------------------------------------------------- 1 | setlocal nonumber norelativenumber nolist 2 | setlocal colorcolumn= 3 | setlocal concealcursor=nc 4 | 5 | ""---------------------------------------------------------------------------// 6 | " Credit: Tweekmonster! 7 | ""---------------------------------------------------------------------------// 8 | " if this a vim help file rather than one I'm creating 9 | " add mappings otherwise do not 10 | if expand('%') =~# '^'.$VIMRUNTIME || &readonly 11 | autocmd BufWinEnter wincmd L | vertical resize 80 12 | nnoremap q :q 13 | nnoremap 14 | nnoremap 15 | nnoremap o /'\l\{2,\}' 16 | nnoremap O ?'\l\{2,\}' 17 | nnoremap s /\|\zs\S\+\ze\| 18 | nnoremap S ?\|\zs\S\+\ze\| 19 | finish 20 | else 21 | setlocal spell spelllang=en_gb 22 | endif 23 | 24 | setlocal formatexpr=HelpFormatExpr() 25 | 26 | nnoremap r :call right_align() 27 | nnoremap ml maGovim:tw=78:ts=8:noet:ft=help:norl:`a 28 | 29 | if exists('*HelpFormatExpr') 30 | finish 31 | endif 32 | 33 | 34 | function! s:right_align() abort 35 | let text = matchstr(getline('.'), '^\s*\zs.\+\ze\s*$') 36 | let remainder = (&l:textwidth + 1) - len(text) 37 | call setline(line('.'), repeat(' ', remainder).text) 38 | undojoin 39 | endfunction 40 | 41 | 42 | function! HelpFormatExpr() abort 43 | if mode() ==# 'i' || v:char != '' 44 | return 1 45 | endif 46 | 47 | let line = getline(v:lnum) 48 | if line =~# '^=\+$' 49 | normal! macc 50 | normal! 78i= 51 | normal! `a 52 | undojoin 53 | return 54 | elseif line =~# '^\k\%(\k\|\s\)\+\s*\*\%(\k\|-\)\+\*\s*' 55 | let [header, link] = split(line, '^\k\%(\k\|\s\)\+\zs\s*') 56 | let header = substitute(header, '^\_s*\|\_s*$', '', 'g') 57 | let remainder = (&l:textwidth + 1) - len(header) - len(link) 58 | let line = header.repeat(' ', remainder).link 59 | call setline(v:lnum, line) 60 | return 61 | endif 62 | 63 | return 1 64 | endfunction -------------------------------------------------------------------------------- /after/ftplugin/json.vim: -------------------------------------------------------------------------------- 1 | setlocal autoindent 2 | setlocal conceallevel=0 3 | setlocal expandtab 4 | setlocal foldmethod=indent 5 | setlocal formatoptions=tcq2l 6 | setlocal shiftwidth=4 7 | setlocal softtabstop=4 8 | setlocal tabstop=8 9 | 10 | let s:bufname = expand('%:e') 11 | if s:bufname && s:bufname ==# 'jsonschema' 12 | setlocal shiftwidth=2 13 | setlocal softtabstop=2 14 | setlocal tabstop=4 15 | endif 16 | -------------------------------------------------------------------------------- /after/ftplugin/jsonc.vim: -------------------------------------------------------------------------------- 1 | setlocal autoindent 2 | setlocal conceallevel=0 3 | setlocal expandtab 4 | setlocal foldmethod=syntax 5 | setlocal formatoptions=tcq2l 6 | setlocal shiftwidth=2 7 | setlocal softtabstop=2 8 | setlocal tabstop=4 9 | -------------------------------------------------------------------------------- /after/ftplugin/julia.lua: -------------------------------------------------------------------------------- 1 | vim.g.navic_silence = true 2 | 3 | local options = { 4 | textwidth = 92, 5 | expandtab = true, 6 | smarttab = true, 7 | } 8 | 9 | for k, v in pairs(options) do 10 | vim.o[k] = v 11 | end 12 | -------------------------------------------------------------------------------- /after/ftplugin/lua.lua: -------------------------------------------------------------------------------- 1 | vim.treesitter.start() 2 | local fn = vim.fn 3 | local fmt = string.format 4 | 5 | local function find(word, ...) 6 | for _, str in ipairs({ ... }) do 7 | local match_start, match_end = string.find(word, str) 8 | if match_start then 9 | return str, match_start, match_end 10 | end 11 | end 12 | end 13 | 14 | --- Stolen from nlua.nvim this function attempts to open 15 | --- vim help docs if an api or vim.fn function otherwise it 16 | --- shows the lsp hover doc 17 | --- @param word string 18 | --- @param callback function 19 | local function keyword(word, callback) 20 | local original_iskeyword = vim.bo.iskeyword 21 | 22 | vim.bo.iskeyword = vim.bo.iskeyword .. ",." 23 | word = word or fn.expand("") 24 | 25 | vim.bo.iskeyword = original_iskeyword 26 | 27 | -- TODO: This is a sub par work around, since I usually rename `vim.api` -> `api` or similar 28 | -- consider maybe using treesitter in the future 29 | local api_match = find(word, "api", "vim.api") 30 | local fn_match = find(word, "fn", "vim.fn") 31 | if api_match then 32 | local _, finish = string.find(word, api_match .. ".") 33 | local api_function = string.sub(word, finish + 1) 34 | 35 | vim.cmd(string.format("help %s", api_function)) 36 | return 37 | elseif fn_match then 38 | local _, finish = string.find(word, fn_match .. ".") 39 | if not finish then 40 | return 41 | end 42 | local api_function = string.sub(word, finish + 1) .. "()" 43 | 44 | vim.cmd(string.format("help %s", api_function)) 45 | return 46 | elseif callback then 47 | callback() 48 | else 49 | vim.lsp.buf.hover() 50 | end 51 | end 52 | 53 | vim.keymap.set("n", "gK", keyword, { buffer = 0 }) 54 | vim.opt_local.textwidth = 100 55 | vim.opt_local.formatoptions:remove("o") 56 | vim.o.smarttab = true 57 | vim.o.colorcolumn = "130" 58 | -------------------------------------------------------------------------------- /after/ftplugin/make.vim: -------------------------------------------------------------------------------- 1 | setlocal noexpandtab 2 | " https://mattn.kaoriya.net/software/vim/20070821175457.htm 3 | setlocal isfname-== isfname+=32 isfname-=I isfname-=L 4 | setlocal shiftwidth=2 5 | setlocal softtabstop=2 6 | setlocal tabstop=2 -------------------------------------------------------------------------------- /after/ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | set expandtab " タブ入力を複数の空白入力に置き換える 2 | set tabstop=2 " 画面上でタブ文字が占める幅 3 | set softtabstop=2 " 連続した空白に対してタブキーやバックスペースキーでカーソルが動く幅 4 | set autoindent " 改行時に前の行のインデントを継続する 5 | set smartindent " 改行時に前の行の構文をチェックし次の行のインデントを増減する 6 | set smarttab " Makes tabbing smarter will realize you have 2 vs 2 7 | set shiftwidth=2 " smartindentで増減する幅 8 | set formatoptions-=cro 9 | -------------------------------------------------------------------------------- /after/ftplugin/norg.lua: -------------------------------------------------------------------------------- 1 | -- vim.opt.number = true 2 | vim.treesitter.start() 3 | -- Local 4 | 5 | vim.o.wrap = true 6 | vim.o.linebreak = true 7 | vim.o.smartindent = true 8 | vim.o.autoindent = true 9 | vim.o.breakindentopt = "list:-1" 10 | vim.o.formatlistpat = [[^\s*[-\*\~]\+[\.\)]*\s\+]] 11 | 12 | vim.o.colorcolumn = "180" 13 | vim.bo.textwidth = 180 14 | -------------------------------------------------------------------------------- /after/ftplugin/octo.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_buf_set_keymap(0, "i", "@", "@", { silent = true, noremap = true }) 2 | vim.api.nvim_buf_set_keymap(0, "i", "#", "#", { silent = true, noremap = true }) 3 | -------------------------------------------------------------------------------- /after/ftplugin/proto.vim: -------------------------------------------------------------------------------- 1 | setlocal cindent 2 | setlocal expandtab 3 | setlocal shiftwidth=2 4 | -------------------------------------------------------------------------------- /after/ftplugin/python.lua: -------------------------------------------------------------------------------- 1 | vim.treesitter.start() 2 | local options = { 3 | tabstop = 4, 4 | shiftwidth = 4, 5 | expandtab = true, 6 | smarttab = true, 7 | conceallevel = 2, 8 | colorcolumn = "150", 9 | foldmethod = "syntax", 10 | } 11 | 12 | for k, v in pairs(options) do 13 | vim.o[k] = v 14 | end 15 | 16 | local switch_definitions = [[ 17 | let b:switch_custom_definitions = [ 18 | { 19 | 'print\s\+\(.*\)': 'print(\1)', 20 | 'print(\([^)]*\))': 'print \1', 21 | 'is\s\(not\)\@!': 'is not ', 22 | 'is\snot': 'is', 23 | } 24 | ] 25 | ]] 26 | vim.cmd(switch_definitions:gsub("\n", "")) 27 | 28 | vim.g.magma_automatically_open_output = false 29 | vim.g.magma_image_provider = "kitty" 30 | vim.cmd([[ 31 | filetype plugin on 32 | setlocal include=^\\s*\\(from\\\|import\\) 33 | setlocal includeexpr=substitute(v:fname,'\\.','/','g') 34 | ]]) 35 | local keys = { 36 | { 37 | "", 38 | function() 39 | require("python_import.api").add_import_current_word_and_notify() 40 | end, 41 | mode = { "i", "n" }, 42 | silent = true, 43 | desc = "Add python import", 44 | ft = "python", 45 | }, 46 | { 47 | "", 48 | function() 49 | require("python_import.api").add_import_current_selection_and_notify() 50 | end, 51 | mode = "x", 52 | silent = true, 53 | desc = "Add python import", 54 | ft = "python", 55 | }, 56 | { 57 | "i", 58 | function() 59 | require("python_import.api").add_import_current_word_and_move_cursor() 60 | end, 61 | mode = "n", 62 | silent = true, 63 | desc = "Add python import and move cursor", 64 | ft = "python", 65 | }, 66 | { 67 | "i", 68 | function() 69 | require("python_import.api").add_import_current_selection_and_move_cursor() 70 | end, 71 | mode = "x", 72 | silent = true, 73 | desc = "Add python import and move cursor", 74 | ft = "python", 75 | }, 76 | { 77 | "tr", 78 | function() 79 | require("python_import.api").add_rich_traceback() 80 | end, 81 | silent = true, 82 | desc = "Add rich traceback", 83 | ft = "python", 84 | mode = { "n", "x" }, 85 | }, 86 | } 87 | 88 | for _, key in ipairs(keys) do 89 | vim.keymap.set(key.mode, key[1], key[2], { 90 | silent = key.silent, 91 | desc = key.desc, 92 | buffer = 0, 93 | expr = key.expr, 94 | remap = key.remap, 95 | }) 96 | end 97 | -------------------------------------------------------------------------------- /after/ftplugin/qf.lua: -------------------------------------------------------------------------------- 1 | local opt = vim.opt_local 2 | 3 | opt.wrap = false 4 | opt.number = false 5 | opt.signcolumn = "yes" 6 | opt.buflisted = false 7 | opt.winfixheight = true 8 | 9 | vim.keymap.set("n", "dd", lambda.list.qf.delete, { desc = "delete current quickfix entry", buffer = 0 }) 10 | vim.keymap.set("v", "d", lambda.list.qf.delete, { desc = "delete selected quickfix entry", buffer = 0 }) 11 | vim.keymap.set("n", "H", ":colder", { buffer = 0 }) 12 | vim.keymap.set("n", "L", ":cnewer", { buffer = 0 }) 13 | -- force quickfix to open beneath all other splits 14 | vim.cmd.wincmd("J") 15 | 16 | lambda.adjust_split_height(3, 10) 17 | -------------------------------------------------------------------------------- /after/ftplugin/sql.vim: -------------------------------------------------------------------------------- 1 | set syntax=on 2 | runtime syntax/sql.vim 3 | runtime syntax/plsql.vim -------------------------------------------------------------------------------- /after/ftplugin/toml.lua: -------------------------------------------------------------------------------- 1 | vim.treesitter.start() 2 | -------------------------------------------------------------------------------- /after/ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | setlocal colorcolumn=120 2 | setlocal iskeyword+=:,# 3 | setlocal tags+=$DATA_PATH/tags 4 | setlocal autoindent 5 | setlocal conceallevel=0 6 | setlocal expandtab 7 | setlocal foldmethod=indent 8 | setlocal formatoptions=tcq2l 9 | setlocal shiftwidth=2 10 | setlocal softtabstop=2 11 | setlocal tabstop=4 12 | -------------------------------------------------------------------------------- /after/ftplugin/yaml.vim: -------------------------------------------------------------------------------- 1 | setlocal autoindent 2 | setlocal expandtab 3 | setlocal indentkeys-=<:> 4 | setlocal iskeyword+=-,$,# 5 | setlocal shiftwidth=2 6 | setlocal softtabstop=2 7 | setlocal tabstop=2 8 | -------------------------------------------------------------------------------- /after/ftplugin/zig.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | setlocal tabstop=8 3 | setlocal softtabstop=4 4 | setlocal shiftwidth=4 5 | -------------------------------------------------------------------------------- /after/plugin/after_lsp.lua: -------------------------------------------------------------------------------- 1 | -- vim.cmd([[ 2 | -- imap u[s1z=`]au 3 | -- imap mtis`tla 4 | -- nmap [s1z= 5 | -- ]]) 6 | -------------------------------------------------------------------------------- /after/plugin/python-env.lua: -------------------------------------------------------------------------------- 1 | local function get_std_envs() 2 | local envs = {} 3 | if vim.env.VIRTUAL_ENV then 4 | envs["VIRTUAL_ENV"] = table.concat({ vim.env.VIRTUAL_ENV, "bin", "python" }, "/") 5 | end 6 | local sys = vim.fn.exepath("python3") or vim.fn.exepath("python") or "/bin/python" 7 | envs["System"] = sys 8 | return envs 9 | end 10 | 11 | local function get_poetry_envs() 12 | local envs = {} 13 | local venv = vim.fn.trim(vim.fn.system("poetry env list --full-path")) 14 | for match in string.gmatch(venv, "[%w%/%.%-]*virtualenv[%w%/%.%-]*") do 15 | local split = vim.fn.split(match, "/") 16 | envs["Poetry: " .. split[#split]] = table.concat({ match, "bin", "python" }, "/") 17 | end 18 | return envs 19 | end 20 | 21 | local function get_python_client() 22 | local pylance = vim.lsp.get_clients({ name = "pylance" }) 23 | local pyright = vim.lsp.get_clients({ name = "pyright" }) 24 | local clients = vim.tbl_extend("force", pylance, pyright) 25 | if #clients > 0 then 26 | return clients[1] 27 | end 28 | end 29 | 30 | local function env_handler() 31 | local client = get_python_client() 32 | if not client then 33 | vim.notify("No python clients found") 34 | end 35 | local options = vim.tbl_extend("force", get_std_envs(), get_poetry_envs()) 36 | local settings = client.config.settings 37 | local active = settings.python.pythonPath 38 | vim.ui.select(vim.tbl_keys(options), { 39 | prompt = "Select a Python Environment:", 40 | format_item = function(item) 41 | if options[item] == active then 42 | return item .. " (Active)" 43 | end 44 | return item 45 | end, 46 | }, function(selected) 47 | if selected then 48 | settings.python.pythonPath = options[selected] 49 | client.notify("workspace/didChangeConfiguration", { settings = settings }) 50 | end 51 | end) 52 | end 53 | 54 | vim.api.nvim_create_user_command("PythonEnv", env_handler, {}) 55 | -------------------------------------------------------------------------------- /after/queries/c/highlights.scm: -------------------------------------------------------------------------------- 1 | ( 2 | function_definition 3 | (function_declarator 4 | (identifier)@function_definition 5 | ) 6 | ) 7 | -------------------------------------------------------------------------------- /after/queries/comment/highlights.scm: -------------------------------------------------------------------------------- 1 | (tag ((name) @_name (#match? @_name "TODO") (":" @CommentTasksTodo))) 2 | (tag ((name) @_name (#match? @_name "FIXME") (":" @CommentTasksFixme))) 3 | (tag ((name) @_name (#match? @_name "NOTE") (":" @CommentTasksNote))) 4 | -------------------------------------------------------------------------------- /after/queries/cpp/highlights.scm: -------------------------------------------------------------------------------- 1 | ( 2 | function_definition 3 | (function_declarator 4 | ( 5 | identifier 6 | )@function_definition 7 | ) 8 | ) -------------------------------------------------------------------------------- /after/queries/go/highlights.scm: -------------------------------------------------------------------------------- 1 | ( 2 | function_declaration 3 | (identifier)@function_definition 4 | ) -------------------------------------------------------------------------------- /after/queries/java/highlights.scm: -------------------------------------------------------------------------------- 1 | ( 2 | method_declaration 3 | (identifier)@function_definition 4 | ) -------------------------------------------------------------------------------- /after/queries/javascript/highlights.scm: -------------------------------------------------------------------------------- 1 | ( 2 | function_declaration 3 | (identifier)@function_definition 4 | ) -------------------------------------------------------------------------------- /after/queries/lua/highlights.scm: -------------------------------------------------------------------------------- 1 | ( 2 | (function_call 3 | (identifier) @require_call 4 | (#match? @require_call "require") 5 | ) 6 | (set! "priority" 105) 7 | ) 8 | 9 | ( 10 | (function_call 11 | (identifier) @pairs 12 | (#match? @pairs "pairs") 13 | ) 14 | (set! "priority" 105) 15 | ) 16 | 17 | (function_declaration 18 | (identifier)@function_definition 19 | ) 20 | ( 21 | (function_declaration 22 | (dot_index_expression 23 | (identifier) 24 | (identifier)@function_definition 25 | ) 26 | ) 27 | (set! "priority" 105) 28 | ) 29 | 30 | ( 31 | (assignment_statement 32 | (variable_list 33 | (identifier)@function_definition 34 | ) 35 | ( 36 | expression_list 37 | (function_definition) 38 | ) 39 | ) 40 | (set! "priority" 105) 41 | ) 42 | ( 43 | (assignment_statement 44 | (variable_list 45 | (dot_index_expression 46 | (identifier) 47 | (identifier)@function_definition 48 | ) 49 | ) 50 | ( 51 | expression_list 52 | (function_definition) 53 | ) 54 | ) 55 | (set! "priority" 105) 56 | ) 57 | 58 | ; https://github.com/shift-d/nvim/tree/main/queries 59 | 60 | (("return" @keyword) (#set! conceal "")) 61 | (("function" @keyword) (#set! conceal "ﬦ")) 62 | 63 | 64 | ;; Function names 65 | ((function_call name: (identifier) @function (#eq? @function "require")) (#set! conceal "")) 66 | 67 | ;; vim.*;; table. 68 | ((dot_index_expression table: (identifier) @keyword (#eq? @keyword "math" )) (#set! conceal "")) 69 | 70 | (((dot_index_expression) @keyword (#eq? @keyword "vim.cmd" )) (#set! conceal "")) 71 | 72 | (((dot_index_expression) @keyword (#eq? @keyword "lambda" )) (#set! conceal "ﬦ")) 73 | 74 | ((dot_index_expression table: (identifier) @keyword (#eq? @keyword "lambda" )) (#set! conceal "ﬦ")) 75 | -------------------------------------------------------------------------------- /after/queries/luap/highlights.scm: -------------------------------------------------------------------------------- 1 | (character)@string 2 | (set(range)@keyword) 3 | (negated_set(range)@keyword) 4 | (class)@keyword 5 | (one_or_more)@quantifier 6 | (zero_or_more)@quantifier 7 | (zero_or_one)@quantifier 8 | (shortest_zero_or_more)@quantifier -------------------------------------------------------------------------------- /after/queries/proto/folds.scm: -------------------------------------------------------------------------------- 1 | [ 2 | (enum) 3 | (message) 4 | (service) 5 | ] @fold 6 | -------------------------------------------------------------------------------- /after/queries/proto/highlights.scm: -------------------------------------------------------------------------------- 1 | [ 2 | "syntax" 3 | "package" 4 | "option" 5 | "import" 6 | "service" 7 | "rpc" 8 | "returns" 9 | "message" 10 | "enum" 11 | "oneof" 12 | "repeated" 13 | "reserved" 14 | "to" 15 | ] @keyword 16 | 17 | [ 18 | (key_type) 19 | (type) 20 | (message_name) 21 | (enum_name) 22 | (service_name) 23 | (rpc_name) 24 | ]@type 25 | 26 | (string) @string 27 | 28 | [ 29 | (int_lit) 30 | (float_lit) 31 | ] @number 32 | 33 | [ 34 | (true) 35 | (false) 36 | ] @constant.builtin 37 | 38 | (comment) @comment 39 | 40 | [ 41 | "(" 42 | ")" 43 | "[" 44 | "]" 45 | "{" 46 | "}" 47 | ] @punctuation.bracket 48 | 49 | -------------------------------------------------------------------------------- /after/queries/python/highlights.scm: -------------------------------------------------------------------------------- 1 | ;; extends 2 | 3 | ; Import highlight groups 4 | (import_statement 5 | name: (dotted_name 6 | (identifier) @EpicImportModule 7 | ) 8 | ) 9 | 10 | (import_statement 11 | name: (aliased_import 12 | name: (dotted_name 13 | (identifier) @EpicImportModule 14 | ) 15 | alias: (identifier) @EpicImportModule 16 | ) 17 | ) 18 | 19 | (import_from_statement 20 | module_name: (dotted_name 21 | (identifier) @EpicImportModule 22 | ) 23 | name: (dotted_name 24 | (identifier) @EpicImportModule 25 | ) 26 | ) 27 | 28 | (import_from_statement 29 | module_name: (dotted_name 30 | (identifier) @EpicImportModule 31 | ) 32 | name: (aliased_import 33 | name: (dotted_name 34 | (identifier) @EpicImportModule 35 | ) 36 | alias: (identifier) @EpicImportModule 37 | ) 38 | ) 39 | 40 | -------------------------------------------------------------------------------- /after/queries/rust/highlights.scm: -------------------------------------------------------------------------------- 1 | ( 2 | function_item 3 | ( 4 | identifier 5 | )@function_definition 6 | ) 7 | 8 | ; https://github.com/shift-d/nvim/tree/main/queries 9 | (("->" @operator) (#set! conceal "")) 10 | (("=>" @operator) (#set! conceal "")) 11 | (("fn" @keyword.function) (#set! conceal "ﬦ")) 12 | 13 | (("struct" @keyword) (#set! conceal "ﴯ")) 14 | (("enum" @keyword) (#set! conceal "")) 15 | (("let" @keyword) (#set! conceal "~")) 16 | (("impl" @keyword) (#set! conceal "ﰠ")) 17 | (("type" @keyword) (#set! conceal "")) 18 | (("use" @keyword) (#set! conceal "")) 19 | (("mod" @keyword) (#set! conceal "ﮅ")) 20 | (((visibility_modifier) @keyword) (#set! conceal "")) -------------------------------------------------------------------------------- /after/syntax/jsonc.vim: -------------------------------------------------------------------------------- 1 | " Based on vim-json syntax 2 | runtime syntax/json.vim 3 | 4 | " Remove syntax group for comments treated as errors 5 | syn clear jsonCommentError 6 | 7 | " Define syntax matching comments and their contents 8 | syn keyword jsonCommentTodo FIXME NOTE TBD TODO XXX 9 | syn match jsonLineComment '\/\/.*' contains=@Spell,jsonCommentTodo 10 | syn match jsonCommentSkip '^[ \t]*\*\($\|[ \t]\+\)' 11 | syn region jsonComment start='/\*' end='\*/' contains=@Spell,jsonCommentTodo 12 | 13 | " Link comment syntax comment to highlighting 14 | hi! def link jsonLineComment Comment 15 | hi! def link jsonComment Comment 16 | -------------------------------------------------------------------------------- /after/syntax/make.vim: -------------------------------------------------------------------------------- 1 | syn match makePreCondit "^\s*\(ifeq\>\|else\>\|endif\>\|ifneq\>\|ifdef\>\|ifndef\>\)" 2 | syn match makeIdent "^\s*[^:#= \t]*\s*[:+?!*]="me=e-2 3 | syn match makeIdent "^\s*[^:#= \t]*\s*="me=e-1 4 | -------------------------------------------------------------------------------- /after/syntax/qf.lua: -------------------------------------------------------------------------------- 1 | vim.cmd([[ 2 | 3 | syn match qfFileName /^[^│]*/ nextgroup=qfSeparatorLeft 4 | syn match qfSeparatorLeft /│/ contained nextgroup=qfLineNr 5 | syn match qfLineNr /[^│]*/ contained nextgroup=qfSeparatorRight 6 | syn match qfSeparatorRight '│' contained nextgroup=qfError,qfWarning,qfInfo,qfNote 7 | syn match qfError / E .*$/ contained 8 | syn match qfWarning / W .*$/ contained 9 | syn match qfInfo / I .*$/ contained 10 | syn match qfNote / [NH] .*$/ contained 11 | 12 | hi def link qfFileName Directory 13 | hi def link qfSeparatorLeft Delimiter 14 | hi def link qfSeparatorRight Delimiter 15 | hi def link qfLineNr LineNr 16 | hi def link qfError DiagnosticError 17 | hi def link qfWarning DiagnosticWarning 18 | hi def link qfInfo DiagnosticInfo 19 | hi def link qfNote DiagnosticHint 20 | 21 | let b:current_syntax = 'qf' 22 | 23 | hi default link BqfPreviewFloat Normal 24 | 25 | ]]) 26 | -------------------------------------------------------------------------------- /after/syntax/sh.lua: -------------------------------------------------------------------------------- 1 | vim.cmd([[ 2 | " Shebang 3 | syn match shShebang "^#!.*$" containedin=shComment 4 | 5 | " Operators 6 | syn match shOperator '||' 7 | syn match shOperator '&&' 8 | 9 | " Match semicolons as Delimiter rather than Operator 10 | syn match shSemicolon ';' containedin=shOperator,zshOperator 11 | 12 | " Highlight braces, brackets and parens as Delimiters in zsh 13 | syn match zshDelim '\v(\(|\))' containedin=zshParentheses 14 | syn match zshDelim '\v(\{|\})' containedin=zshBraces 15 | syn match zshDelim '\v(\[|\])' containedin=zshParentheses 16 | 17 | " Match command flags in zsh 18 | syn match zshFlag "\v<-\w+" containedin=zshBrackets,zshParentheses 19 | 20 | " Special files as Constants 21 | syn match Constant "\v/dev/\w+" 22 | \ containedin=shFunctionOne,shIf,shCmdParenRegion,shCommandSub 23 | 24 | " Common commands 25 | let commands = [ 'arch', 'awk', 'b2sum', 'base32', 'base64', 'basename', 'basenc', 'bash', 'brew', 'cat', 'chcon', 'chgrp', 'chown', 'chroot', 'cksum', 'comm', 'cp', 'csplit', 'curl', 'cut', 'date', 'dd', 'defaults', 'df', 'dir', 'dircolors', 'dirname', 'ed', 'env', 'expand', 'factor', 'fmt', 'fold', 'git', 'grep', 'groups', 'head', 'hexdump', 'hostid', 'hostname', 'hugo', 'id', 'install', 'join', 'killall', 'link', 'ln', 'logname', 'md5sum', 'mkdir', 'mkfifo', 'mknod', 'mktemp', 'nice', 'nl', 'nohup', 'npm', 'nproc', 'numfmt', 'od', 'open', 'paste', 'pathchk', 'pr', 'printenv', 'printf', 'ptx', 'readlink', 'realpath', 'rg', 'runcon', 'scutil', 'sed', 'seq', 'sha1sum', 'sha2', 'shred', 'shuf', 'split', 'stat', 'stdbuf', 'stty', 'sudo', 'sum', 'sync', 'tac', 'tee', 'terminfo', 'timeout', 'tmux', 'top', 'touch', 'tput', 'tr', 'truncate', 'tsort', 'tty', 'uname', 'unexpand', 'uniq', 'unlink', 'uptime', 'users', 'vdir', 'vim', 'wc', 'who', 'whoami', 'yabai', 'yes' ] 26 | 27 | for i in commands 28 | execute 'syn match shStatement "\v(\w|-)@ to close chat window. 22 | -- scroll up chat window. 23 | -- scroll down chat window. 24 | -- to copy/yank last answer. 25 | -- Toggle settings window. 26 | -- Start new session. 27 | -- Cycle over windows.tr 28 | -- [Edit Window] use response as input. 29 | 30 | { 31 | "copilot.vim", 32 | enabled = ai_conf.sell_your_soul and not ai_conf.use_lua_copilot, 33 | event = "InsertEnter", 34 | after = function() 35 | vim.g.copilot_no_tab_map = true 36 | end, 37 | }, 38 | 39 | { 40 | "copilot.lua", 41 | enabled = true, 42 | event = "InsertEnter", 43 | after = function() 44 | opts = { 45 | panel = { 46 | enabled = true, 47 | auto_refresh = true, 48 | keymap = { open = "" }, 49 | layout = { position = "right", ratio = 0.4 }, 50 | }, 51 | 52 | suggestion = { 53 | auto_trigger = lambda.config.ai.copilot.autotrigger, 54 | keymap = { accept = "" }, 55 | }, 56 | 57 | filetypes = { 58 | gitcommit = false, 59 | NeogitCommitMessage = false, 60 | DressingInput = false, 61 | TelescopePrompt = false, 62 | ["neo-tree-popup"] = false, 63 | ["dap-repl"] = false, 64 | }, 65 | } 66 | require("copilot").setup(opts) 67 | end, 68 | }, 69 | -- { 70 | -- "sg.nvim", 71 | -- enabled = lambda.config.lsp.use_sg, 72 | -- event = "DeferredUIEnter", 73 | -- after = function() 74 | -- require("sg").setup({ 75 | -- enable_cody = true, 76 | -- accept_tos = true, 77 | -- download_binaries = true, 78 | -- on_attach = true, 79 | -- }) 80 | -- end, 81 | -- }, 82 | } 83 | -------------------------------------------------------------------------------- /lua/lazy_specs/buffer/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "reach.nvim", 4 | event = "DeferredUIEnter", 5 | after = function() 6 | require("reach").setup({ 7 | notifications = true, 8 | }) 9 | end, 10 | }, 11 | { 12 | "cybu.nvim", 13 | load = function(name) 14 | rocks.safe_force_packadd({ name, "nvim-web-devicons", "plenary.nvim" }) 15 | end, 16 | cmd = { 17 | "CybuNext", 18 | "CybuPrev", 19 | }, 20 | after = function() 21 | require("cbyu").setup() 22 | lambda.command("CybuNext", "(CybyNext)", {}) 23 | lambda.command("CybyPrev", "(CybuPrev)", {}) 24 | end, 25 | }, 26 | { 27 | "bufexplorer", 28 | beforeAll = function() 29 | vim.g.bufExplorerDisableDefaultKeyMapping = 1 30 | end, 31 | 32 | cmd = { "BufExplorer", "ToggleBufExplorer", "BufExplorerHorizontalSplit", "BufExplorerVerticalSplit" }, 33 | }, 34 | { 35 | "bufonly.nvim", 36 | cmd = "BufOnly", 37 | }, 38 | { 39 | "barbar.nvim", 40 | event = "DeferredUIEnter", 41 | beforeAll = function() 42 | vim.g.barbar_auto_setup = true 43 | end, 44 | after = function() 45 | require("barbar").setup({ aimation = false }) 46 | end, 47 | }, 48 | { 49 | "scope.nvim", 50 | event = "DeferredUIEnter", 51 | after = function() 52 | require("scope").setup({ 53 | hooks = { 54 | pre_tab_leave = function() 55 | vim.api.nvim_exec_autocmds("User", { pattern = "ScopeTabLeavePre" }) 56 | -- [other statements] 57 | end, 58 | 59 | post_tab_enter = function() 60 | vim.api.nvim_exec_autocmds("User", { pattern = "ScopeTabEnterPost" }) 61 | -- [other statements] 62 | end, 63 | 64 | -- [other hooks] 65 | }, 66 | 67 | -- [other options] 68 | }) 69 | end, 70 | }, 71 | { 72 | "stickybuf.nvim", 73 | after = function() 74 | require("stickybuf").setup({ 75 | get_auto_pin = function(bufnr) 76 | return require("stickybuf").should_auto_pin(bufnr) 77 | end, 78 | }) 79 | end, 80 | }, 81 | } 82 | -------------------------------------------------------------------------------- /lua/lazy_specs/docs/config.lua: -------------------------------------------------------------------------------- 1 | local config = {} 2 | 3 | function config.neogen() 4 | require("neogen").setup({ 5 | snippet_engine = "luasnip", 6 | languages = { 7 | lua = { 8 | template = { annotation_convention = "emmylua" }, 9 | }, 10 | python = { 11 | template = { annotation_convention = "numpydoc" }, 12 | }, 13 | c = { 14 | template = { annotation_convention = "doxygen" }, 15 | }, 16 | }, 17 | }) 18 | end 19 | 20 | function config.nvim_doc_help() 21 | require("docs-view").setup({ 22 | position = "bottom", 23 | height = 10, 24 | }) 25 | end 26 | function config.browse() 27 | local browse = require("browse") 28 | local bookmarks = { 29 | ["github"] = { 30 | ["name"] = "search github from neovim", 31 | ["code_search"] = "https://github.com/search?q=%s&type=code", 32 | ["repo_search"] = "https://github.com/search?q=%s&type=repositories", 33 | ["issues_search"] = "https://github.com/search?q=%s&type=issues", 34 | ["pulls_search"] = "https://github.com/search?q=%s&type=pullrequests", 35 | }, 36 | } 37 | browse.setup({ 38 | -- search provider you want to use 39 | provider = "google", -- duckduckgo, bing 40 | 41 | -- either pass it here or just pass the table to the functions 42 | -- see below for more 43 | bookmarks = bookmarks, 44 | }) 45 | end 46 | 47 | return config 48 | -------------------------------------------------------------------------------- /lua/lazy_specs/docs/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 3 | -- { 4 | -- "neogen", 5 | -- after = conf.neogen, 6 | -- }, 7 | { 8 | "refgo.nvim", 9 | cmd = { "RefCopy", "RefGo" }, 10 | }, 11 | 12 | { 13 | "nvim-docs-view", 14 | opt = true, 15 | cmd = { "DocsViewToggle" }, 16 | after = function() 17 | require("docs-view").setup({ 18 | position = "bottom", 19 | height = 10, 20 | }) 21 | end, 22 | }, 23 | 24 | { 25 | "vim-devdocs", 26 | cmd = { "DD" }, 27 | opt = true, 28 | }, 29 | 30 | -- { 31 | -- "updoc.nvim", 32 | -- opt = true, 33 | -- after = function() 34 | -- require("updoc").setup() 35 | -- end, 36 | -- }, 37 | 38 | { 39 | "browse.nvim", 40 | opt = true, 41 | dependencies = { "nvim-telescope/telescope.nvim" }, 42 | after = function() 43 | local browse = require("browse") 44 | local bookmarks = { 45 | ["github"] = { 46 | ["name"] = "search github from neovim", 47 | ["code_search"] = "https://github.com/search?q=%s&type=code", 48 | ["repo_search"] = "https://github.com/search?q=%s&type=repositories", 49 | ["issues_search"] = "https://github.com/search?q=%s&type=issues", 50 | ["pulls_search"] = "https://github.com/search?q=%s&type=pullrequests", 51 | }, 52 | } 53 | browse.setup({ 54 | -- search provider you want to use 55 | provider = "google", -- duckduckgo, bing 56 | 57 | -- either pass it here or just pass the table to the functions 58 | -- see below for more 59 | bookmarks = bookmarks, 60 | }) 61 | end, 62 | }, 63 | { 64 | "wtf.nvim", 65 | opts = { 66 | -- Default AI popup type 67 | popup_type = "popup", 68 | -- An alternative way to set your OpenAI api key 69 | openai_api_key = os.getenv("OPENAI_API_KEY"), 70 | -- ChatGPT Model 71 | openai_model_id = "gpt-4", 72 | additional_instructions = "Start the reply with 'Hello There' Talk like a programming version of obiwan kenobi", 73 | -- Default search engine, can be overridden by passing an option to WtfSeatch 74 | default_search_engine = "google", -- "google" | "duck_duck_go" | "stack_overflow" | "github", 75 | }, 76 | cmd = { 77 | "Wtf", 78 | "WtfSearch", 79 | }, 80 | after = function(_, opts) 81 | require("wtf").setup(opts) 82 | 83 | vim.g["wtf_hooks"] = { 84 | request_started = function() 85 | vim.cmd("hi StatusLine ctermbg=NONE ctermfg=yellow") 86 | end, 87 | request_finished = vim.schedule_wrap(function() 88 | vim.cmd("hi StatusLine ctermbg=NONE ctermfg=NONE") 89 | end), 90 | } 91 | end, 92 | }, 93 | } 94 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/api/docs_neotest.lua: -------------------------------------------------------------------------------- 1 | local leader = "d" 2 | local bracket = { "d", "D", "E", "i", "p" } 3 | 4 | local config = { 5 | ["Docs/Test"] = { 6 | body = leader, 7 | position = "bottom-right", 8 | mode = { "n", "v", "x", "o" }, 9 | [""] = { nil, { exit = true } }, 10 | -- Neogen stuff 11 | d = { 12 | function() 13 | require("neogen").generate() 14 | end, 15 | { nowait = true, silent = true, desc = "Gen Doc ", exit = true }, 16 | }, 17 | E = { 18 | function() 19 | require("neogen").generate({ type = "class" }) 20 | end, 21 | { nowait = true, silent = true, desc = "Gen class ", exit = true }, 22 | }, 23 | D = { 24 | function() 25 | require("neogen").generate({ type = "type" }) 26 | end, 27 | { nowait = true, silent = true, desc = "Gen type ", exit = false }, 28 | }, 29 | 30 | -- Reference Stuff 31 | i = { 32 | function() 33 | vim.cmd("RefCopy") 34 | end, 35 | { nowait = true, silent = true, desc = "refCopy ", exit = true }, 36 | }, 37 | p = { 38 | 39 | function() 40 | vim.cmd("RefGo") 41 | end, 42 | { nowait = true, silent = true, desc = "RefGo ", exit = true }, 43 | }, 44 | -- Documentation types ? 45 | L = { 46 | function() 47 | vim.cmd("DocsViewToggle") 48 | end, 49 | { nowait = true, silent = true, desc = "Live Docs ", exit = true }, 50 | }, 51 | }, 52 | } 53 | -- 54 | 55 | return { 56 | config, 57 | "Docs/Test", 58 | { { "L" } }, 59 | bracket, 60 | 6, 61 | 4, 62 | 1, 63 | } 64 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/api/fold.lua: -------------------------------------------------------------------------------- 1 | local leader = "z" 2 | local api = vim.api 3 | local function nN(char) 4 | local ok, winid = require("hlslens").nNPeekWithUFO(char) 5 | if ok and winid then 6 | -- Safe to override buffer scope keymaps remapped by ufo, 7 | -- ufo will restore previous buffer keymaps before closing preview window 8 | -- Type will switch to preview window and fire `trace` action 9 | vim.keymap.set("n", "", function() 10 | local keyCodes = vim.keycode("", true, false, true) 11 | api.nvim_feedkeys(keyCodes, "im", false) 12 | end, { buffer = true }) 13 | end 14 | end 15 | local config = { 16 | Fold = { 17 | body = leader, 18 | mode = { "n" }, 19 | [""] = { nil, { exit = true } }, 20 | N = { 21 | function() 22 | nN("N") 23 | end, 24 | { silent = true, exit = false, desc = "hlslens.nNPeekWithUFO('N')" }, 25 | }, 26 | n = { 27 | function() 28 | nN("n") 29 | end, 30 | { silent = true, exit = false, desc = "hlslens.nNPeekWithUFO('n')" }, 31 | }, 32 | w = { 33 | function() 34 | vim.ui.input({ prompt = "Enter Fold Ammount", default = "4" }, function(fold) 35 | require("foldcus").fold(tonumber(fold)) 36 | end) 37 | end, 38 | { silent = true, nowait = true, exit = true, desc = "Fold Multiline" }, 39 | }, 40 | W = { 41 | function() 42 | vim.ui.input({ prompt = "Enter Fold Ammount", default = "4" }, function(fold) 43 | require("foldcus").unfold(tonumber(fold)) 44 | end) 45 | end, 46 | { silent = true, nowait = true, exit = true, desc = "Unfold Multiline Longer than 4" }, 47 | }, 48 | R = { 49 | function() 50 | require("ufo").openAllFolds() 51 | end, 52 | { silent = true, nowait = true, exit = true, desc = "Open all folds" }, 53 | }, 54 | M = { 55 | function() 56 | require("ufo").closeAllFolds() 57 | end, 58 | { silent = true, nowait = true, exit = true, desc = "Close all folds" }, 59 | }, 60 | r = { 61 | function() 62 | require("ufo").openFoldsExceptKinds() 63 | end, 64 | { silent = true, nowait = true, exit = true, desc = "Open folds except kinds" }, 65 | }, 66 | m = { 67 | function() 68 | require("ufo").closeFoldsWithKinds() 69 | end, 70 | { silent = true, nowait = true, exit = true, desc = "Close folds with kinds" }, 71 | }, 72 | L = { 73 | function() 74 | require("fold-cycle").open_all() 75 | end, 76 | { exit = true, desc = "open folds underneath" }, 77 | }, 78 | K = { 79 | function() 80 | require("fold-cycle").close_all() 81 | end, 82 | { exit = true, desc = "close folds underneath" }, 83 | }, 84 | j = { 85 | "zj", 86 | { exit = false, desc = "next fold" }, 87 | }, 88 | k = { 89 | "zk", 90 | { exit = false, desc = "previous fold" }, 91 | }, 92 | }, 93 | } 94 | return { 95 | config, 96 | "Fold", 97 | { { "W", "w", "R", "M", "r", "m", "L", "K" } }, 98 | { "j", "k", "n", "N" }, 99 | 6, 100 | 3, 101 | } 102 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/api/genghis.lua: -------------------------------------------------------------------------------- 1 | local leader = ";\\" 2 | 3 | local exit = { nil, { exit = true, desc = "EXIT" } } 4 | 5 | local config = { 6 | Genghis = { 7 | body = leader, 8 | mode = { "n", "v", "x", "o" }, 9 | [""] = { nil, { exit = true } }, 10 | 11 | c = { 12 | function() 13 | vim.cmd([[GenghiscopyFilepath]]) 14 | end, 15 | 16 | { nowait = false, exit = true, desc = "CopyFilepath" }, 17 | }, 18 | C = { 19 | function() 20 | vim.cmd([[GenghiscopyFilename]]) 21 | end, 22 | { nowait = true, exit = true, desc = "CopyFilename" }, 23 | }, 24 | [""] = { 25 | function() 26 | vim.cmd([[Genghischmodx]]) 27 | end, 28 | { nowait = true, exit = true, desc = "Chmodx" }, 29 | }, 30 | r = { 31 | function() 32 | vim.cmd([[GenghisrenameFile]]) 33 | end, 34 | { nowait = true, exit = true, desc = "RenameFile" }, 35 | }, 36 | d = { 37 | function() 38 | vim.cmd([[GenghisduplicateFile]]) 39 | end, 40 | { nowait = true, exit = true, desc = "Duplicate" }, 41 | }, 42 | 43 | n = { 44 | function() 45 | vim.cmd([[GenghiscreateNewFile]]) 46 | end, 47 | { nowait = true, exit = true, desc = "CreateNewFile" }, 48 | }, 49 | T = { 50 | function() 51 | vim.cmd([[Genghistrash]]) 52 | end, 53 | { nowait = true, exit = true, desc = "Trash" }, 54 | }, 55 | 56 | m = { 57 | function() 58 | vim.cmd([[Genghismove]]) 59 | end, 60 | { nowait = true, exit = false, desc = "Move" }, 61 | }, 62 | }, 63 | } 64 | return { 65 | config, 66 | "Genghis", 67 | { { "r", "d", "n", "m", "T" } }, 68 | { "", "C", "c" }, 69 | 6, 70 | 3, 71 | 1, 72 | } 73 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/api/refactor.lua: -------------------------------------------------------------------------------- 1 | local leader = ";e" 2 | local config = { 3 | Refactor = { 4 | body = leader, 5 | mode = { "n", "v" }, 6 | [""] = { nil, { exit = true } }, 7 | r = { 8 | function() 9 | require("refactoring").select_refactor() 10 | end, 11 | { exit = true, desc = "Select refactor" }, 12 | }, 13 | i = { 14 | function() 15 | require("refactoring").refactor("Inline Variable") 16 | end, 17 | { exit = true, desc = "Inline variable" }, 18 | }, 19 | b = { 20 | function() 21 | require("refactoring").refactor("Extract Block") 22 | end, 23 | { exit = true, desc = "Extract block" }, 24 | }, 25 | B = { 26 | function() 27 | require("refactoring").refactor("Extract Block To File") 28 | end, 29 | { exit = true, desc = "Extract block to file" }, 30 | }, 31 | p = { 32 | function() 33 | require("refactoring").debug.print_var({ normal = true }) 34 | end, 35 | { exit = true, desc = "Debug print" }, 36 | }, 37 | c = { 38 | function() 39 | require("refactoring").debug.cleanup({}) 40 | end, 41 | { exit = true, desc = "Debug print cleanup" }, 42 | }, 43 | v = { 44 | function() 45 | require("refactoring").refactor("Extract Function") 46 | end, 47 | { exit = true, desc = "Extract function" }, 48 | }, 49 | f = { 50 | function() 51 | require("refactoring").refactor("Extract Function To File") 52 | end, 53 | { exit = true, desc = "Extract function to file" }, 54 | }, 55 | e = { 56 | function() 57 | require("refactoring").refactor("Extract Variable") 58 | end, 59 | { exit = true, desc = "Extract variable" }, 60 | }, 61 | }, 62 | } 63 | return { 64 | config, 65 | "Refactor", 66 | { { "b", "B", "p", "c", "v", "f", "e" } }, 67 | { "r", "i" }, 68 | 6, 69 | 3, 70 | } 71 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/api/swap_surf.lua: -------------------------------------------------------------------------------- 1 | local leader = ";s" 2 | local config = { 3 | Swap = { 4 | body = leader, 5 | mode = { "n", "v", "x", "o" }, 6 | [""] = { nil, { exit = true } }, 7 | 8 | k = { 9 | function() 10 | require("nvim-treesitter.textobjects.swap").swap_next("@parameter.inner") 11 | end, 12 | 13 | { nowait = true, desc = "TS Swap →", exit = true }, 14 | }, 15 | j = { 16 | function() 17 | require("nvim-treesitter.textobjects.swap").swap_previous("@parameter.inner") 18 | end, 19 | { nowait = true, desc = "TS Swap ←", exit = true }, 20 | }, 21 | s = { 22 | function() 23 | vim.cmd([[ISwap]]) 24 | end, 25 | 26 | { nowait = true, desc = "Iswap", exit = true }, 27 | }, 28 | S = { 29 | function() 30 | vim.cmd([[ISwapWith]]) 31 | end, 32 | 33 | { nowait = true, desc = "IswapWith", exit = false }, 34 | }, 35 | 36 | w = { 37 | function() 38 | vim.cmd([[STSJumpToTop]]) 39 | end, 40 | { nowait = true, desc = "Surf Jump Top", exit = false }, 41 | }, 42 | N = { 43 | function() 44 | vim.cmd([[STSSelectMasterNode]]) 45 | end, 46 | 47 | { nowait = true, desc = "Surf Master Node", exit = false }, 48 | }, 49 | n = { 50 | function() 51 | vim.cmd([[STSSelectCurrentNode]]) 52 | end, 53 | 54 | { nowait = true, desc = "Surf Curent Node", exit = false }, 55 | }, 56 | 57 | J = { 58 | function() 59 | vim.cmd([[STSSelectNextSiblingNode]]) 60 | end, 61 | 62 | { nowait = true, desc = "Surf [N] Sibling", exit = false }, 63 | }, 64 | K = { 65 | function() 66 | vim.cmd([[STSSelectPrevSiblingNode]]) 67 | end, 68 | 69 | { nowait = true, desc = "Surf [P] Sibling", exit = false }, 70 | }, 71 | H = { 72 | function() 73 | vim.cmd([[STSSelectParentNode]]) 74 | end, 75 | 76 | { nowait = true, desc = "Surf Parent", exit = false }, 77 | }, 78 | L = { 79 | function() 80 | vim.cmd([[STSSelectChildNode]]) 81 | end, 82 | 83 | { nowait = true, desc = "Surf Child", exit = false }, 84 | }, 85 | v = { 86 | function() 87 | vim.cmd([[STSSwapNextVisual]]) 88 | end, 89 | 90 | { nowait = true, desc = "Surf [N] Swap", exit = false }, 91 | }, 92 | V = { 93 | function() 94 | vim.cmd([[STSSwapPrevVisual]]) 95 | end, 96 | 97 | { nowait = true, desc = "Surf [P] Swap", exit = false }, 98 | }, 99 | }, 100 | } 101 | 102 | return { 103 | config, 104 | "Swap", 105 | { 106 | { "N", "n", "v", "V" }, 107 | { "w", "H", "J", "K", "L" }, 108 | }, 109 | { "s", "S", "k", "j" }, 110 | 6, 111 | 3, 112 | 1, 113 | } 114 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/api/temp_file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vsedov/PoloVim/c0fc3f91b36ccc8d75274a072b36a03b5e23646e/lua/lazy_specs/hydra/api/temp_file -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/api/test_gen.lua: -------------------------------------------------------------------------------- 1 | local leader = ";\\" 2 | 3 | local exit = { nil, { exit = true, desc = "EXIT" } } 4 | 5 | local config = { 6 | Genghis = { 7 | body = leader, 8 | mode = { "n", "v", "x", "o" }, 9 | [""] = { nil, { exit = true } }, 10 | 11 | c = { 12 | function() 13 | vim.cmd([[GenghiscopyFilepath]]) 14 | end, 15 | 16 | { nowait = false, exit = true, desc = "CopyFilepath" }, 17 | }, 18 | C = { 19 | function() 20 | vim.cmd([[GenghiscopyFilename]]) 21 | end, 22 | { nowait = true, exit = true, desc = "CopyFilename" }, 23 | }, 24 | [""] = { 25 | function() 26 | vim.cmd([[Genghischmodx]]) 27 | end, 28 | { nowait = true, exit = true, desc = "Chmodx" }, 29 | }, 30 | r = { 31 | function() 32 | vim.cmd([[GenghisrenameFile]]) 33 | end, 34 | { nowait = true, exit = true, desc = "RenameFile" }, 35 | }, 36 | d = { 37 | function() 38 | vim.cmd([[GenghisduplicateFile]]) 39 | end, 40 | { nowait = true, exit = true, desc = "Duplicate" }, 41 | }, 42 | 43 | n = { 44 | function() 45 | vim.cmd([[GenghiscreateNewFile]]) 46 | end, 47 | { nowait = true, exit = true, desc = "CreateNewFile" }, 48 | }, 49 | T = { 50 | function() 51 | vim.cmd([[Genghistrash]]) 52 | end, 53 | { nowait = true, exit = true, desc = "Trash" }, 54 | }, 55 | 56 | m = { 57 | function() 58 | vim.cmd([[Genghismove]]) 59 | end, 60 | { nowait = true, exit = false, desc = "Move" }, 61 | }, 62 | }, 63 | } 64 | return { 65 | config, 66 | "Genghis", 67 | { { "r", "d", "n", "m", "T" } }, 68 | { "", "C", "c" }, 69 | 6, 70 | 3, 71 | 1, 72 | } 73 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/hydra_utils.lua: -------------------------------------------------------------------------------- 1 | local utils = {} 2 | local function is_visual_mode() 3 | local mode = vim.api.nvim_get_mode().mode:sub(1, 1) 4 | return vim.tbl_contains({ "v", "V", "x" }, mode) 5 | end 6 | 7 | local function exit_visual_mode() 8 | local esc = vim.api.nvim_replace_termcodes("", true, true, true) 9 | vim.api.nvim_feedkeys(esc, "x", false) 10 | end 11 | 12 | local function run_on_visual_selection(function_call) 13 | if is_visual_mode() then 14 | exit_visual_mode() 15 | end 16 | if type(function_call) == "function" then 17 | return function_call() 18 | end 19 | vim.cmd("'<,'>" .. function_call) 20 | end 21 | 22 | function utils.visual_mode(function_call) 23 | -- mode 24 | return run_on_visual_selection(function_call) 25 | end 26 | 27 | function utils.run_visual_or_normal(function_call) 28 | if is_visual_mode() then 29 | return run_on_visual_selection(function_call) 30 | else 31 | if type(function_call) == "function" then 32 | return function_call() 33 | end 34 | return vim.cmd(function_call) 35 | end 36 | end 37 | 38 | function utils.defer_function(function_call, args, delay) 39 | if args == nil then 40 | args = "" 41 | end 42 | vim.defer_fn(function() 43 | vim.cmd(function_call .. args) 44 | end, delay) 45 | end 46 | 47 | -- TODO: (vsedov) (14:36:49 - 15/02/24): Do this 48 | function utils.total_binds(config) end 49 | 50 | return utils 51 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/junk/api_ai.lua: -------------------------------------------------------------------------------- 1 | -- for _, v in ipairs(cody_normal) do 2 | -- if type(v[2]) == "string" then 3 | -- internal_config[1].Cody[v[1]] = { 4 | -- function() 5 | -- vim.cmd(v[2]) 6 | -- end, 7 | -- 8 | -- { 9 | -- mode = v.mode, 10 | -- desc = v.desc, 11 | -- exit = true, 12 | -- }, 13 | -- } 14 | -- else 15 | -- internal_config[1].Cody[v[1]] = { 16 | -- function() 17 | -- v[2]() 18 | -- end, 19 | -- { 20 | -- mode = v.mode, 21 | -- desc = v.desc, 22 | -- exit = true, 23 | -- }, 24 | -- } 25 | -- end 26 | -- end 27 | -- -- Visual mode 28 | -- for _, v in ipairs(cody_visual) do 29 | -- internal_config[1].Cody[v[1]] = { 30 | -- function() 31 | -- visual_mode(v[2]) 32 | -- end, 33 | -- { 34 | -- mode = v.mode, 35 | -- desc = v.desc, 36 | -- nowait = true, 37 | -- exit = true, 38 | -- }, 39 | -- } 40 | -- end 41 | -- 42 | -- for _, v in ipairs(copilot) do 43 | -- if type(v[2]) == "string" then 44 | -- internal_copilot[1].Copilot[v[1]] = { 45 | -- function() 46 | -- vim.cmd(v[2]) 47 | -- end, 48 | -- 49 | -- { 50 | -- mode = v.mode, 51 | -- desc = v.desc, 52 | -- exit = true, 53 | -- }, 54 | -- } 55 | -- else 56 | -- internal_copilot[1].Copilot[v[1]] = { 57 | -- function() 58 | -- visual_mode(v[2]) 59 | -- end, 60 | -- { 61 | -- mode = v.mode, 62 | -- desc = v.desc, 63 | -- exit = true, 64 | -- }, 65 | -- } 66 | -- end 67 | -- end 68 | -- 69 | -- for _, v in ipairs(copilot_vis) do 70 | -- internal_copilot[1].Copilot[v[1]] = { 71 | -- function() 72 | -- if type(v[2]) == "string" then 73 | -- visual_mode(v[2]) 74 | -- else 75 | -- visual_mode(v[2]()) 76 | -- end 77 | -- end, 78 | -- { 79 | -- mode = v.mode, 80 | -- desc = v.desc, 81 | -- exit = true, 82 | -- }, 83 | -- } 84 | -- end 85 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/junk/readme.md: -------------------------------------------------------------------------------- 1 | # Junk Yard 2 | 3 | Tldr: things break, i like to keep this for the time, just in case more things 4 | break that i am unaware of 5 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/make_hydra.lua: -------------------------------------------------------------------------------- 1 | local M = require("lazy_specs.hydra.utils_rewrite") 2 | local hydra = require("hydra") 3 | 4 | local function debug_print(...) 5 | -- print(string.format(...)) 6 | end 7 | 8 | M.process_nested_hydras = function(data, parent_config) 9 | if not data[8] then 10 | return 11 | end 12 | 13 | for i, nested_data in ipairs(data[8]) do 14 | debug_print("Processing nested hydra %d: %s", i, nested_data[2]) 15 | 16 | local internal_hydra_function = M.make_hydra(nested_data) 17 | local binds = parent_config[data[2]] 18 | 19 | for k, v in pairs(binds) do 20 | if v[2] and v[2].desc == tostring(nested_data[2]) then 21 | v[1] = function() 22 | internal_hydra_function:activate() 23 | end 24 | end 25 | end 26 | end 27 | end 28 | 29 | M.create_hydra_instance = function(config, name, hint_parts, brackets, padding, cal_v2, columns) 30 | local instance = M.new(config, name) 31 | local hyd = instance.new_hydra 32 | 33 | padding = padding or 6 34 | cal_v2 = cal_v2 or 3 35 | columns = columns or 2 36 | 37 | local hint = instance:auto_hint_generate(hint_parts, brackets, padding, cal_v2, columns) 38 | hyd.hint = hint 39 | 40 | return hydra(hyd) 41 | end 42 | 43 | M.make_hydra = function(data) 44 | debug_print("Starting make_hydra for: %s", data[2] or "unnamed hydra") 45 | 46 | if type(data) ~= "table" then 47 | error("Data must be a table") 48 | end 49 | 50 | local config, name = data[1], data[2] 51 | if type(config) ~= "table" or type(name) ~= "string" then 52 | error("Invalid config or name") 53 | end 54 | 55 | M.process_nested_hydras(data, config) 56 | 57 | return M.create_hydra_instance(data[1], data[2], data[3], data[4], data[5], data[6], data[7]) 58 | end 59 | 60 | return M 61 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/normal/repl.lua: -------------------------------------------------------------------------------- 1 | local utils = require("lazy_specs.hydra.repl_utils") 2 | local run_cmd_with_count = utils.run_cmd_with_count 3 | local ft_to_repl = utils.ft_to_repl 4 | 5 | require("hydra")({ 6 | name = "REPL", 7 | body = ";", 8 | 9 | mode = "n", 10 | config = { 11 | color = "amaranth", 12 | invoke_on_body = true, 13 | hint = { 14 | -- border = lambda.style.border.type_0, 15 | position = "bottom-right", 16 | }, 17 | }, 18 | -- body = main_leader, 19 | hint = [[ 20 | REPL commands: 21 | ^ ^ _S_: Start an REPL ^ ^ 22 | ^ ^ _f_: Focus on REPL ^ ^ 23 | ^ ^ _v_: View REPLs in telescope ^ ^ 24 | ^ ^ _h_: Hide REPL ^ ^ 25 | ^ ^ _s_: Send current line to REPL ^ ^ 26 | ^ ^ _l_: Send line to REPL ^ ^ 27 | ^ ^ _q_: Quit REPL ^ ^ 28 | ^ ^ _c_: Clear REPLs ^ ^ 29 | ^ ^ _w_: Swap REPLs ^ ^ 30 | ^ ^ _?_: Start an REPL from available REPL metas ^ ^ 31 | ^ ^ _a_: Attach current buffer to a REPL ^ ^ 32 | ^ ^ _d_: Detach current buffer to any REPL ^ ^ 33 | ^ ^ __: Quit ^ ^ 34 | ]], 35 | 36 | heads = { 37 | { 38 | "S", 39 | function() 40 | run_cmd_with_count("REPLStart " .. ft_to_repl[vim.bo.filetype])() 41 | end, 42 | { exit = true, desc = "Start an REPL" }, 43 | }, 44 | { 45 | "f", 46 | run_cmd_with_count("REPLFocus"), 47 | { exit = true, desc = "Focus on REPL" }, 48 | }, 49 | { 50 | "v", 51 | "Telescope REPLShow", 52 | { exit = true, desc = "View REPLs in telescope" }, 53 | }, 54 | { 55 | "h", 56 | run_cmd_with_count("REPLHide"), 57 | { exit = true, desc = "Hide REPL" }, 58 | }, 59 | { 60 | "s", 61 | run_cmd_with_count(" REPLSendOperator"), 62 | { exit = true, desc = "Send current line to REPL" }, 63 | }, 64 | { 65 | "l", 66 | run_cmd_with_count("REPLSendLine"), 67 | { exit = true, desc = "Send line to REPL" }, 68 | }, 69 | { 70 | "q", 71 | run_cmd_with_count("REPLClose"), 72 | { exit = true, desc = "Quit REPL" }, 73 | }, 74 | { "c", "REPLCleanup", { exit = true, desc = "Clear REPLs" } }, 75 | { "w", "REPLSwap", { exit = true, desc = "Swap REPLs" } }, 76 | { 77 | "?", 78 | run_cmd_with_count("REPLStart"), 79 | { exit = true, desc = "Start an REPL from available REPL metas" }, 80 | }, 81 | { 82 | "a", 83 | "REPLAttachBufferToREPL", 84 | { exit = true, desc = "Attach current buffer to a REPL" }, 85 | }, 86 | { 87 | "d", 88 | "REPLDetachBufferToREPL", 89 | { exit = true, desc = "Detach current buffer to any REPL" }, 90 | }, 91 | { 92 | "", 93 | nil, 94 | { exit = true, desc = "quit" }, 95 | }, 96 | }, 97 | }) 98 | vim.keymap.set("n", ";;r", utils.send_a_code_chunk, { 99 | desc = "send a code chunk", 100 | expr = true, 101 | buffer = 0, 102 | }) 103 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/normal/tab.lua: -------------------------------------------------------------------------------- 1 | local Hydra = require("hydra") 2 | 3 | local cmd = require("hydra.keymap-util").cmd 4 | 5 | local hint = [[ 6 | Tabpage 7 | 8 | Create ^^^ Close ^^ Goto Move 9 | ----------------^^^ -----------^^ ----------- ------- 10 | _n_: new _c_: close _]_: next _>_: next 11 | _s_: split current _o_: others _[_: prev _<_: prev 12 | ^ ^ into a new tab ^ _\^_: first 13 | ^^^^ _$_: last 14 | __: quit 15 | 16 | ]] 17 | 18 | Hydra({ 19 | name = "Tabpage", 20 | hint = hint, 21 | config = { 22 | invoke_on_body = true, 23 | hint = { 24 | position = "bottom-right", 25 | float_opts = { 26 | border = lambda.style.border.type_0, 27 | style = "minimal", 28 | focusable = true, 29 | noautocmd = true, 30 | }, 31 | }, 32 | }, 33 | mode = "n", 34 | on_enter = function() 35 | vim.bo.modifiable = false 36 | end, 37 | body = ";", 38 | 39 | heads = { 40 | { "n", cmd("tabnew"), { nowait = true } }, 41 | { "s", cmd("tab split"), { nowait = true } }, 42 | { "c", cmd("tabclose"), { nowait = true } }, 43 | { "o", cmd("tabonly"), { exit = true } }, 44 | { "]", cmd("tabnext"), { nowait = true } }, 45 | { "[", cmd("tabprevious"), { nowait = true } }, 46 | { ">", cmd("tabmove +1"), { nowait = true } }, 47 | { "<", cmd("tabmove -1"), { nowait = true } }, 48 | { "$", cmd("tablast"), { nowait = true } }, 49 | { "^", cmd("tabfirst"), { nowait = true } }, 50 | { "", nil, { exit = true } }, 51 | }, 52 | }) 53 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/normal/yanky.lua: -------------------------------------------------------------------------------- 1 | local Hydra = require("hydra") 2 | local api = vim.api 3 | local function t(str) 4 | return api.nvim_replace_termcodes(str, true, true, true) 5 | end 6 | 7 | local hint = [[ 8 | ^ ^ _p_: After ^ ^ 9 | ^ ^ _P_: Before ^ ^ 10 | ^ ^ _n_: ↓ ^ ^ 11 | ^ ^ _N_: ↑ ^ ^ 12 | ^ ^ __: paste from clipboard^ ^ 13 | ^ ^ __: paste from clipboard^ ^ 14 | ^ ^ _q_: quit ^ ^ 15 | ^ ^ __: quit^ ^ 16 | ]] 17 | local yanky_hydra = Hydra({ 18 | name = "Yank ring", 19 | mode = "n", 20 | config = { 21 | color = "amaranth", 22 | invoke_on_body = false, 23 | hint = { 24 | position = "middle-right", 25 | }, 26 | }, 27 | hint = hint, 28 | body = "p", 29 | heads = { 30 | { "p", "(YankyPutAfter)", { desc = "After" } }, 31 | { "P", "(YankyPutBefore)", { desc = "Before" } }, 32 | { "n", "(YankyCycleForward)", { noremap = true, private = true, desc = "↓" } }, 33 | { "N", "(YankyCycleBackward)", { noremap = true, private = true, desc = "↑" } }, 34 | { 35 | "", 36 | nil, 37 | { exit = true, desc = "quit" }, 38 | }, 39 | 40 | { 41 | "q", 42 | nil, 43 | { exit = true, desc = "quit" }, 44 | }, 45 | { 46 | 47 | "", 48 | [[silent! normal! "_dP]], 49 | { desc = "paste from clipboard" }, 50 | }, 51 | { 52 | "", 53 | [[silent! normal! "_dp]], 54 | { desc = "paste from clipboard" }, 55 | }, 56 | }, 57 | }) 58 | -- choose/change the mappings if you want 59 | for key, putAction in pairs({ 60 | ["p"] = "(YankyPutAfter)", 61 | ["P"] = "(YankyPutBefore)", 62 | ["gp"] = "(YankyGPutAfter)", 63 | ["gP"] = "(YankyGPutBefore)", 64 | }) do 65 | vim.keymap.set({ "n", "x" }, key, function() 66 | vim.fn.feedkeys(t(putAction)) 67 | yanky_hydra:activate() 68 | end) 69 | end 70 | 71 | for key, putAction in pairs({ 72 | ["[p"] = "(YankyPutIndentBeforeLinewise)", 73 | ["]P"] = "(YankyPutIndentAfterLinewise)", 74 | 75 | [">p"] = "(YankyPutIndentAfterShiftRight)", 76 | ["(YankyPutIndentAfterShiftLeft)", 77 | [">P"] = "(YankyPutIndentBeforeShiftRight)", 78 | ["(YankyPutIndentBeforeShiftLeft)", 79 | 80 | ["=p"] = "(YankyPutAfterFilter)", 81 | ["=P"] = "(YankyPutBeforeFilter)", 82 | }) do 83 | vim.keymap.set("n", key, function() 84 | vim.fn.feedkeys(t(putAction)) 85 | vim.schedule_wrap(yanky_hydra:activate()) 86 | end, { noremap = true, silent = true }) 87 | end 88 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/readme.norg: -------------------------------------------------------------------------------- 1 | @document.meta 2 | title: readme 3 | description: 4 | authors: viv 5 | categories: 6 | created: 2023-07-23 7 | updated: 2023-07-23 8 | version: 1.1.1 9 | @end 10 | 11 | * Schema 12 | @code lua 13 | local leader bind = "" 14 | local config = { 15 | NAME = { 16 | color, 17 | body = leader_bind, 18 | on_key [OPTIONAL], 19 | on_enter [OPTIONAL], 20 | on_exit [OPTIONAL], 21 | mode [OPTIONAL], 22 | Binds 23 | } 24 | } 25 | bracket is top level binds, the very first item on the column 26 | return { 27 | config, 28 | NAME, 29 | EVERYTHING BELOW BRACKET, 30 | BRACKET 31 | 6, optional params to control hydra split 32 | 3, optional params to control hydra split 33 | } 34 | @end 35 | 36 | This can be used in any application/plugin. 37 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/repl_utils.lua: -------------------------------------------------------------------------------- 1 | local function run_cmd_with_count(cmd) 2 | return function() 3 | vim.notify(string.format("%d%s", vim.v.count, cmd)) 4 | vim.cmd(string.format("%d%s", vim.v.count, cmd)) 5 | end 6 | end 7 | 8 | local function send_a_code_chunk() 9 | local leader = vim.g.mapleader 10 | local localleader = vim.g.maplocalleader 11 | -- NOTE: in an expr mapping, and 12 | -- cannot be translated. You must use their literal value 13 | -- in the returned string. 14 | 15 | if vim.bo.filetype == "r" or vim.bo.filetype == "python" then 16 | return localleader .. "si" .. leader .. "c" 17 | elseif vim.bo.filetype == "rmd" or vim.bo.filetype == "quarto" or vim.bo.filetype == "markdown" then 18 | return localleader .. "sic" 19 | end 20 | end 21 | local ft_to_repl = { 22 | r = "radian", 23 | rmd = "radian", 24 | quarto = "radian", 25 | markdown = "radian", 26 | ["markdown.pandoc"] = "radian", 27 | python = "ipython", 28 | sh = "bash", 29 | REPL = "", 30 | } 31 | 32 | return { 33 | run_cmd_with_count = run_cmd_with_count, 34 | send_a_code_chunk = send_a_code_chunk, 35 | ft_to_repl = ft_to_repl, 36 | } 37 | -------------------------------------------------------------------------------- /lua/lazy_specs/hydra/setup.lua: -------------------------------------------------------------------------------- 1 | local fmt, api, fn, fs = string.format, vim.api, vim.fn, vim.fs 2 | local when = lambda.lib.when 3 | local binds = {} 4 | 5 | local MODULE_PREFIX = "lazy_specs.hydra." 6 | local EXCLUDE_TABLE = { 7 | "init", 8 | "utils_rewrite", 9 | } 10 | 11 | local test_active = false 12 | if not test_active then 13 | table.insert(EXCLUDE_TABLE, "hydra_test") 14 | end 15 | 16 | local function loadHydraModules(path, prefix) 17 | local path_list = vim.split(fn.glob(path .. "*.lua", true), "\n") 18 | for _, path in ipairs(path_list) do 19 | local name = fn.fnamemodify(path, ":t:r") 20 | local module_name = prefix .. name 21 | -- Load the module if it's not in the exclude_table 22 | when(not vim.tbl_contains(EXCLUDE_TABLE, name), function() 23 | require(module_name) 24 | end) 25 | end 26 | end 27 | 28 | local function loadHydraAPI() 29 | local api_path = fn.expand("$HOME") .. "/.config/nvim/lua/lazy_specs/hydra/api/" 30 | local api_list = vim.split(fn.glob(api_path .. "*.lua", true), "\n") 31 | local exclude_table = { "init" } 32 | 33 | if lambda.config.movement.movement_type == "flash" then 34 | end 35 | 36 | -- if not (lambda.config.ai.tabnine.use_tabnine and lambda.config.ai.tabnine.use_tabnine_insert) then 37 | -- table.insert(exclude_table, "tabnine") 38 | -- end 39 | 40 | for _, path in ipairs(api_list) do 41 | local name = fn.fnamemodify(path, ":t:r") 42 | -- if name ~= "harpoon" then 43 | -- table.insert(exclude_table, name) 44 | -- end 45 | -- if not vim.tbl_contains({"harpoon", "fold", "treeclimber"}, name) then 46 | -- table.insert(exclude_table, name) 47 | -- 48 | -- end 49 | 50 | local module_name = MODULE_PREFIX .. "api." .. name 51 | 52 | when(not vim.tbl_contains(exclude_table, name), function() 53 | local data = require(module_name) 54 | binds[name] = data[1][data[2]].body 55 | 56 | require(MODULE_PREFIX .. "make_hydra").make_hydra(data) 57 | end) 58 | end 59 | end 60 | 61 | vim.defer_fn(function() 62 | if lambda.config.editor.hydra.load_api then 63 | loadHydraAPI() 64 | end 65 | 66 | if lambda.config.editor.hydra.load_normal then 67 | loadHydraModules(fn.expand("$HOME") .. "/.config/nvim/lua/lazy_specs/hydra/normal/", MODULE_PREFIX .. "normal.") 68 | end 69 | lambda.command("HydraBinds", function() 70 | local binds_list = {} 71 | for k, v in pairs(binds) do 72 | table.insert(binds_list, fmt("%s", k)) 73 | end 74 | -- print(table.concat(binds_list, "\n")) 75 | -- Vim.ui.select this and then run that key stroke 76 | vim.ui.select(binds_list, { 77 | prompt = "Select a choice", 78 | -- format_item = function(item) 79 | -- return binds[item] 80 | -- end, 81 | }, function(choice) 82 | if choice == nil then 83 | return 84 | end 85 | choice = binds[choice] 86 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(choice, true, false, true), "m", true) 87 | end) 88 | end) 89 | 90 | vim.keymap.set("n", "H", "HydraBinds", { noremap = true, silent = true }) 91 | end, 1000) 92 | -------------------------------------------------------------------------------- /lua/lazy_specs/movement/emergency_harpoon_string.lua: -------------------------------------------------------------------------------- 1 | -- Why ? 2 | -- Well my dumbass kinda just deletes their hydra, not intentionally, it just seems to occur, an 3 | -- unfortunate series of events, and due to how much i use hydra, i had two options, save the json 4 | -- file where shit is stored, which honestly i should do, or create a quick work around, so for the 5 | -- time, this will be good enough to be viable. 6 | local local_path = [[]] 7 | 8 | for _, dir in ipairs(vim.fn.globpath(require("core.helper").get_config_path() .. "/lua/modules", "*", true, true)) do 9 | local_path = local_path .. string.format("lua/modules/%s/plugins.lua", dir:match("lua/modules/(.*)")) .. "\n" 10 | end 11 | vim.notify(local_path) 12 | -------------------------------------------------------------------------------- /lua/lazy_specs/movement/flash/keybinds/asterisk.lua: -------------------------------------------------------------------------------- 1 | local lib = require("lazy_specs.movement.flash.nav.lib") 2 | 3 | return { 4 | { 5 | "*", 6 | function() 7 | require("lasterisk").search() 8 | lib.search_win() 9 | end, 10 | desc = "Search cword *", 11 | }, 12 | { 13 | "*", 14 | function() 15 | require("lasterisk").search({ is_whole = false }) 16 | vim.schedule(lib.search_win) 17 | return "" 18 | end, 19 | mode = { "x" }, 20 | expr = true, 21 | desc = "Search cword *", 22 | }, 23 | { 24 | "g*", 25 | function() 26 | require("lasterisk").search({ is_whole = false }) 27 | lib.search_win() 28 | end, 29 | desc = "Search cword g*", 30 | }, 31 | { 32 | "#", 33 | function() 34 | if lib.search_ref() then 35 | return 36 | end 37 | require("lasterisk").search() 38 | lib.search_win() 39 | end, 40 | desc = "Search cword (ref) # ", 41 | }, 42 | { 43 | "#", 44 | function() 45 | require("lasterisk").search({ is_whole = false }) 46 | 47 | vim.schedule(lib.search_win) 48 | return "" 49 | end, 50 | mode = { "x" }, 51 | expr = true, 52 | desc = "Search #", 53 | }, 54 | { 55 | "g#", 56 | function() 57 | require("lasterisk").search({ is_whole = false }) 58 | lib.search_win() 59 | end, 60 | desc = "Search g#", 61 | }, 62 | } 63 | -------------------------------------------------------------------------------- /lua/lazy_specs/movement/flash/keybinds/init.lua: -------------------------------------------------------------------------------- 1 | local current_dir = vim.fn.expand(vim.fn.stdpath("config") .. "/lua/lazy_specs/movement/flash/keybinds") 2 | local keybinds = {} 3 | 4 | local function add_keybinds(keybinds_list) 5 | for _, keybind in ipairs(keybinds_list) do 6 | table.insert(keybinds, keybind) 7 | end 8 | end 9 | local function walk_dir(dir) 10 | local files = vim.fn.readdir(dir) 11 | for _, file in ipairs(files) do 12 | if file ~= "init.lua" then 13 | local path = dir .. "/" .. file 14 | local stat = vim.loop.fs_stat(path) 15 | if stat.type == "directory" then 16 | walk_dir(path) 17 | else 18 | local keybinds_list = require("lazy_specs.movement.flash.keybinds." .. file:gsub(".lua", "")) 19 | add_keybinds(keybinds_list) 20 | end 21 | end 22 | end 23 | end 24 | 25 | walk_dir(current_dir) 26 | return keybinds 27 | -------------------------------------------------------------------------------- /lua/lazy_specs/movement/flash/keybinds/lsp.lua: -------------------------------------------------------------------------------- 1 | local lib = require("lazy_specs.movement.flash.nav.lib") 2 | local Flash = lambda.reqidx("flash") 3 | 4 | return { 5 | -- ╭────────────────────────────────────────────────────────────────────╮ 6 | -- │ lsp │ 7 | -- ╰────────────────────────────────────────────────────────────────────╯ 8 | -- 'gt' - go to definition 9 | -- 'gT' - go to type definition 10 | -- 'gr' - references 11 | -- 'gd' - go to declaration 12 | { 13 | "g;", 14 | -- https://github.com/folke/flash.nvim/discussions/79 15 | function() 16 | local prev_timeout = vim.opt.timeout 17 | 18 | vim.opt.timeout = false 19 | 20 | Flash.jump({ 21 | action = function(match, state) 22 | state:hide() 23 | 24 | local row, col = unpack(vim.api.nvim_win_get_cursor(0)) 25 | 26 | vim.api.nvim_set_current_win(match.win) 27 | vim.api.nvim_win_set_cursor(match.win, match.pos) 28 | 29 | local key = vim.api.nvim_replace_termcodes("" .. "g", true, true, true) 30 | 31 | vim.api.nvim_feedkeys(key, "i", false) 32 | 33 | vim.schedule(function() 34 | vim.api.nvim_win_set_cursor(match.win, { row, col }) 35 | vim.opt.timeout = prev_timeout 36 | require("flash.jump").restore_remote(state) 37 | end) 38 | end, 39 | search = { 40 | max_length = 2, 41 | }, 42 | label = { 43 | before = { 0, 2 }, 44 | after = false, 45 | }, 46 | }) 47 | end, 48 | desc = "Go to definition on jump", 49 | }, 50 | { 51 | "D", 52 | mode = { "n" }, 53 | function() 54 | require("navigator.diagnostics").show_diagnostics() 55 | end, 56 | desc = "Show diagnostics at target, without changing cursor position", 57 | }, 58 | { 59 | ";d", 60 | mode = { "n" }, 61 | function() 62 | lib.flash_diagnostics({ 63 | action = function() 64 | require("wtf").ai() 65 | end, 66 | }) 67 | end, 68 | desc = "Debug diagnostic with AI", 69 | }, 70 | { 71 | ";D", 72 | mode = { "n" }, 73 | function() 74 | lib.flash_diagnostics({ 75 | action = function() 76 | require("wtf").search() 77 | end, 78 | }) 79 | end, 80 | desc = "Search diagnostic with Google", 81 | }, 82 | -- ────────────────────────────────────────────────────────────────────── 83 | { ";gr", mode = { "n" }, lib.flash_references, desc = "Flash Lsp References" }, 84 | { 85 | "dD", 86 | function() 87 | lib.flash_diagnostics({ 88 | action = require("actions-preview").code_actions, 89 | }) 90 | end, 91 | desc = "Diagnostics + Code Action", 92 | }, 93 | } 94 | -------------------------------------------------------------------------------- /lua/lazy_specs/movement/flash/keybinds/misc.lua: -------------------------------------------------------------------------------- 1 | local lib = require("lazy_specs.movement.flash.nav.lib") 2 | local Flash = lambda.reqidx("flash") 3 | 4 | return { 5 | 6 | -- ╭────────────────────────────────────────────────────────────────────╮ 7 | -- │ Window Jump and jump lines │ 8 | -- ╰────────────────────────────────────────────────────────────────────╯ 9 | 10 | { 11 | "", 12 | mode = { "n" }, 13 | lib.jump_windows, 14 | desc = "Jump Windows", 15 | }, 16 | { 17 | "", 18 | mode = { "n" }, 19 | -- lib.flash_lines, 20 | function() 21 | require("flash").jump({ 22 | search = { mode = "search", max_length = 0 }, 23 | highlight = { 24 | label = { after = { 0, 0 } }, 25 | matches = false, 26 | }, 27 | pattern = "^\\s*\\S\\?", -- match non-whitespace at start plus any character (ignores empty lines) 28 | }) 29 | end, 30 | desc = "Jump Lines", 31 | }, 32 | 33 | -- ╭────────────────────────────────────────────────────────────────────╮ 34 | -- │ Fold │ 35 | -- ╰────────────────────────────────────────────────────────────────────╯ 36 | { 37 | "z", 38 | function() 39 | Flash.treesitter() 40 | vim.cmd("normal! Vzf") 41 | end, 42 | mode = { "n" }, 43 | silent = true, 44 | desc = "God Fold", 45 | }, 46 | } 47 | -------------------------------------------------------------------------------- /lua/lazy_specs/movement/flash/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vsedov/PoloVim/c0fc3f91b36ccc8d75274a072b36a03b5e23646e/lua/lazy_specs/movement/flash/readme.md -------------------------------------------------------------------------------- /lua/lazy_specs/movement/syntax_surfer.lua: -------------------------------------------------------------------------------- 1 | local opts = { noremap = true, silent = true } 2 | local sts = require("syntax-tree-surfer") 3 | 4 | sts.setup({ 5 | highlight_group = "STS_highlight", 6 | disable_no_instance_found_report = false, 7 | default_desired_types = { 8 | "function", 9 | "function_definition", 10 | "struct_definition", 11 | "if_statement", 12 | "else_clause", 13 | "do_clause", 14 | "else_statement", 15 | "elseif_statement", 16 | "for_statement", 17 | "let_statement", 18 | "while_statement", 19 | "switch_statement", 20 | }, 21 | left_hand_side = "fdsawervcxqtzb", 22 | right_hand_side = "jkl;oiu.,mpy/n", 23 | icon_dictionary = { 24 | ["if_statement"] = "𝒾", 25 | ["else_clause"] = "ℯ", 26 | ["else_statement"] = "ℯ", 27 | ["elseif_statement"] = "ℯ", 28 | ["elseif_clause"] = "ℯ", 29 | ["for_statement"] = "ﭜ", 30 | ["while_statement"] = "ﯩ", 31 | ["switch_statement"] = "ﳟ", 32 | ["function"] = "", 33 | ["function_definition"] = "", 34 | ["variable_declaration"] = "", 35 | ["let_statement"] = "ℒ", 36 | ["do_statement"] = "𝒟", 37 | ["struct_definition"] = "𝒮", 38 | }, 39 | }) 40 | 41 | vim.keymap.set("n", ";f", function() -- jump to all that you specify 42 | sts.targeted_jump({ 43 | "function", 44 | "function_definition", 45 | "struct_definition", 46 | "if_statement", 47 | "else_clause", 48 | "do_clause", 49 | "else_statement", 50 | "elseif_statement", 51 | "for_statement", 52 | "let_statement", 53 | "while_statement", 54 | "switch_statement", 55 | }) 56 | end, { noremap = true, silent = true, desc = "Node Jumps " }) 57 | 58 | lambda.command("STSJumpToTop", function() 59 | require("syntax-tree-surfer").go_to_top_node_and_execute_commands( 60 | false, 61 | { "normal! O", "normal! O", "startinsert" } 62 | ) 63 | end, {}) 64 | -------------------------------------------------------------------------------- /lua/lazy_specs/notes/config.lua: -------------------------------------------------------------------------------- 1 | local config = {} 2 | 3 | function config.neorg() 4 | require("modules.notes.neorg") 5 | end 6 | 7 | return config 8 | -------------------------------------------------------------------------------- /lua/lazy_specs/notes/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "neorg", 4 | ft = "norg", 5 | cmd = "Neorg", 6 | after = function() 7 | local opts = require("lazy_specs.notes.neorg").opts 8 | require("lazy_specs.notes.neorg").config(opts) 9 | end, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/lazy_specs/notes/neorg.norg: -------------------------------------------------------------------------------- 1 | @document.meta 2 | title: neorg 3 | description: 4 | authors: viv 5 | categories: 6 | created: 2024-07-24T14:55:08+0100 7 | updated: 2024-07-24T14:55:08+0100 8 | version: 1.1.1 9 | @end 10 | 11 | 12 | * here 13 | 14 | *** herere 15 | 16 | -------------------------------------------------------------------------------- /lua/lazy_specs/notes/norg/autocmd.lua: -------------------------------------------------------------------------------- 1 | local utils = require("modules.notes.norg.utils") 2 | 3 | local M = { 4 | neorg_aug = vim.api.nvim_create_augroup("NeorgWritePre", { clear = true }), 5 | } 6 | 7 | local function format_on_save(_) 8 | vim.api.nvim_create_autocmd("BufWritePre", { 9 | group = M.neorg_aug, 10 | pattern = "*.norg", 11 | desc = "Neorg: format current file on save", 12 | callback = function() 13 | vim.cmd([[ 14 | normal m`=gG`` 15 | ]]) 16 | end, 17 | }) 18 | end 19 | 20 | local function export_to_markdown(_) 21 | vim.api.nvim_create_autocmd("BufWritePost", { 22 | group = M.neorg_aug, 23 | pattern = "*.norg", 24 | desc = "Neorg: export to markdown file if file already exists", 25 | callback = function() 26 | utils.export_file(".md", { only_overwrite = true, open_file = false }) 27 | end, 28 | }) 29 | end 30 | 31 | local function rename_file_with_spaces(_) 32 | vim.api.nvim_create_autocmd("BufWinEnter", { 33 | group = M.neorg_aug, 34 | pattern = "*.norg", 35 | desc = "Neorg: rename file if filename contains whitespace to underscore", 36 | callback = function() 37 | local file = vim.fn.expand("") 38 | local dir, file_name = vim.fn.fnamemodify(file, ":p:h"), vim.fn.fnamemodify(file, ":p:t") 39 | local new_name = string.gsub(file_name, " ", "_") 40 | if file_name == new_name then 41 | return 42 | end 43 | local res, err = os.rename(dir .. "/" .. file_name, dir .. "/" .. new_name) 44 | if not res then 45 | vim.notify( 46 | err or string.format("Failed to rename: `%s` -> `%s`", file_name, new_name), 47 | vim.log.levels.ERROR 48 | ) 49 | return 50 | end 51 | vim.schedule(function() 52 | vim.api.nvim_buf_delete(0, {}) 53 | vim.cmd.edit(dir .. "/" .. new_name) 54 | end) 55 | end, 56 | }) 57 | vim.api.nvim_create_autocmd("FileType", { pattern = "norg", command = "set awa" }) 58 | end 59 | 60 | M.setup = function(opts) 61 | format_on_save(opts) 62 | export_to_markdown(opts) 63 | rename_file_with_spaces(opts) 64 | end 65 | 66 | return M 67 | -------------------------------------------------------------------------------- /lua/lazy_specs/notes/norg/commands.lua: -------------------------------------------------------------------------------- 1 | M = {} 2 | 3 | local function subcmd_alias(_) 4 | vim.api.nvim_create_user_command( 5 | "Metadata", 6 | "Neorg update-metadata", 7 | { desc = "Neorg: update-metadata", bar = true } 8 | ) 9 | local days = { "Yesterday", "Today", "Tomorrow" } 10 | for _, cmd in ipairs(days) do 11 | vim.api.nvim_create_user_command(cmd, function() 12 | lambda.pcall(vim.cmd, [[Neorg journal ]] .. cmd:lower()) ---@diagnostic disable-line 13 | vim.schedule(function() 14 | vim.cmd([[Metadata | w]]) 15 | vim.cmd([[normal ]h]h]]) -- move down to {** Daily Review} 16 | lambda.pcall(vim.cmd, [[Neorg templates load journal]]) ---@diagnostic disable-line 17 | end) 18 | end, { desc = "Neorg: open " .. cmd .. "'s journal", force = true }) 19 | end 20 | end 21 | 22 | M.setup = function(opts) 23 | subcmd_alias(opts) 24 | end 25 | 26 | return M 27 | -------------------------------------------------------------------------------- /lua/lazy_specs/notes/norg/keybinds.lua: -------------------------------------------------------------------------------- 1 | local function goto_headline(which) 2 | local ts_utils = require("nvim-treesitter.ts_utils") 3 | local tsparser = vim.treesitter.get_parser() 4 | local tstree = tsparser:parse() 5 | local root = tstree[1]:root() 6 | local cursor = vim.api.nvim_win_get_cursor(0) 7 | local cursor_range = { cursor[1] - 1, cursor[2] } 8 | -- Query all headings (from 1 to 6) 9 | local query = vim.treesitter.query.parse( 10 | "norg", 11 | [[ 12 | (heading1) @h1 13 | (heading2) @h2 14 | (heading3) @h3 15 | (heading4) @h4 16 | (heading5) @h5 17 | (heading6) @h6 18 | ]] 19 | ) 20 | local previous_headline = nil 21 | local next_headline = nil 22 | -- Find the previous and next heading from the captures 23 | for _, captures, metadata in query:iter_matches(root) do ---@diagnostic disable-line 24 | for _, node in pairs(captures) do 25 | local row = node:start() 26 | if row < cursor_range[1] then 27 | previous_headline = node 28 | elseif row > cursor_range[1] and next_headline == nil then 29 | next_headline = node 30 | break 31 | end 32 | end 33 | end 34 | if which == "previous" then 35 | ts_utils.goto_node(previous_headline) 36 | elseif which == "next" then 37 | ts_utils.goto_node(next_headline) 38 | end 39 | end 40 | 41 | return { 42 | hook = function(kb) 43 | local norg_utils = require("modules.notes.norg.utils") 44 | kb.map("norg", "n", "\\" .. "e", function() 45 | norg_utils.export_file(".md", { open_file = true, open_markdown_preview = false }) 46 | end, { desc = "Neorg: export to markdown and open file" }) 47 | 48 | kb.map("norg", "n", "\\" .. "E", function() 49 | norg_utils.export_file(".md", { open_file = true, open_markdown_preview = true }) 50 | end, { desc = "Neorg: export to markdown and open MarkdownPreview" }) 51 | 52 | kb.map_event("norg", "n", "\\" .. "c", "core.looking-glass.magnify-code-block") 53 | kb.map("norg", "n", "\\" .. "q", "Neorg return") 54 | 55 | kb.map("norg", "n", "[h", function() 56 | goto_headline("previous") 57 | end, { desc = "Neorg: Go to previous headline" }) 58 | kb.map("norg", "n", "]h", function() 59 | goto_headline("next") 60 | end, { desc = "Neorg: Go to next headline" }) 61 | end, 62 | } 63 | -------------------------------------------------------------------------------- /lua/lazy_specs/notes/norg/utils.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | ---@class ExportFileOpts 4 | ---@field open_file boolean? # Whether to open dst file in a new buffer 5 | ---@field open_markdown_preview boolean? # Whether to run `:MarkdownPreview` after opening the file 6 | ---@field only_overwrite boolean? # Exit without doing anything if dst file does not exist 7 | 8 | ---@param suffix string # suffix for the target file to be exported 9 | ---@param opts ExportFileOpts # options 10 | M.export_file = function(suffix, opts) 11 | local dst = vim.fn.fnamemodify(vim.fn.expand("%"), ":~:.:r") .. suffix -- same name with suffix 12 | if opts.only_overwrite and not vim.g.personal_module.exists(dst) then 13 | return 14 | end 15 | vim.cmd(string.format([[Neorg export to-file %s]], string.gsub(dst, " ", [[\ ]]))) 16 | if opts.open_file then 17 | vim.schedule(function() 18 | vim.cmd.edit(dst) 19 | if opts.open_markdown_preview then 20 | vim.cmd([[MarkdownPreview]]) 21 | end 22 | end) 23 | end 24 | end 25 | 26 | return M 27 | -------------------------------------------------------------------------------- /lua/overseer/component/user/attach_toggleterm.lua: -------------------------------------------------------------------------------- 1 | return { 2 | desc = "Attach a toggleterm to the task", 3 | editable = false, 4 | serializable = true, 5 | params = { 6 | send_on_open = { 7 | type = "string", 8 | desc = "What text to send to task once it has started", 9 | default = nil, 10 | optional = true, 11 | }, 12 | }, 13 | constructor = function(params) 14 | return { 15 | on_start = function(_, task) 16 | if params.send_on_open then 17 | vim.fn.chansend(task.strategy.chan_id, params.send_on_open) 18 | end 19 | end, 20 | } 21 | end, 22 | } 23 | -------------------------------------------------------------------------------- /lua/overseer/component/user/dispose_now.lua: -------------------------------------------------------------------------------- 1 | return { 2 | desc = "Dispose of the task as it is made", 3 | editable = false, 4 | serializable = true, 5 | params = {}, 6 | constructor = function() 7 | return { 8 | on_pre_start = function(_, task) 9 | if task then 10 | task:dispose() 11 | end 12 | return false 13 | end, 14 | } 15 | end, 16 | } 17 | -------------------------------------------------------------------------------- /lua/overseer/component/user/init.lua: -------------------------------------------------------------------------------- 1 | return { "user.dispose_now", "user.start_open", "user.send_on_open", "user.load_prof" } 2 | -------------------------------------------------------------------------------- /lua/overseer/component/user/load_prof.lua: -------------------------------------------------------------------------------- 1 | return { 2 | desc = "Load profile data", 3 | constructor = function() 4 | return { 5 | on_complete = function(_, _, status) 6 | if status == "SUCCESS" then 7 | -- Jul_perf_flat() 8 | end 9 | end, 10 | } 11 | end, 12 | } 13 | -------------------------------------------------------------------------------- /lua/overseer/component/user/send_on_open.lua: -------------------------------------------------------------------------------- 1 | return { 2 | desc = "Attach a toggleterm to the task", 3 | editable = false, 4 | serializable = true, 5 | params = { 6 | send_on_open = { 7 | type = "string", 8 | desc = "What text to send to task once it has started", 9 | default = nil, 10 | optional = true, 11 | }, 12 | }, 13 | constructor = function(params) 14 | return { 15 | on_start = function(_, task) 16 | if params.send_on_open then 17 | vim.fn.chansend(task.strategy.chan_id, params.send_on_open) 18 | end 19 | end, 20 | } 21 | end, 22 | } 23 | -------------------------------------------------------------------------------- /lua/overseer/component/user/start_open.lua: -------------------------------------------------------------------------------- 1 | local overseer = require("overseer") 2 | 3 | return { 4 | desc = "Open in split on task start", 5 | editable = false, 6 | serializable = true, 7 | params = { 8 | goto_prev = { 9 | type = "boolean", 10 | desc = "to return or not to return", 11 | default = false, 12 | optional = true, 13 | }, 14 | start_insert = { 15 | type = "boolean", 16 | desc = "Start in insert mode", 17 | default = false, 18 | optional = true, 19 | }, 20 | }, 21 | constructor = function(params) 22 | return { 23 | on_start = function(_, task) 24 | overseer.run_action(task, "open") 25 | end, 26 | } 27 | end, 28 | } 29 | -------------------------------------------------------------------------------- /lua/overseer/template/user/haskell.lua: -------------------------------------------------------------------------------- 1 | local files = require("overseer.files") 2 | 3 | return { 4 | generator = function(_, cb) 5 | local ret = {} 6 | local priority = 60 7 | local pr = function() 8 | priority = priority + 1 9 | return priority 10 | end 11 | 12 | table.insert(ret, { 13 | name = "Open " .. vim.fn.expand("%:t:r") .. " REPL", 14 | builder = function() 15 | local cmd = require("haskell-tools").repl.mk_repl_cmd(vim.api.nvim_buf_get_name(0)) 16 | return { 17 | name = vim.fn.expand("%:t:r") .. " REPL", 18 | cmd = cmd, 19 | components = { "default", "unique" }, 20 | } 21 | end, 22 | condition = { 23 | filetype = "haskell", 24 | }, 25 | priority = pr(), 26 | }) 27 | 28 | cb(ret) 29 | end, 30 | } 31 | -------------------------------------------------------------------------------- /lua/overseer/template/user/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "user.config", 3 | "user.logs", 4 | "user.run_bins", 5 | "user.runners", 6 | "user.misc", 7 | "user.julia", 8 | "user.python", 9 | "user.haskell", 10 | } 11 | -------------------------------------------------------------------------------- /lua/overseer/template/user/logs.lua: -------------------------------------------------------------------------------- 1 | return { 2 | generator = function(_, cb) 3 | local ret = { 4 | { 5 | name = "View LSP Logs", 6 | builder = function() 7 | return { 8 | name = "View LSP Logs", 9 | cmd = "tail --follow --retry ~/.local/state/nvim/lsp.log | less -S", 10 | components = { "default", "unique" }, 11 | } 12 | end, 13 | priority = 150, 14 | params = {}, 15 | }, 16 | { 17 | name = "View Neovim Logs", 18 | builder = function() 19 | return { 20 | name = "View Neovim Logs", 21 | cmd = "tail --follow --retry ~/.local/state/nvim/log | less -S", 22 | components = { "default", "unique" }, 23 | } 24 | end, 25 | priority = 150, 26 | params = {}, 27 | }, 28 | { 29 | name = "Plot from logfile", 30 | params = { 31 | key = { 32 | type = "string", 33 | name = "Key", 34 | desc = "A search term to find the desired parameter to plot", 35 | optional = false, 36 | }, 37 | }, 38 | builder = function(params) 39 | return { 40 | name = "Plot " .. params.key, 41 | cmd = [[echo temp > /tmp/T.csv; rg ']] 42 | .. params.key 43 | .. [[' /home/viv/Projects/PowderModel/test/test_outputs/full_out.log | rg -o '[0-9.]*$' >> /tmp/T.csv; 44 | julia -e ' 45 | using Plots, CSV; 46 | ENV["GKSwstype"]="nul" 47 | gr() 48 | a = CSV.File("/tmp/T.csv") 49 | savefig(plot([a[i][2] for i in 1:length(a)]), "/tmp/T.png") 50 | ' 51 | feh /tmp/T.png 52 | ]], 53 | components = { "default", "unique" }, 54 | } 55 | end, 56 | priority = 150, 57 | condition = { 58 | dir = "/home/viv/Projects/PowderModel", 59 | }, 60 | }, 61 | } 62 | local logs = vim.fn.systemlist([[fd -e log]]) 63 | for _, log in pairs(logs) do 64 | table.insert(ret, { 65 | name = "Show " .. log, 66 | builder = function() 67 | return { 68 | name = "Show " .. log, 69 | cmd = "tail --follow --retry " .. log, 70 | components = { "default", "unique" }, 71 | } 72 | end, 73 | priority = 150, 74 | params = {}, 75 | }) 76 | end 77 | cb(ret) 78 | end, 79 | } 80 | -------------------------------------------------------------------------------- /lua/overseer/template/user/run_bins.lua: -------------------------------------------------------------------------------- 1 | local files = require("overseer.files") 2 | 3 | return { 4 | generator = function(opts, cb) 5 | local priority = 200 6 | local scripts = vim.tbl_filter(function(filename) 7 | return filename:match("%.sh$") 8 | end, files.list_files(opts.dir)) 9 | local ret = {} 10 | for _, filename in ipairs(scripts) do 11 | table.insert(ret, { 12 | name = filename, 13 | params = { 14 | args = { optional = true, type = "list", delimiter = " " }, 15 | }, 16 | priority = priority, 17 | builder = function(params) 18 | return { 19 | cmd = { files.join(opts.dir, filename) }, 20 | args = params.args, 21 | } 22 | end, 23 | }) 24 | priority = priority + 1 25 | end 26 | 27 | if files.exists(files.join(opts.dir, "bin")) then 28 | local bins = vim.tbl_filter(function(filename) 29 | return vim.fn.executable(filename) 30 | end, files.list_files(files.join(opts.dir, "bin"))) 31 | for _, filename in ipairs(bins) do 32 | table.insert(ret, { 33 | name = filename, 34 | params = { 35 | args = { optional = true, type = "list", delimiter = " " }, 36 | }, 37 | priority = priority, 38 | builder = function(params) 39 | return { 40 | cmd = { files.join(opts.dir, "bin", filename) }, 41 | args = params.args, 42 | } 43 | end, 44 | }) 45 | priority = priority + 1 46 | end 47 | end 48 | 49 | cb(ret) 50 | end, 51 | } 52 | -------------------------------------------------------------------------------- /lua/overseer/template/user/track_history.lua: -------------------------------------------------------------------------------- 1 | local task_history = {} 2 | local tasks = {} 3 | 4 | function register_task(task) 5 | tasks[task.id] = task 6 | table.insert(task_history, task.id) 7 | end 8 | 9 | function get_last_task() 10 | return tasks[task_history[#task_history]] 11 | end 12 | 13 | function restart_last_task() 14 | local task = get_last_task() 15 | if task then 16 | require("overseer").run_action(task, "restart") 17 | end 18 | end 19 | 20 | function unregister_task(task_id) 21 | tasks[task_id] = nil 22 | if task_history[#task_history] == task_id then 23 | task_history[#task_history] = nil 24 | end 25 | end 26 | 27 | return { 28 | desc = "Track files in a history so that the most recent can be restarted", 29 | constructor = function() 30 | return { 31 | on_start = function(_, task) 32 | register_task(task) 33 | end, 34 | on_dispose = function(_, task) 35 | unregister_task(task.id) 36 | end, 37 | } 38 | end, 39 | } 40 | -------------------------------------------------------------------------------- /lua/plugins/completion/cmp/extra.lua: -------------------------------------------------------------------------------- 1 | local cmp = require("cmp") 2 | local tabnine_options = lambda.config.ai.tabnine.cmp 3 | if vim.o.ft == "clap_input" or vim.o.ft == "guihua" or vim.o.ft == "guihua_rust" then 4 | cmp.setup.buffer({ completion = { enable = false } }) 5 | end 6 | 7 | vim.api.nvim_create_autocmd("FileType", { 8 | pattern = { "TelescopePrompt", "clap_input" }, 9 | callback = function() 10 | cmp.setup.buffer({ enabled = false }) 11 | end, 12 | once = false, 13 | }) 14 | 15 | if lambda.config.ai.tabnine.use_tabnine_cmp and tabnine_options.tabnine_prefetch then 16 | local prefetch = vim.api.nvim_create_augroup("prefetch", { clear = true }) 17 | vim.api.nvim_create_autocmd("BufRead", { 18 | group = prefetch, 19 | pattern = lambda.config.main_file_types, 20 | callback = function() 21 | require("cmp_tabnine"):prefetch(vim.fn.expand("%:p")) 22 | end, 23 | }) 24 | end 25 | vim.api.nvim_set_hl(0, "CmpItemKindCody", { fg = "Red" }) 26 | 27 | local cmp_autopairs = require("nvim-autopairs.completion.cmp") 28 | cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) 29 | -------------------------------------------------------------------------------- /lua/plugins/completion/cmp/init.lua: -------------------------------------------------------------------------------- 1 | local cmp = require("cmp") 2 | cmp.setup(require("plugins.completion.cmp.config")) 3 | 4 | lambda.highlight.plugin("Cmp", { 5 | { CmpItemKindVariable = { link = "Variable" } }, 6 | { CmpItemAbbrMatchFuzzy = { inherit = "comment", italic = true } }, 7 | { CmpItemAbbrDeprecated = { strikethrough = true, inherit = "Comment" } }, 8 | { CmpItemMenu = { inherit = "Comment", italic = true } }, 9 | }) 10 | 11 | require("plugins.completion.cmp.extra") 12 | 13 | vim.api.nvim_create_autocmd("CmdWinEnter", { 14 | callback = function() 15 | require("cmp").close() 16 | end, 17 | }) 18 | 19 | cmp.setup.filetype({ "markdown", "pandoc", "text", "latex" }, { 20 | sources = { 21 | { 22 | name = "nvim_lsp", 23 | keyword_length = 8, 24 | group_index = 1, 25 | max_item_count = 20, 26 | }, 27 | { name = "luasnip" }, 28 | { name = "path" }, 29 | { name = "buffer" }, 30 | { name = "dictionary", keyword_length = 2 }, 31 | { name = "latex_symbols" }, 32 | }, 33 | }) 34 | -------------------------------------------------------------------------------- /lua/plugins/completion/cmp/sources.lua: -------------------------------------------------------------------------------- 1 | local api = vim.api 2 | local ai = lambda.config.ai 3 | local condium_cond = (ai.codeium.use_codeium and ai.codeium.use_codeium_cmp) 4 | local tabnine_cond = (ai.tabnine.use_tabnine and ai.tabnine.use_tabnine_cmp) 5 | 6 | local plugins = { 7 | { name = "vimtex", enable = true }, 8 | { 9 | name = "luasnip", 10 | enable = lambda.config.cmp.luasnip.luasnip.enable, 11 | -- priority = lambda.config.cmp.luasnip.luasnip.priority, 12 | }, 13 | { 14 | name = "cmp_tabnine", 15 | enable = tabnine_cond, 16 | }, 17 | 18 | { 19 | name = "neorg", 20 | enable = true, 21 | }, 22 | { 23 | name = "cody", 24 | enable = true, 25 | }, 26 | { 27 | name = "buffer", 28 | options = { 29 | get_bufnrs = function() 30 | return vim.api.nvim_list_bufs() 31 | end, 32 | }, 33 | enable = false, 34 | group_index = 2, 35 | }, 36 | { name = "spell", group_index = 2 }, 37 | { 38 | name = "nvim_lsp", 39 | enable = true, 40 | priority = 10, 41 | }, 42 | 43 | { 44 | name = "path", 45 | enable = true, 46 | }, 47 | { 48 | name = "nvim_lua", 49 | enable = true, 50 | }, 51 | { 52 | name = "cmp_overseer", 53 | enable = true, 54 | }, 55 | } 56 | 57 | local filetype = { 58 | sql = function() 59 | table.insert(plugins, { name = "vim-dadbod-completion" }) 60 | end, 61 | norg = function() 62 | table.insert(plugins, { name = "latex_symbols" }) 63 | end, 64 | markdown = function() 65 | table.insert(plugins, { name = "latex_symbols" }) 66 | end, 67 | } 68 | 69 | if filetype[vim.bo.ft] then 70 | filetype[vim.bo.ft]() 71 | end 72 | 73 | local function apply_options(t) 74 | local ret = {} 75 | for _, plugin in ipairs(t) do 76 | local plugin_entry = { 77 | name = plugin.name, 78 | } 79 | if plugin.enable then 80 | if plugin.options then 81 | plugin_entry.options = plugin.options 82 | end 83 | table.insert(ret, plugin_entry) 84 | end 85 | end 86 | return ret 87 | end 88 | 89 | return apply_options(plugins) 90 | -------------------------------------------------------------------------------- /lua/plugins/completion/init.lua: -------------------------------------------------------------------------------- 1 | local conf = require("plugins.completion.config") 2 | local blink = { 3 | keymap = { preset = "super-tab" }, 4 | } 5 | require("blink.cmp").setup({ 6 | fuzzy = { 7 | implementation = "lua", 8 | prebuilt_binaries = { 9 | download = true, 10 | }, 11 | }, 12 | keymap = { 13 | preset = "super-tab", 14 | }, 15 | completion = { 16 | menu = { 17 | draw = { 18 | -- We don't need label_description now because label and label_description are already 19 | -- combined together in label by colorful-menu.nvim. 20 | columns = { { "kind_icon" }, { "label", gap = 1 } }, 21 | components = { 22 | label = { 23 | text = function(ctx) 24 | return require("colorful-menu").blink_components_text(ctx) 25 | end, 26 | highlight = function(ctx) 27 | return require("colorful-menu").blink_components_highlight(ctx) 28 | end, 29 | }, 30 | }, 31 | }, 32 | }, 33 | }, 34 | signature = { enabled = true }, 35 | }) 36 | require("blink.cmp.fuzzy").set_implementation("rust") 37 | 38 | conf.luasnip() 39 | require("luasnip-latex-snippets").setup() 40 | require("luasnip").config.setup({ enable_autosnippets = true }) 41 | 42 | conf.neotab() 43 | conf.autopair() 44 | 45 | -- -- or "(neotab-out)" 46 | -- vim.keymap.set("i", "", vim.lsp.buf.signature_help) 47 | -- vim.api.nvim_create_autocmd("CursorHoldI", { 48 | -- desc = "Show diagnostics on CursorHold", 49 | -- pattern = "* !silent", 50 | -- callback = function() 51 | -- vim.lsp.buf.signature_help() 52 | -- end, 53 | -- }) 54 | -- Simple autocmd to close the signature help when leaving insert mode 55 | -------------------------------------------------------------------------------- /lua/plugins/completion/snippets/all.lua: -------------------------------------------------------------------------------- 1 | local ls = require("luasnip") 2 | -- some shorthands... 3 | local s = ls.snippet 4 | local t = ls.text_node 5 | local i = ls.insert_node 6 | local f = ls.function_node 7 | local c = ls.choice_node 8 | local fmt = require("luasnip.extras.fmt").fmt 9 | 10 | local function char_count_same(c1, c2) 11 | local line = vim.api.nvim_get_current_line() 12 | -- '%'-escape chars to force explicit match (gsub accepts patterns). 13 | -- second return value is number of substitutions. 14 | local _, ct1 = string.gsub(line, "%" .. c1, "") 15 | local _, ct2 = string.gsub(line, "%" .. c2, "") 16 | return ct1 == ct2 17 | end 18 | 19 | local function even_count(character) 20 | local line = vim.api.nvim_get_current_line() 21 | local _, ct = string.gsub(line, character, "") 22 | return ct % 2 == 0 23 | end 24 | 25 | local function neg(fn, ...) 26 | return not fn(...) 27 | end 28 | 29 | local function part(fn, ...) 30 | local args = { ... } 31 | return function() 32 | return fn(unpack(args)) 33 | end 34 | end 35 | 36 | -- This makes creation of pair-type snippets easier. 37 | local function pair(pair_begin, pair_end, expand_func, ...) 38 | -- triggerd by opening part of pair, wordTrig=false to trigger anywhere. 39 | -- ... is used to pass any args following the expand_func to it. 40 | return s({ trig = pair_begin, wordTrig = false }, { 41 | t({ pair_begin }), 42 | i(1), 43 | t({ pair_end }), 44 | }, { 45 | condition = part(expand_func, part(..., pair_begin, pair_end)), 46 | }) 47 | end 48 | 49 | local all = { 50 | s( 51 | -- TODO(vsedov) (01:30:01 - 30/03/22): can probably make this smarter, need to finish it atm 52 | { trig = "table", dscr = "Table template" }, 53 | { 54 | t("| "), 55 | i(1, "First Header"), 56 | t({ 57 | " | Second Header |", 58 | "| ------------- | ------------- |", 59 | "| Content Cell | Content Cell |", 60 | "| Content Cell | Content Cell |", 61 | }), 62 | } 63 | ), 64 | 65 | s( 66 | { trig = "hr", name = "Header" }, 67 | fmt( 68 | [[ 69 | {1} 70 | {2} {3} 71 | {1} 72 | {4} 73 | ]], 74 | { 75 | f(function() 76 | local comment = string.format(vim.bo.commentstring:gsub(" ", "") or "#%s", "-") 77 | local col = vim.bo.textwidth or 80 78 | return comment .. string.rep("-", col - #comment) 79 | end), 80 | f(function() 81 | return vim.bo.commentstring:gsub("%%s", "") 82 | end), 83 | i(1, "HEADER"), 84 | i(0), 85 | } 86 | ) 87 | ), 88 | s({ trig = "date" }, { 89 | f(function() 90 | return string.format(string.gsub(vim.bo.commentstring, "%%s", " %%s"), os.date()) 91 | end, {}), 92 | }), 93 | 94 | s({ trig = "Ctime" }, { 95 | f(function() 96 | return string.format(string.gsub(vim.bo.commentstring, "%%s", " %%s"), os.date("%H:%M")) 97 | end, {}), 98 | }), 99 | 100 | s( 101 | "trig", 102 | c(1, { 103 | t("Ugh boring, a text node"), 104 | i(nil, "At least I can edit something now..."), 105 | f(function() 106 | return "Still only counts as text!!" 107 | end, {}), 108 | }) 109 | ), 110 | } 111 | 112 | return all 113 | -------------------------------------------------------------------------------- /lua/plugins/completion/snippets/luasnip.lua: -------------------------------------------------------------------------------- 1 | local types = require("luasnip.util.types") 2 | local ls_types = require("luasnip.util.types") 3 | local luasnip = require("luasnip") 4 | local util = require("luasnip.util.util") 5 | local api = vim.api 6 | local ls = require("luasnip") 7 | local types = require("luasnip.util.types") 8 | local extras = require("luasnip.extras") 9 | local fmt = require("luasnip.extras.fmt").fmt 10 | 11 | -- require("luasnip.config").set_config({ 12 | -- -- Update more often, :h events for more info. 13 | -- history = true, 14 | -- updateevents = "TextChanged , TextChangedI", 15 | -- }) 16 | require("luasnip.config").setup({ 17 | history = true, 18 | enable_autosnippets = true, 19 | 20 | ext_opts = { 21 | [ls_types.choiceNode] = { 22 | active = { 23 | hl_mode = "combine", 24 | virt_text = { { "●", "Operator" } }, 25 | }, 26 | }, 27 | [ls_types.insertNode] = { 28 | active = { 29 | hl_mode = "combine", 30 | virt_text = { { "●", "Type" } }, 31 | }, 32 | }, 33 | }, 34 | snip_env = { 35 | fmt = fmt, 36 | m = extras.match, 37 | t = ls.text_node, 38 | f = ls.function_node, 39 | c = ls.choice_node, 40 | d = ls.dynamic_node, 41 | i = ls.insert_node, 42 | l = extras.lamda, 43 | snippet = ls.snippet, 44 | }, 45 | parser_nested_assembler = function(_, snippet) 46 | local select = function(snip, no_move) 47 | snip.parent:enter_node(snip.indx) 48 | -- upon deletion, extmarks of inner nodes should shift to end of 49 | -- placeholder-text. 50 | for _, node in ipairs(snip.nodes) do 51 | node:set_mark_rgrav(true, true) 52 | end 53 | 54 | -- SELECT all text inside the snippet. 55 | if not no_move then 56 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "n", true) 57 | local pos_begin, pos_end = snip.mark:pos_begin_end() 58 | -- util.normal_move_on(pos_begin) 59 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("v", true, false, true), "n", true) 60 | -- util.normal_move_before(pos_end) 61 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("o", true, false, true), "n", true) 62 | end 63 | end 64 | function snippet:jump_into(dir, no_move) 65 | if self.active then 66 | -- inside snippet, but not selected. 67 | if dir == 1 then 68 | self:input_leave() 69 | return self.next:jump_into(dir, no_move) 70 | else 71 | select(self, no_move) 72 | return self 73 | end 74 | else 75 | -- jumping in from outside snippet. 76 | self:input_enter() 77 | if dir == 1 then 78 | select(self, no_move) 79 | return self 80 | else 81 | return self.inner_last:jump_into(dir, no_move) 82 | end 83 | end 84 | end 85 | 86 | -- this is called only if the snippet is currently selected. 87 | function snippet:jump_from(dir, no_move) 88 | if dir == 1 then 89 | return self.inner_first:jump_into(dir, no_move) 90 | else 91 | self:input_leave() 92 | return self.prev:jump_into(dir, no_move) 93 | end 94 | end 95 | 96 | return snippet 97 | end, 98 | }) 99 | -------------------------------------------------------------------------------- /lua/plugins/documentation/config.lua: -------------------------------------------------------------------------------- 1 | local config = {} 2 | 3 | function config.neogen() 4 | require("neogen").setup({ 5 | snippet_engine = "luasnip", 6 | languages = { 7 | lua = { 8 | template = { annotation_convention = "emmylua" }, 9 | }, 10 | python = { 11 | template = { annotation_convention = "numpydoc" }, 12 | }, 13 | c = { 14 | template = { annotation_convention = "doxygen" }, 15 | }, 16 | }, 17 | }) 18 | end 19 | 20 | function config.nvim_doc_help() 21 | require("docs-view").setup({ 22 | position = "bottom", 23 | height = 10, 24 | }) 25 | end 26 | function config.browse() 27 | local browse = require("browse") 28 | local bookmarks = { 29 | ["github"] = { 30 | ["name"] = "search github from neovim", 31 | ["code_search"] = "https://github.com/search?q=%s&type=code", 32 | ["repo_search"] = "https://github.com/search?q=%s&type=repositories", 33 | ["issues_search"] = "https://github.com/search?q=%s&type=issues", 34 | ["pulls_search"] = "https://github.com/search?q=%s&type=pullrequests", 35 | }, 36 | } 37 | browse.setup({ 38 | -- search provider you want to use 39 | provider = "google", -- duckduckgo, bing 40 | 41 | -- either pass it here or just pass the table to the functions 42 | -- see below for more 43 | bookmarks = bookmarks, 44 | }) 45 | end 46 | 47 | return config 48 | -------------------------------------------------------------------------------- /lua/plugins/documentation/plugins.lua: -------------------------------------------------------------------------------- 1 | local conf = require("modules.documentation.config") 2 | local docs = require("core.pack").package 3 | 4 | docs({ 5 | "danymat/neogen", 6 | lazy = true, 7 | dependencies = { "L3MON4D3/LuaSnip" }, 8 | config = conf.neogen, 9 | }) 10 | -- lua/modules/documentation/plugins.lua:5 11 | docs({ 12 | "prichrd/refgo.nvim", 13 | lazy = true, 14 | cmd = { "RefCopy", "RefGo" }, 15 | }) 16 | 17 | docs({ 18 | "amrbashir/nvim-docs-view", 19 | lazy = true, 20 | cmd = { "DocsViewToggle" }, 21 | config = conf.nvim_doc_help, 22 | }) 23 | 24 | docs({ 25 | "KabbAmine/zeavim.vim", 26 | lazy = true, 27 | cmd = { 28 | "Zeavim", 29 | "ZeavimV", 30 | "Docset", 31 | }, 32 | }) 33 | 34 | docs({ 35 | "romainl/vim-devdocs", 36 | cmd = { "DD" }, 37 | lazy = true, 38 | }) 39 | 40 | docs({ 41 | "loganswartz/updoc.nvim", 42 | lazy = true, 43 | config = true, 44 | }) 45 | 46 | docs({ 47 | "lalitmee/browse.nvim", 48 | lazy = true, 49 | dependencies = { "nvim-telescope/telescope.nvim" }, 50 | config = conf.browse, 51 | }) 52 | docs({ 53 | "piersolenski/wtf.nvim", 54 | dependencies = { 55 | "dpayne/CodeGPT.nvim", -- Optional, if you want to use AI 56 | }, 57 | opts = { 58 | -- Default AI popup type 59 | popup_type = "popup", 60 | -- An alternative way to set your OpenAI api key 61 | openai_api_key = os.getenv("OPENAI_API_KEY"), 62 | -- ChatGPT Model 63 | openai_model_id = "gpt-4", 64 | additional_instructions = "Start the reply with 'Hello There' Talk like a programming version of obiwan kenobi", 65 | -- Default search engine, can be overridden by passing an option to WtfSeatch 66 | default_search_engine = "google", -- "google" | "duck_duck_go" | "stack_overflow" | "github", 67 | }, 68 | cmd = { 69 | "Wtf", 70 | "WtfSearch", 71 | }, 72 | config = function(_, opts) 73 | require("wtf").setup(opts) 74 | 75 | vim.g["wtf_hooks"] = { 76 | request_started = function() 77 | vim.cmd("hi StatusLine ctermbg=NONE ctermfg=yellow") 78 | end, 79 | request_finished = vim.schedule_wrap(function() 80 | vim.cmd("hi StatusLine ctermbg=NONE ctermfg=NONE") 81 | end), 82 | } 83 | end, 84 | }) 85 | -------------------------------------------------------------------------------- /lua/plugins/editor/init.lua: -------------------------------------------------------------------------------- 1 | local conf = require("plugins.editor.config") 2 | conf.hydra() 3 | 4 | vim.g.smartq_q_buftypes = { 5 | "quickfix", 6 | "nofile", 7 | "acwrite", 8 | } 9 | local smart_close_filetypes = { 10 | "diff", 11 | "git", 12 | "qf", 13 | "log", 14 | "help", 15 | "query", 16 | "dbui", 17 | "lspinfo", 18 | "git.*", 19 | "Neogit.*", 20 | "neotest.*", 21 | "fugitive.*", 22 | "copilot.*", 23 | "tsplayground", 24 | "startuptime", 25 | } 26 | vim.g.smartq_q_filetypes = smart_close_filetypes 27 | -------------------------------------------------------------------------------- /lua/plugins/fun/plugins.lua: -------------------------------------------------------------------------------- 1 | local fun = require("core.pack").package 2 | 3 | -- PetsNew {name}: creates a pet with the style and type defined by the configuration, and name {name} 4 | -- PetsNewCustom {type} {style} {name}: creates a new pet with type, style and name specified in the command 5 | -- PetsList: prints the names of all the pets that are currently alive 6 | -- PetsKill {name}: kills the pet with given name, which will immediately blink out of existence. Forever. 7 | -- PetsKillAll: kills all the pets, poor creatures. Works just as PetsKill but for every pet. 8 | -- PetsPauseToggle: pause/resume animations for all pets, leaving them on screen as cute little statues 9 | -- PetsHideToggle: pause the animation for all pets and hide them / show all the pets again and resume animations 10 | -- PetsIdleToggle/PetsSleepToggle: basically a do-not-disturb mode, pets are still animated but do not move around 11 | fun({ 12 | "giusgad/pets.nvim", 13 | lazy = true, 14 | cmd = { 15 | "PetsNew", 16 | "PetsNewCustom", 17 | "PetsList", 18 | "PetsKill", 19 | "PetsKillAll", 20 | "PetsPauseToggle", 21 | "PetsHideToggle", 22 | "PetsIdleToggle", 23 | "PetsSleepToggle", 24 | }, 25 | dependencies = { "MunifTanjim/nui.nvim", "giusgad/hologram.nvim" }, 26 | opts = { 27 | random = true, 28 | row = 2, 29 | }, 30 | init = function() 31 | vim.api.nvim_create_user_command("LotsOPets", function() 32 | local names = "abcdefghijklmnopqrstuvwxyz" 33 | 34 | local chars = {} 35 | for c in names:gmatch(".") do 36 | vim.cmd.PetsNew(c) 37 | end 38 | end, {}) 39 | end, 40 | config = function(_, opts) 41 | require("pets").setup(opts) 42 | end, 43 | }) 44 | 45 | fun({ 46 | "samuzora/pet.nvim", 47 | lazy = true, 48 | cond = lambda.config.fun.use_pet, 49 | event = "VeryLazy", 50 | config = function() 51 | require("pet-nvim") 52 | end, 53 | }) 54 | 55 | fun({ 56 | "tamton-aquib/duck.nvim", 57 | cmd = { 58 | "DuckUse", 59 | "DuckStop", 60 | }, 61 | config = function() 62 | require("duck").setup({ 63 | height = 5, 64 | width = 5, 65 | }) 66 | lambda.command("DuckUse", function() 67 | require("duck").hatch("🐼") 68 | end, {}) 69 | lambda.command("DuckStop", function() 70 | require("duck").cook() 71 | end, {}) 72 | end, 73 | }) 74 | 75 | -- True emotional Support 76 | fun({ "rtakasuke/vim-neko", cmd = "Neko", lazy = true }) 77 | 78 | fun({ 79 | "tjdevries/sPoNGe-BoB.NvIm", 80 | cmd = "SpOnGeBoBtOgGlE", 81 | }) 82 | fun({ 83 | "0x5a4/oogway.nvim", 84 | cmd = { "Oogway" }, -- for lazy loading 85 | }) 86 | 87 | fun({ 88 | "ragnarok22/whereami.nvim", 89 | cmd = "Whereami", 90 | }) 91 | fun({ 92 | "NStefan002/donut.nvim", 93 | lazy = true, 94 | cond = false, 95 | opts = {}, 96 | }) 97 | -------------------------------------------------------------------------------- /lua/plugins/init.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vsedov/PoloVim/c0fc3f91b36ccc8d75274a072b36a03b5e23646e/lua/plugins/init.lua -------------------------------------------------------------------------------- /lua/plugins/lang/dap/init.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | local fn, icons = vim.fn, lambda.style.icons 3 | 4 | M.keymaps = function() 5 | vim.keymap.set("n", "]d", require("goto-breakpoints").next, {}) 6 | vim.keymap.set("n", "[d", require("goto-breakpoints").prev, {}) 7 | 8 | vim.keymap.set("n", "duc", function() 9 | require("dapui").close() 10 | end, { desc = "dap-ui: close" }) 11 | 12 | vim.keymap.set("n", "dut", function() 13 | require("dapui").toggle() 14 | end, { desc = "dap-ui: toggle" }) 15 | end 16 | M.commands = function() 17 | lambda.command("StartDebug", function() 18 | require("dapui").open() 19 | end, {}) 20 | lambda.command("DebugStop", function() 21 | M.StopDbg() 22 | end, {}) 23 | end 24 | 25 | M.prepare = function() 26 | lambda.debug = { layout = { ft = { python = 2 } } } 27 | local dap = require("dap") 28 | local ui_ok, dapui = pcall(require, "dapui") 29 | 30 | fn.sign_define({ 31 | { name = "DapBreakpoint", texthl = "DapBreakpoint", text = icons.misc.bug, linehl = "", numhl = "" }, 32 | { name = "DapStopped", texthl = "DapStopped", text = icons.misc.bookmark, linehl = "", numhl = "" }, 33 | }) 34 | if not ui_ok then 35 | return 36 | end 37 | dap.listeners.before.event_exited["dapui_config"] = function() 38 | dapui.close() 39 | end 40 | dap.listeners.before.event_terminated["dapui_config"] = function() 41 | dapui.close() 42 | end 43 | dap.listeners.after.event_initialized["dapui_config"] = function() 44 | dapui.open(lambda.debug.layout.ft[vim.bo.ft]) 45 | end 46 | end 47 | 48 | M.StopDbg = function() 49 | require("dap").close() 50 | end 51 | 52 | M.config = function() 53 | local dap = require("dap") 54 | M.keymaps() 55 | M.commands() 56 | M.prepare() 57 | local dap_python = require("dap-python") 58 | dap_python.test_runner = "pytest" 59 | end 60 | 61 | return M 62 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lint_format.lua: -------------------------------------------------------------------------------- 1 | local uv = vim.uv or vim.loop 2 | local prettier = { "prettierd", "prettier" } 3 | local slow_format_filetypes = {} 4 | 5 | local config = {} 6 | function config.get_lsp_fallback(bufnr) 7 | local formatters = require("conform").list_formatters(bufnr) 8 | if #formatters > 0 and formatters[1].name == "trim_whitespace" then 9 | return "always" 10 | else 11 | return true 12 | end 13 | end 14 | 15 | function config.ale() 16 | vim.g.ale_virtualtext_cursor = 0 17 | vim.g.ale_floating_preview = 1 18 | vim.g.ale_float_window_border = { "│", "─", "╭", "╮", "╯", "╰" } 19 | vim.g.ale_set_ballons = 1 20 | vim.g.ale_lint_on_enter = 1 21 | vim.g.ale_warn_about_trailing_whitespace = 0 22 | vim.g.ale_fix_on_save = 1 23 | vim.g.ale_echo_cursor = 0 24 | vim.g.ale_python_flake8_options = "--max-line-length=88 --ignore=E203,E501,W503" 25 | vim.g.ale_python_ruff_options = "--ignore E501" 26 | -- vim.g.ale_python_autoimport_options = "--config-file ~/.vim/autoimport-config.toml" 27 | vim.g.ale_fixers = { 28 | python = { "black", "ruff" }, 29 | cpp = { "clang-format" }, 30 | rust = { "rustfmt" }, 31 | go = { "gopls" }, 32 | typescript = { "eslint" }, 33 | } 34 | vim.g.ale_linters = { 35 | lua = {}, 36 | python = {}, 37 | rust = { "analyzer", "rustc" }, 38 | go = { "gopls" }, 39 | typescript = { "eslint" }, 40 | } 41 | end 42 | 43 | function config.conform(_, opts) 44 | vim.list_extend(require("conform.formatters.shfmt").args, { "-i", "2" }) 45 | if vim.g.started_by_firenvim then 46 | opts.format_on_save = false 47 | opts.format_after_save = false 48 | end 49 | require("conform").setup(opts) 50 | end 51 | 52 | function config.nvim_lint(_, opts) 53 | local lint = require("lint") 54 | lint.linters_by_ft = opts.linters_by_ft 55 | for k, v in pairs(opts.linters) do 56 | lint.linters[k] = v 57 | end 58 | local timer = assert(uv.new_timer()) 59 | local DEBOUNCE_MS = 500 60 | local aug = vim.api.nvim_create_augroup("Lint", { clear = true }) 61 | vim.api.nvim_create_autocmd({ "BufWritePost", "TextChanged", "InsertLeave" }, { 62 | group = aug, 63 | callback = function() 64 | local bufnr = vim.api.nvim_get_current_buf() 65 | timer:stop() 66 | timer:start( 67 | DEBOUNCE_MS, 68 | 0, 69 | vim.schedule_wrap(function() 70 | if vim.api.nvim_buf_is_valid(bufnr) then 71 | vim.api.nvim_buf_call(bufnr, function() 72 | lint.try_lint(nil, { ignore_errors = true }) 73 | end) 74 | end 75 | end) 76 | ) 77 | end, 78 | }) 79 | lint.try_lint(nil, { ignore_errors = true }) 80 | end 81 | 82 | return config 83 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/config/capabilities.lua: -------------------------------------------------------------------------------- 1 | local ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") 2 | if not ok then 3 | return 4 | end 5 | 6 | local caps = vim.lsp.protocol.make_client_capabilities() 7 | caps = cmp_nvim_lsp.default_capabilities(caps) 8 | caps.textDocument.completion.completionItem.snippetSupport = true 9 | 10 | return caps 11 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/config/config.lua: -------------------------------------------------------------------------------- 1 | -- TODO: (vsedov) (17:37:21 - 22/06/23): refactor this into null-ls config instead 2 | local container = { 3 | null_ls = { 4 | diagnostic = { 5 | "cppcheck", 6 | "djlint", 7 | "eslint_d", 8 | "golangci_lint", 9 | "ktlint", 10 | "markdownlint", 11 | "misspell", 12 | "phpcs", 13 | "staticcheck", 14 | "stylelint", 15 | "write_good", 16 | "luacheck", 17 | }, 18 | formatter = { 19 | "scalafmt", 20 | "stylish_haskell", 21 | "djlint", 22 | "fish_indent", 23 | "ktlint", 24 | "markdownlint", 25 | "phpcbf", 26 | "pint", 27 | "prettierd", 28 | "shellharden", 29 | "shfmt", 30 | "stylelint", 31 | "stylua", 32 | -- "trim_newlines", 33 | -- "trim_whitespace", 34 | "pyflyby", 35 | "latexindent", 36 | }, 37 | code_action = { "eslint_d", "gitrebase", "refactoring" }, 38 | }, 39 | } 40 | return container 41 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/config/init.lua: -------------------------------------------------------------------------------- 1 | --https://github.com/LunarVim/LunarVim/tree/rolling/lua/lvim/lsp 2 | -- Modified though 3 | local M = {} 4 | 5 | function M.common_capabilities() 6 | local capabilities = require("plugins.lsp.lsp.config.capabilities") 7 | return capabilities 8 | end 9 | 10 | function M.get_common_opts() 11 | return { 12 | capabilities = M.common_capabilities(), 13 | } 14 | end 15 | 16 | function M.setup() end 17 | 18 | function M.enhance_attach(user_config) 19 | local attach_config = M.get_common_opts() 20 | if user_config then 21 | attach_config = vim.tbl_deep_extend("force", attach_config, user_config) 22 | end 23 | return attach_config 24 | end 25 | 26 | return M 27 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/mason/init.lua: -------------------------------------------------------------------------------- 1 | local sources = require("mason-registry.sources") 2 | require("plugins.lsp.lsp.mason.python") 3 | sources.set_registries({ "lua:mason-registry.index" }) 4 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/c.lua: -------------------------------------------------------------------------------- 1 | local enhance_attach = require("plugins.lsp.lsp.config").enhance_attach 2 | local clangd_defaults = require("lspconfig.server_configurations.clangd") 3 | local clangd_configs = vim.tbl_deep_extend( 4 | "force", 5 | clangd_defaults["default_config"], 6 | enhance_attach({ 7 | cmd = { 8 | "clangd", 9 | "-j=16", 10 | "--background-index", 11 | "--clang-tidy", 12 | "--fallback-style=llvm", 13 | "--all-scopes-completion", 14 | "--completion-style=detailed", 15 | "--header-insertion=iwyu", 16 | "--header-insertion-decorators", 17 | "--pch-storage=memory", 18 | }, 19 | }) 20 | ) 21 | require("clangd_extensions").setup({ 22 | server = clangd_configs, 23 | extensions = { 24 | autoSetHints = true, 25 | hover_with_actions = true, 26 | -- These apply to the default ClangdSetInlayHints command 27 | inlay_hints = { 28 | 29 | -- Only show inlay hints for the current line 30 | only_current_line = true, 31 | -- Event which triggers a refersh of the inlay hints. 32 | -- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but 33 | -- not that this may cause higher CPU usage. 34 | -- This option is only respected when only_current_line and 35 | -- autoSetHints both are true. 36 | only_current_line_autocmd = "CursorHold", 37 | -- whether to show parameter hints with the inlay hints or not 38 | show_parameter_hints = true, 39 | -- prefix for parameter hints 40 | parameter_hints_prefix = "<- ", 41 | -- prefix for all the other hints (type, chaining) 42 | other_hints_prefix = "=> ", 43 | -- whether to align to the length of the longest line in the file 44 | max_len_align = false, 45 | -- padding from the left if max_len_align is true 46 | max_len_align_padding = 1, 47 | -- whether to align to the extreme right or not 48 | right_align = false, 49 | -- padding from the right if right_align is true 50 | right_align_padding = 7, 51 | -- The color of the hints 52 | highlight = "Comment", 53 | }, 54 | }, 55 | }) 56 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/julials.lua: -------------------------------------------------------------------------------- 1 | return { 2 | cmd = { "juliacli", "server" }, 3 | settings = { 4 | julia = { 5 | usePlotPane = false, 6 | symbolCacheDownload = false, 7 | runtimeCompletions = true, 8 | singleFileSupport = false, 9 | useRevise = true, 10 | lint = { 11 | NumThreads = 16, 12 | missingrefs = "all", 13 | iter = true, 14 | lazy = true, 15 | modname = true, 16 | }, 17 | }, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/latex/ltex.lua: -------------------------------------------------------------------------------- 1 | return { 2 | settings = { 3 | ltex = { 4 | language = "en-GB", 5 | additionalRules = { 6 | enablePickyRules = true, 7 | }, 8 | checkFrequency = "save", 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/basedpyright.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.attach_config = function(client, bufnr) end 4 | M.config = { 5 | settings = { 6 | pyright = { 7 | disableOrganizeImports = true, 8 | }, 9 | python = { 10 | analysis = { 11 | ignore = { "*" }, 12 | }, 13 | }, 14 | }, 15 | } 16 | return M 17 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/jedi_language_server.lua: -------------------------------------------------------------------------------- 1 | -- Quick Note: I think this is a great language server that provides almost everything you would 2 | -- need thoughthere are a few isseus that are a bit annoying, and i hope that they get resolved 3 | -- soon 4 | local py = require("plugins.lsp.lsp.providers.python.utils.python_help") 5 | 6 | return { 7 | init_options = { 8 | jediSettings = { 9 | case_insensitive_completion = true, 10 | add_bracket_after_function = true, 11 | dynamic_params = true, 12 | -- Allot of machine learning models that are set from default. 13 | autoImportModules = { "numpy", "matplotlib", "random", "math", "scipy" }, 14 | }, 15 | }, 16 | 17 | on_new_config = function(new_config, new_root_dir) 18 | new_config.settings.python.pythonPath = vim.fn.exepath("python") 19 | print(new_config.settings.python.pythonPath) 20 | new_config.cmd_env.PATH = py.env(new_root_dir) .. new_config.cmd_env.PATH 21 | 22 | local pep582 = py.pep582(new_root_dir) 23 | if pep582 ~= nil then 24 | new_config.settings.python.analysis.extraPaths = { pep582 } 25 | end 26 | end, 27 | } 28 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/pylance.lua: -------------------------------------------------------------------------------- 1 | local py = require("plugins.lsp.lsp.providers.python.utils.python_help") 2 | local path = require("mason-core.path") 3 | local ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") 4 | if not ok then 5 | return 6 | end 7 | local caps = vim.lsp.protocol.make_client_capabilities() 8 | caps = cmp_nvim_lsp.default_capabilities(caps) 9 | caps.textDocument.completion.completionItem.snippetSupport = true 10 | caps.textDocument.onTypeFormatting = { dynamicRegistration = false } 11 | caps.offsetEncoding = { "utf-16" } 12 | 13 | return { 14 | 15 | capabilities = caps, 16 | on_init = function(client) 17 | client.config.settings.python.pythonPath = (function(workspace) 18 | if vim.env.VIRTUAL_ENV then 19 | return path.join(vim.env.VIRTUAL_ENV, "bin", "python") 20 | end 21 | if vim.fn.filereadable(path.concat({ workspace, "poetry.lock" })) then 22 | local venv = vim.fn.trim(vim.fn.system("poetry env info -p")) 23 | return path.concat({ venv, "bin", "python" }) 24 | end 25 | local pep582 = py.pep582(client) 26 | if pep582 ~= nil then 27 | client.config.settings.python.analysis.extraPaths = { pep582 } 28 | end 29 | return vim.fn.exepath("python3") or vim.fn.exepath("python") or "python" 30 | end)(client.config.root_dir) 31 | end, 32 | before_init = function(_, config) 33 | config.settings.python.analysis.stubPath = path.concat({ 34 | vim.fn.stdpath("data"), 35 | "lazy", 36 | "python-type-stubs", 37 | }) 38 | end, 39 | } 40 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/pylsp.lua: -------------------------------------------------------------------------------- 1 | local util = require("lspconfig/util") 2 | local py = require("plugins.lsp.lsp.providers.python.utils.python_help") 3 | local path = require("mason-core.path") 4 | return { 5 | settings = { 6 | pylsp = { 7 | plugins = { 8 | pyflakes = { enabled = false }, 9 | yapf = { enabled = false }, 10 | isort = { enabled = false }, 11 | mccabe = { enabled = false, threshold = 15 }, 12 | pylint = { enabled = false }, 13 | preload = { enabled = false }, 14 | pycodestyle = { enabled = false }, 15 | pydocstyle = { enabled = false }, 16 | ruff = { enable = false }, 17 | flake8 = { enabled = false }, 18 | jedi_completion = { fuzzy = true, enabled = true }, 19 | jedi_hover = { enabled = true }, 20 | jedi_references = { enabled = true }, 21 | jedi_signature_help = { enabled = true }, 22 | jedi_symbols = { enabled = true, all_scopes = true }, 23 | rope = { enable = true }, 24 | rope_completion = { enabled = false }, 25 | }, 26 | }, 27 | }, 28 | root_dir = function(fname) 29 | local root_files = { 30 | "pyproject.toml", 31 | "setup.py", 32 | "setup.cfg", 33 | "requirements.txt", 34 | "Pipfile", 35 | } 36 | return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) 37 | end, 38 | on_new_config = function(client) 39 | client.config.settings.python.pythonPath = function() 40 | if vim.env.VIRTUAL_ENV or require("plugins.lsp.lsp.providers.python.utils.python_help").in_any_env() then 41 | return vim.fn.exepath("python3") 42 | end 43 | 44 | if vim.env.VIRTUAL_ENV then 45 | return path.join(vim.env.VIRTUAL_ENV, "bin", "python") 46 | end 47 | local pep582 = py.pep582(client) 48 | if pep582 ~= nil then 49 | client.config.settings.python.analysis.extraPaths = { pep582 } 50 | end 51 | end 52 | end, 53 | } 54 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/pylyzer.lua: -------------------------------------------------------------------------------- 1 | local py = require("plugins.lsp.lsp.providers.python.utils.python_help") 2 | local path = require("mason-core.path") 3 | local ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") 4 | if not ok then 5 | return 6 | end 7 | local caps = vim.lsp.protocol.make_client_capabilities() 8 | caps = cmp_nvim_lsp.default_capabilities(caps) 9 | caps.textDocument.completion.completionItem.snippetSupport = true 10 | 11 | local util = require("lspconfig").util 12 | return { 13 | -- filetypes = { "python" }, 14 | -- root_dir = function(fname) 15 | -- local root_files = { 16 | -- "setup.py", 17 | -- "tox.ini", 18 | -- "requirements.txt", 19 | -- "Pipfile", 20 | -- "pyproject.toml", 21 | -- } 22 | -- return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) 23 | -- end, 24 | -- settings = { 25 | -- python = { 26 | -- diagnostics = false, 27 | -- inlayHints = true, 28 | -- smartCompletion = false, 29 | -- checkOnType = false, 30 | -- }, 31 | -- }, 32 | -- capabilities = caps, 33 | -- on_init = function(client) 34 | -- client.config.settings.python.pythonPath = (function(workspace) 35 | -- if vim.env.VIRTUAL_ENV then 36 | -- return path.join(vim.env.VIRTUAL_ENV, "bin", "python") 37 | -- end 38 | -- if vim.fn.filereadable(path.concat({ workspace, "poetry.lock" })) then 39 | -- local venv = vim.fn.trim(vim.fn.system("poetry env info -p")) 40 | -- return path.concat({ venv, "bin", "python" }) 41 | -- end 42 | -- local pep582 = py.pep582(client) 43 | -- if pep582 ~= nil then 44 | -- client.config.settings.python.analysis.extraPaths = { pep582 } 45 | -- end 46 | -- return vim.fn.exepath("python3") or vim.fn.exepath("python") or "python" 47 | -- end)(client.config.root_dir) 48 | -- end, 49 | -- before_init = function(_, config) 50 | -- config.settings.python.analysis.stubPath = path.concat({ 51 | -- vim.fn.stdpath("data"), 52 | -- "lazy", 53 | -- "python-type-stubs", 54 | -- }) 55 | -- end, 56 | } 57 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/python_lsp_server.lua: -------------------------------------------------------------------------------- 1 | local util = require("lspconfig/util") 2 | local py = require("plugins.lsp.lsp.providers.python.utils.python_help") 3 | local path = require("mason-core.path") 4 | return { 5 | settings = { 6 | pylsp = { 7 | plugins = { 8 | pyflakes = { enabled = false }, 9 | yapf = { enabled = false }, 10 | isort = { enabled = false }, 11 | mccabe = { enabled = false, threshold = 15 }, 12 | pylint = { enabled = false }, 13 | preload = { enabled = false }, 14 | pycodestyle = { enabled = false }, 15 | pydocstyle = { enabled = false }, 16 | ruff = { enable = false }, 17 | flake8 = { enabled = false }, 18 | jedi_completion = { fuzzy = true, enabled = true }, 19 | jedi_hover = { enabled = true }, 20 | jedi_references = { enabled = true }, 21 | jedi_signature_help = { enabled = true }, 22 | jedi_symbols = { enabled = true, all_scopes = true }, 23 | rope = { enable = true }, 24 | rope_completion = { enabled = false }, 25 | }, 26 | }, 27 | }, 28 | root_dir = function(fname) 29 | local root_files = { 30 | "pyproject.toml", 31 | "setup.py", 32 | "setup.cfg", 33 | "requirements.txt", 34 | "Pipfile", 35 | } 36 | return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) 37 | end, 38 | on_new_config = function(client) 39 | client.config.settings.python.pythonPath = function() 40 | if vim.env.VIRTUAL_ENV or require("plugins.lsp.lsp.providers.python.utils.python_help").in_any_env() then 41 | return vim.fn.exepath("python3") 42 | end 43 | 44 | if vim.env.VIRTUAL_ENV then 45 | return path.join(vim.env.VIRTUAL_ENV, "bin", "python") 46 | end 47 | local pep582 = py.pep582(client) 48 | if pep582 ~= nil then 49 | client.config.settings.python.analysis.extraPaths = { pep582 } 50 | end 51 | end 52 | end, 53 | } 54 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/ruff.lua: -------------------------------------------------------------------------------- 1 | local py = require("plugins.lsp.lsp.providers.python.utils.python_help") 2 | 3 | return { 4 | filetypes = { "python" }, 5 | on_new_config = function(config, new_workspace) 6 | config.settings.python.pythonPath = vim.fn.exepath("python") or vim.fn.exepath("python3") or "python" 7 | config.cmd_env.PATH = py.env(new_workspace) .. new_workspace.cmd_env.PATH 8 | return config 9 | end, 10 | } 11 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/sourcery.lua: -------------------------------------------------------------------------------- 1 | -- env = vim 2 | -- SOURCERY 3 | return { 4 | init_options = { 5 | token = os.getenv("SOURCERY"), 6 | extension_version = "vim.lsp", 7 | editor_version = "vim", 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/utils/init.lua: -------------------------------------------------------------------------------- 1 | local U = {} 2 | 3 | -- U.common = require "plugins.lsp.lsp.providers.python..utils.common" 4 | 5 | return U 6 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lsp/providers/python/utils/python_help.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local path = require("lspconfig.util").path 4 | 5 | local function get_pipenv_dir() 6 | return vim.fn.trim(vim.fn.system("pipenv --venv")) 7 | end 8 | 9 | local function get_poetry_dir() 10 | return vim.fn.trim(vim.fn.system("poetry env info -p")) 11 | end 12 | 13 | local function get_pdm_package() 14 | return vim.fn.trim(vim.fn.system("pdm info --packages")) 15 | end 16 | 17 | local function in_conda_env() 18 | if 19 | vim.fn.trim( 20 | vim.fn.system( 21 | '[[ -n "$CONDA_PREFIX" ]] && echo "In a conda env: $CONDA_DEFAULT_ENV" || echo "Not in a conda env"' 22 | ) 23 | ) 24 | then 25 | return true 26 | end 27 | end 28 | 29 | local function get_python_dir(workspace) 30 | local conda_match = in_conda_env() 31 | if conda_match then 32 | return vim.fn.trim(vim.fn.system("which python")) 33 | end 34 | 35 | local poetry_match = vim.fn.glob(path.join(workspace, "poetry.lock")) 36 | if poetry_match ~= "" then 37 | return get_poetry_dir() 38 | end 39 | 40 | local pipenv_match = vim.fn.glob(path.join(workspace, "Pipfile.lock")) 41 | if pipenv_match ~= "" then 42 | return get_pipenv_dir() 43 | end 44 | 45 | -- Find and use virtualenv in workspace directory. 46 | for _, pattern in ipairs({ "*", ".*" }) do 47 | local match = vim.fn.glob(path.join(workspace, pattern, "pyvenv.cfg")) 48 | if match ~= "" then 49 | return path.dirname(match) 50 | end 51 | end 52 | 53 | return "" 54 | end 55 | 56 | local _virtual_env = "" 57 | local _package = "" 58 | 59 | local function py_bin_dir() 60 | return path.join(_virtual_env, "bin:") 61 | end 62 | 63 | M.in_any_env = function() 64 | return in_conda_env() or vim.fn.glob("Pipfile.lock") ~= "" or vim.fn.glob("poetry.lock") ~= "" 65 | end 66 | 67 | M.env = function(root_dir) 68 | if not vim.env.VIRTUAL_ENV or vim.env.VIRTUAL_ENV == "" then 69 | _virtual_env = get_python_dir(root_dir) 70 | end 71 | 72 | if _virtual_env ~= "" then 73 | vim.env.VIRTUAL_ENV = _virtual_env 74 | vim.env.PATH = py_bin_dir() .. vim.env.PATH 75 | end 76 | 77 | if _virtual_env ~= "" and vim.env.PYTHONHOME then 78 | vim.env.old_PYTHONHOME = vim.env.PYTHONHOME 79 | vim.env.PYTHONHOME = "" 80 | end 81 | 82 | return _virtual_env ~= "" and py_bin_dir() or "" 83 | end 84 | 85 | -- PEP 582 support 86 | M.pep582 = function(root_dir) 87 | local pdm_match = vim.fn.glob(path.join(root_dir, "pdm.lock")) 88 | if pdm_match ~= "" then 89 | _package = get_pdm_package() 90 | end 91 | 92 | if _package ~= "" then 93 | return path.join(_package, "lib") 94 | end 95 | end 96 | 97 | M.conda = function(root_dir) 98 | local conda_match = in_conda_env() 99 | -- In a conda env: main 100 | -- or 101 | -- Not in a conda env 102 | 103 | if conda_match then 104 | return vim.fn.trim(vim.fn.system("conda info --base")) 105 | .. "/envs/" 106 | .. vim.fn.trim(vim.fn.system("conda info --envs | grep '*' | awk '{print $1}'")) 107 | end 108 | 109 | return "" 110 | end 111 | 112 | return M 113 | -------------------------------------------------------------------------------- /lua/plugins/mini/config.lua: -------------------------------------------------------------------------------- 1 | local config = {} 2 | return config 3 | -------------------------------------------------------------------------------- /lua/plugins/mini/plugins.lua: -------------------------------------------------------------------------------- 1 | local mini = require("core.pack").package 2 | vim.api.nvim_create_autocmd("FileType", { 3 | pattern = { 4 | "alpha", 5 | "coc-explorer", 6 | "dashboard", 7 | "fzf", -- fzf-lua 8 | "help", 9 | "lazy", 10 | "lazyterm", 11 | "lspsagafinder", 12 | "mason", 13 | "nnn", 14 | "notify", 15 | "NvimTree", 16 | "qf", 17 | "starter", -- mini.starter 18 | "toggleterm", 19 | "Trouble", 20 | "neoai-input", 21 | "neoai-*", 22 | "neoai-output", 23 | "neo-tree", 24 | "neo-*", 25 | "neorg", 26 | "norg", 27 | "*.norg", 28 | "*norg", 29 | "*neorg", 30 | }, 31 | callback = function() 32 | vim.b.miniindentscope_disable = true 33 | vim.schedule(function() 34 | if MiniIndentscope then 35 | MiniIndentscope.undraw() 36 | end 37 | end) 38 | end, 39 | }) 40 | 41 | mini({ 42 | "echasnovski/mini.indentscope", 43 | cond = lambda.config.ui.indent_lines.use_mini_indent_scope, 44 | event = { "VeryLazy" }, 45 | opts = { 46 | symbol = "│", 47 | options = { 48 | border = "both", 49 | indent_at_cursor = true, 50 | try_as_border = true, 51 | }, 52 | }, 53 | }) 54 | 55 | mini({ 56 | "echasnovski/mini.trailspace", 57 | event = "VeryLazy", 58 | init = function() 59 | lambda.command("TrimTrailSpace", function() 60 | MiniTrailspace.trim() 61 | end, {}) 62 | lambda.command("TrimLastLine", function() 63 | MiniTrailspace.trim_last_lines() 64 | end, {}) 65 | end, 66 | config = true, 67 | }) 68 | -------------------------------------------------------------------------------- /lua/plugins/python/config.lua: -------------------------------------------------------------------------------- 1 | local config = {} 2 | function config.swenv() 3 | require("swenv").setup({ 4 | -- Should return a list of tables with a `name` and a `path` entry each. 5 | -- Gets the argument `venvs_path` set below. 6 | -- By default just lists the entries in `venvs_path`. 7 | get_venvs = function(venvs_path) 8 | return require("swenv.api").get_venvs(venvs_path) 9 | end, 10 | -- Path passed to `get_venvs`. 11 | venvs_path = vim.fn.expand("/home/viv/.cache/pypoetry/virtualenvs/"), 12 | -- Something to do after setting an environment 13 | post_set_venv = nil, 14 | }) 15 | lambda.command("VenvFind", function() 16 | require("swenv.api").pick_venv() 17 | end, {}) 18 | lambda.command("GetVenv", function() 19 | require("swenv.api").get_current_venv() 20 | end, {}) 21 | end 22 | return config 23 | -------------------------------------------------------------------------------- /lua/plugins/python/init.lua: -------------------------------------------------------------------------------- 1 | require("python").setup() 2 | require("python_import").setup({}) 3 | -------------------------------------------------------------------------------- /lua/plugins/runner/init.lua: -------------------------------------------------------------------------------- 1 | local conf = require("plugins.runner.config") 2 | conf.overseer() 3 | conf.neotest() 4 | 5 | -------------------------------------------------------------------------------- /lua/plugins/search/init.lua: -------------------------------------------------------------------------------- 1 | local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() 2 | parser_configs.markdown.filetype_to_parsername = "octo" 3 | 4 | require("nvim-treesitter.configs").setup({ 5 | autopairs = { enable = false }, 6 | matchup = { 7 | enable = lambda.config.treesitter.use_matchup, 8 | disable = { "latex", "tex", "bib" }, 9 | }, 10 | highlight = { 11 | enable = true, -- false will disable the whole extension 12 | additional_vim_regex_highlighting = lambda.config.treesitter.use_extra_highlight, 13 | disable = { "latex", "tex", "bib" }, 14 | }, 15 | incremental_selection = { 16 | enable = false, 17 | -- disable = {"elm"}, 18 | keymaps = { 19 | -- mappings for incremental selection (visual mappings) 20 | init_selection = "gnn", -- maps in normal mode to init the node/scope selection 21 | scope_incremental = "gnN", -- increment to the upper scope (as defined in locals.scm) 22 | node_incremental = "", -- increment to the upper named parent 23 | node_decremental = "", -- decrement to the previous node 24 | }, 25 | }, 26 | }) 27 | local telescope = require("telescope") 28 | local lga_actions = require("telescope-live-grep-args.actions") 29 | 30 | local plugins = { 31 | "telescope-live-grep-args.nvim", 32 | "telescope-file-browser.nvim", 33 | "telescope-bookmarks.nvim", 34 | "telescope-sg", 35 | } 36 | for _, v in ipairs(plugins) do 37 | vim.cmd("packadd " .. v) 38 | end 39 | -- require("telescope").setup({ 40 | -- extensions = { 41 | -- conda = { anaconda_path = "/home/viv/.conda/" }, 42 | -- bookmarks = { 43 | -- selected_browser = "firefox", 44 | -- url_open_command = "open", 45 | -- profile_name = "default-nightly-1", 46 | -- url_open_plugin = nil, 47 | -- full_path = true, 48 | -- buku_include_tags = false, 49 | -- debug = false, 50 | -- }, 51 | -- }, 52 | -- }) 53 | telescope.load_extension("zf-native") 54 | telescope.load_extension("file_browser") 55 | 56 | telescope.setup({ 57 | extensions = { 58 | live_grep_args = { 59 | auto_quoting = true, -- enable/disable auto-quoting 60 | -- define mappings, e.g. 61 | mappings = { -- extend mappings 62 | i = { 63 | [""] = lga_actions.quote_prompt(), 64 | [""] = lga_actions.quote_prompt({ postfix = " --iglob " }), 65 | -- freeze the current list and start a fuzzy search in the frozen list 66 | }, 67 | }, 68 | -- ... also accepts theme settings, for example: 69 | -- theme = "dropdown", -- use dropdown theme 70 | -- theme = { }, -- use own theme spec 71 | -- layout_config = { mirror=true }, -- mirror preview pane 72 | }, 73 | }, 74 | }) 75 | 76 | telescope.load_extension("live_grep_args") 77 | -------------------------------------------------------------------------------- /lua/plugins/startup/init.lua: -------------------------------------------------------------------------------- 1 | require("abstract-autocmds").setup({ 2 | auto_resize_splited_window = true, 3 | remove_whitespace_on_save = true, 4 | no_autocomment_newline = true, 5 | clear_last_used_search = true, 6 | highlight_on_yank = { 7 | enable = true, 8 | opts = { 9 | timeout = 150, 10 | }, 11 | }, 12 | give_border = { 13 | enable = true, 14 | opts = { 15 | pattern = { "null-ls-info", "lspinfo" }, 16 | }, 17 | }, 18 | smart_dd = false, 19 | visually_codeblock_shift = true, 20 | move_selected_upndown = true, 21 | dont_suspend_with_cz = true, 22 | scroll_from_center = true, 23 | ctrl_backspace_delete = true, 24 | 25 | -- Binds that i already have that are better than this 26 | go_back_normal_in_terminal = true, 27 | smart_visual_paste = true, 28 | smart_save_in_insert_mode = false, 29 | open_file_last_position = false, 30 | -- ────────────────────────────────────────────────────────────────────── 31 | }) 32 | vim.g.RecoverPlugin_Edit_Unmodified = 1 33 | -------------------------------------------------------------------------------- /lua/plugins/test/config.lua: -------------------------------------------------------------------------------- 1 | local config = {} 2 | 3 | function config.hexokinase() 4 | vim.g.Hexokinase_optInPatterns = { 5 | "full_hex", 6 | "triple_hex", 7 | "rgb", 8 | "rgba", 9 | "hsl", 10 | "hsla", 11 | "colour_names", 12 | } 13 | vim.g.Hexokinase_highlighters = { 14 | "virtual", 15 | "sign_column", -- 'background', 16 | "backgroundfull", 17 | -- 'foreground', 18 | -- 'foregroundfull' 19 | } 20 | end 21 | 22 | function config.diaglist() 23 | require("diaglist").init({ 24 | debug = false, 25 | debounce_ms = 150, 26 | }) 27 | local add_cmd = vim.api.nvim_create_user_command 28 | 29 | vim.api.nvim_create_user_command("Qfa", function() 30 | require("diaglist").open_all_diagnostics() 31 | end, { force = true }) 32 | 33 | vim.api.nvim_create_user_command("Qfb", function() 34 | vim.diagnostic.setqflist() 35 | require("diaglist").open_buffer_diagnostics() 36 | end, { force = true }) 37 | 38 | vim.keymap.set( 39 | "n", 40 | "qw", 41 | "lua require('diaglist').open_all_diagnostics()", 42 | { noremap = true, silent = true } 43 | ) 44 | vim.keymap.set("n", "qf", function() 45 | vim.diagnostic.setqflist() 46 | 47 | require("diaglist").open_buffer_diagnostics() 48 | end, { noremap = true, silent = true }) 49 | end 50 | 51 | function config.carbon() 52 | require("carbon-now").setup({ 53 | options = { 54 | theme = "dracula pro", 55 | window_theme = "none", 56 | font_family = "Hack", 57 | font_size = "18px", 58 | bg = "gray", 59 | line_numbers = true, 60 | line_height = "133%", 61 | drop_shadow = false, 62 | drop_shadow_offset_y = "20px", 63 | drop_shadow_blur = "68px", 64 | width = "680", 65 | watermark = false, 66 | }, 67 | }) 68 | end 69 | 70 | return config 71 | -------------------------------------------------------------------------------- /lua/plugins/tmux/plugins.lua: -------------------------------------------------------------------------------- 1 | local tmux = require("core.pack").package 2 | 3 | tmux({ 4 | "wincent/terminus", 5 | cond = vim.fn.getenv("TMUX") ~= vim.NIL, 6 | event = "VeryLazy", 7 | }) 8 | -- 9 | -- tmux({ 10 | -- "aserowy/tmux.nvim", 11 | -- cond = vim.fn.getenv("TMUX") ~= vim.NIL, 12 | -- config = function() 13 | -- require("tmux").setup({ 14 | -- copy_sync = { 15 | -- -- enables copy sync. by default, all registers are synchronized. 16 | -- -- to control which registers are synced, see the `sync_*` options. 17 | -- enable = true, 18 | -- 19 | -- -- ignore specific tmux buffers e.g. buffer0 = true to ignore the 20 | -- -- first buffer or named_buffer_name = true to ignore a named tmux 21 | -- -- buffer with name named_buffer_name :) 22 | -- ignore_buffers = { empty = false }, 23 | -- 24 | -- -- TMUX >= 3.2: all yanks (and deletes) will get redirected to system 25 | -- -- clipboard by tmux 26 | -- redirect_to_clipboard = false, 27 | -- 28 | -- -- offset controls where register sync starts 29 | -- -- e.g. offset 2 lets registers 0 and 1 untouched 30 | -- register_offset = 0, 31 | -- 32 | -- -- overwrites vim.g.clipboard to redirect * and + to the system 33 | -- -- clipboard using tmux. If you sync your system clipboard without tmux, 34 | -- -- disable this option! 35 | -- sync_clipboard = true, 36 | -- 37 | -- -- synchronizes registers *, +, unnamed, and 0 till 9 with tmux buffers. 38 | -- sync_registers = true, 39 | -- 40 | -- -- syncs deletes with tmux clipboard as well, it is adviced to 41 | -- -- do so. Nvim does not allow syncing registers 0 and 1 without 42 | -- -- overwriting the unnamed register. Thus, ddp would not be possible. 43 | -- sync_deletes = true, 44 | -- 45 | -- -- syncs the unnamed register with the first buffer entry from tmux. 46 | -- sync_unnamed = true, 47 | -- }, 48 | -- navigation = { 49 | -- -- cycles to opposite pane while navigating into the border 50 | -- cycle_navigation = true, 51 | -- 52 | -- -- enables default keybindings (C-hjkl) for normal mode 53 | -- enable_default_keybindings = true, 54 | -- 55 | -- -- prevents unzoom tmux when navigating beyond vim border 56 | -- persist_zoom = false, 57 | -- }, 58 | -- resize = { 59 | -- -- enables default keybindings (A-hjkl) for normal mode 60 | -- enable_default_keybindings = true, 61 | -- 62 | -- -- sets resize steps for x axis 63 | -- resize_step_x = 1, 64 | -- 65 | -- -- sets resize steps for y axis 66 | -- resize_step_y = 1, 67 | -- }, 68 | -- }) 69 | -- end, 70 | -- }) 71 | -------------------------------------------------------------------------------- /lua/plugins/tpope/plugins.lua: -------------------------------------------------------------------------------- 1 | local tpope = require("core.pack").package 2 | 3 | tpope({ 4 | "tpope/vim-eunuch", 5 | cmd = { 6 | "Delete", 7 | "Unlink", 8 | "Move", 9 | "Rename", 10 | "Chmod", 11 | "Mkdir", 12 | "Cfind", 13 | "Clocate", 14 | "Lfind", 15 | "Wall", 16 | }, 17 | }) 18 | tpope({ 19 | "tpope/vim-repeat", 20 | lazy = true, 21 | event = lambda.event.default, 22 | }) 23 | -------------------------------------------------------------------------------- /lua/plugins/windows/config.lua: -------------------------------------------------------------------------------- 1 | local config = {} 2 | 3 | return config 4 | -- 5 | -- -- -- for example `10` will `resize_left` by `(10 * config.default_amount)` 6 | -- -- vim.keymap.set('n', '', require('smart-splits').resize_left) 7 | -- -- vim.keymap.set('n', '', require('smart-splits').resize_down) 8 | -- -- vim.keymap.set('n', '', require('smart-splits').resize_up) 9 | -- -- vim.keymap.set('n', '', require('smart-splits').resize_right) 10 | -- -- -- moving between splits 11 | -- -- vim.keymap.set('n', '', require('smart-splits').move_cursor_left) 12 | -- -- vim.keymap.set('n', '', require('smart-splits').move_cursor_down) 13 | -- -- vim.keymap.set('n', '', require('smart-splits').move_cursor_up) 14 | -- vim.keymap.set("", "", "TmuxNavigateRight", {}) 15 | -------------------------------------------------------------------------------- /lua/rocks_bulk_install.lua: -------------------------------------------------------------------------------- 1 | local test = { 2 | "danymat/neogen", 3 | "L3MON4D3/LuaSnip", 4 | "prichrd/refgo.nvim", 5 | "amrbashir/nvim-docs-view", 6 | "KabbAmine/zeavim.vim", 7 | "romainl/vim-devdocs", 8 | "loganswartz/updoc.nvim", 9 | "lalitmee/browse.nvim", 10 | "nvim-telescope/telescope.nvim", 11 | "piersolenski/wtf.nvim", 12 | "dpayne/CodeGPT.nvim", 13 | } 14 | local function is_installed(plugin_name) 15 | local rocks_file = "/home/viv/.config/nvim/rocks.toml" 16 | local file = io.open(rocks_file, "r") 17 | if not file then 18 | return false 19 | end 20 | 21 | local in_plugins_section = false 22 | for line in file:lines() do 23 | if line:match("%[plugins%]") then 24 | in_plugins_section = true 25 | elseif in_plugins_section and line:match("%[.*%]") then 26 | break 27 | end 28 | 29 | if in_plugins_section and line:match('"%s*' .. plugin_name .. '%s*"') then 30 | file:close() 31 | return true 32 | end 33 | end 34 | 35 | file:close() 36 | return false 37 | end 38 | 39 | local function execute_command_and_check(cmd, plugin_name, opt) 40 | return coroutine.create(function() 41 | if opt then 42 | cmd = cmd .. " opt=true" 43 | end 44 | vim.cmd(cmd) 45 | coroutine.yield() 46 | if is_installed(plugin_name) then 47 | print(plugin_name .. " installed successfully.") 48 | else 49 | print("Failed to install " .. plugin_name) 50 | end 51 | end) 52 | end 53 | 54 | local function run_tasks(tasks) 55 | local co = coroutine.create(function() 56 | for _, task in ipairs(tasks) do 57 | coroutine.resume(task) 58 | end 59 | end) 60 | 61 | local function step() 62 | if coroutine.status(co) ~= "dead" then 63 | coroutine.resume(co) 64 | vim.defer_fn(step, 20000) -- Adjust delay as needed 65 | end 66 | end 67 | 68 | step() 69 | end 70 | 71 | local tasks = {} 72 | for _, plugin in ipairs(test) do 73 | local short_name = plugin:match("[^/]+$") -- Extracts the "plugin_name.nvim" from "author/plugin_name.nvim" 74 | 75 | if not is_installed(short_name) then 76 | table.insert(tasks, execute_command_and_check("Rocks! install " .. short_name, short_name, true)) 77 | else 78 | print(short_name .. " is already installed.") 79 | end 80 | 81 | if not is_installed(short_name) then 82 | table.insert(tasks, execute_command_and_check("Rocks! install " .. plugin, short_name, true)) 83 | end 84 | end 85 | 86 | run_tasks(tasks) 87 | -------------------------------------------------------------------------------- /lua/rocks_utils/init.lua: -------------------------------------------------------------------------------- 1 | require("rocks_utils.utils") 2 | -------------------------------------------------------------------------------- /lua/rocks_utils/rocks.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local states = {} 3 | 4 | local trigger_load = require("lz.n").trigger_load 5 | 6 | ---@param mod_path string 7 | ---@return boolean 8 | local function call(mod_path) 9 | local plugins = {} 10 | for _, has in pairs(states) do 11 | local plugin = has(mod_path) 12 | if plugin ~= nil then 13 | table.insert(plugins, plugin) 14 | end 15 | end 16 | if plugins ~= {} then 17 | trigger_load(plugins) 18 | return true 19 | end 20 | return false 21 | end 22 | 23 | -- this is probably the most naive way to check if this is a submodule or not 24 | local function starts_with(str, prefix) 25 | if str == nil or prefix == nil then 26 | return false 27 | end 28 | return string.sub(str, 1, string.len(prefix)) == prefix 29 | end 30 | 31 | -- NOTE: the handler for lz.n 32 | 33 | ---@class lz.n.ReqHandler: lz.n.Handler 34 | ---@type lz.n.ReqHandler 35 | local M = { 36 | spec_field = "on_require", 37 | ---@param plugin lz.n.Plugin 38 | del = function(plugin) 39 | states[plugin.name] = nil 40 | end, 41 | } 42 | 43 | ---@class lz_n_plugin: lz.n.Plugin 44 | ---@field on_require? string[]|string 45 | 46 | ---Adds a plugin to be lazy loaded upon requiring any submodule of provided mod paths 47 | ---@param plugin lz_n_plugin 48 | function M.add(plugin) 49 | local on_req = plugin.on_require 50 | ---@type string[] 51 | local mod_paths = {} 52 | if type(on_req) == "table" then 53 | ---@cast on_req string[] 54 | mod_paths = on_req 55 | elseif type(on_req) == "string" then 56 | mod_paths = { on_req } 57 | else 58 | return 59 | end 60 | ---@param mod_path string 61 | ---@return lz_n_plugin|nil 62 | states[plugin.name] = function(mod_path) 63 | for _, v in ipairs(mod_paths) do 64 | if starts_with(mod_path, v) then 65 | return plugin 66 | end 67 | end 68 | return nil 69 | end 70 | end 71 | 72 | -- NOTE: the thing that calls the load... 73 | -- replacing the global require function with one that calls our call function 74 | 75 | local oldrequire = require 76 | require("_G").require = function(mod_path) 77 | local ok, value = pcall(oldrequire, mod_path) 78 | if ok then 79 | return value 80 | end 81 | package.loaded[mod_path] = nil 82 | if call(mod_path) == true then 83 | return oldrequire(mod_path) 84 | end 85 | error(value) 86 | end 87 | 88 | return M 89 | -------------------------------------------------------------------------------- /lua/utils/helpers/asyncmake.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/ms-jpq/neovim-async-tutorial for more tips 2 | local M = {} 3 | 4 | function M.make() 5 | local lines = { "" } 6 | local winnr = vim.fn.win_getid() 7 | local bufnr = vim.api.nvim_win_get_buf(winnr) 8 | 9 | local makeprg = vim.api.nvim_buf_get_option(bufnr, "GoBuild") 10 | if not makeprg then 11 | return 12 | end 13 | 14 | local cmd = vim.fn.expandcmd(makeprg) 15 | 16 | local function on_event(job_id, data, event) 17 | if event == "stdout" or event == "stderr" then 18 | if data then 19 | vim.list_extend(lines, data) 20 | end 21 | end 22 | 23 | if event == "exit" then 24 | vim.fn.setqflist({}, " ", { 25 | title = cmd, 26 | lines = lines, 27 | efm = vim.api.nvim_buf_get_option(bufnr, "errorformat"), 28 | }) 29 | vim.api.nvim_command("doautocmd QuickFixCmdPost") 30 | end 31 | end 32 | 33 | local job_id = vim.fn.jobstart(cmd, { 34 | on_stderr = on_event, 35 | on_stdout = on_event, 36 | on_exit = on_event, 37 | stdout_buffered = true, 38 | stderr_buffered = true, 39 | }) 40 | end 41 | 42 | return M 43 | 44 | -- command! Make silent lua require'async_make'.make() 45 | -- nnoremap m :Make 46 | -- augroup LintOnSave 47 | -- autocmd! BufWritePost Make 48 | -- augroup END 49 | -- command! DisableLintOnSave autocmd! LintOnSave BufWritePost 50 | -------------------------------------------------------------------------------- /lua/utils/helpers/git.lua: -------------------------------------------------------------------------------- 1 | M = {} 2 | local parse_changes = function() 3 | local status = vim.fn.system("git status --porcelain") 4 | 5 | local changes = vim.split(vim.trim(status), "\n") 6 | 7 | return changes 8 | end 9 | 10 | -- https://github.com/rmagatti/igs.nvim/ 11 | -- send changed file to qf 12 | 13 | M.qf_add = function(type) 14 | type = type or "all" 15 | local changes = parse_changes() 16 | local qflist_what = {} 17 | 18 | for _, change in ipairs(changes) do 19 | local change_type = vim.trim(change:sub(1, 1)) 20 | local file_path = vim.trim(change:sub(3)) 21 | 22 | if type == "all" then 23 | local bufnr = vim.fn.bufadd(file_path) 24 | table.insert(qflist_what, { bufnr = bufnr, lnum = 0, col = 0 }) 25 | elseif change_type == type then 26 | local bufnr = vim.fn.bufadd(file_path) 27 | table.insert(qflist_what, { bufnr = bufnr, lnum = 0, col = 0 }) 28 | end 29 | end 30 | 31 | if vim.tbl_isempty(qflist_what) then 32 | return 33 | end 34 | 35 | vim.fn.setqflist(qflist_what) 36 | 37 | vim.cmd([[copen]]) 38 | end 39 | return M 40 | -------------------------------------------------------------------------------- /lua/utils/logs/log.lua: -------------------------------------------------------------------------------- 1 | local log_path = os.getenv("HOME") .. "/.cache/nvim/log" 2 | 3 | local log = function(...) 4 | local arg = { ... } 5 | local str = "שׁ " 6 | local lineinfo = "" 7 | 8 | local info = debug.getinfo(2, "Sl") 9 | lineinfo = info.short_src .. ":" .. info.currentline 10 | str = str .. lineinfo 11 | 12 | for i, v in ipairs(arg) do 13 | if type(v) == "table" then 14 | str = str .. " |" .. tostring(i) .. ": " .. vim.inspect(v) .. "\n" 15 | else 16 | str = str .. " |" .. tostring(i) .. ": " .. tostring(v) 17 | end 18 | end 19 | if #str > 2 then 20 | if log_path ~= nil and #log_path > 3 then 21 | local f = io.open(log_path, "a+") 22 | if f == nil then 23 | print("not found ", log_path) 24 | return 25 | end 26 | io.output(f) 27 | io.write(str .. "\n") 28 | io.close(f) 29 | else 30 | print(str .. "\n") 31 | end 32 | end 33 | end 34 | 35 | return { lprint = log } 36 | -------------------------------------------------------------------------------- /lua/utils/plugins/abbreviations.lua: -------------------------------------------------------------------------------- 1 | local utils = require("utils.abbreviations.utils") 2 | local abbrevs = require("utils.abbreviations.dictionary") 3 | local M = {} 4 | 5 | M.load_cmd = function() end 6 | 7 | M.setup = function(opts) 8 | opts = opts or {} 9 | if lambda.config.abbrev.coding_support then 10 | for _, abbrev in ipairs(abbrevs.global_abbrevs.iabbrevs) do 11 | utils.inoreabbrev(abbrev[1], abbrev[2]) 12 | end 13 | 14 | -- these break so cannot really use these now 15 | for _, cabbrev in ipairs(abbrevs.global_abbrevs.cabbrevs) do 16 | utils.cnoreabbrev(cabbrev[1], cabbrev[2]) 17 | end 18 | end 19 | 20 | for item, value in pairs(lambda.config.abbrev.globals) do 21 | if value == true then 22 | utils.load_dict(abbrevs[item]) 23 | end 24 | end 25 | utils.load_filetypes() 26 | end 27 | return M 28 | -------------------------------------------------------------------------------- /lua/utils/plugins/auto_normal.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | local function auto_normal(ms) 3 | local timer = vim.loop.new_timer() 4 | local function on_key() 5 | timer:stop() 6 | timer = vim.defer_fn(function() 7 | if vim.api.nvim_get_mode().mode ~= "i" then 8 | return 9 | end 10 | 11 | vim.schedule(vim.cmd.stopinsert) 12 | end, ms) 13 | end 14 | 15 | vim.on_key(on_key, vim.api.nvim_create_namespace("auto_normal")) 16 | end 17 | M.setup = function(opt) 18 | opt = opt or 30000 19 | 20 | auto_normal(opt) 21 | end 22 | 23 | return M 24 | -------------------------------------------------------------------------------- /lua/utils/plugins/custom_neorg_save.lua: -------------------------------------------------------------------------------- 1 | local match = lambda.lib.match 2 | local when = lambda.lib.when 3 | 4 | local function cmd_parser(command_list) 5 | for _, command in ipairs(command_list) do 6 | vim.fn.system(command) 7 | end 8 | end 9 | local M = {} 10 | M.is_dirty = function() 11 | -- vim.api.nvim_set_current_dir(folder) 12 | local is_dirty = vim.fn.systemlist("git status --porcelain") 13 | local commit_message = "Auto Neovim Exit Commit " .. vim.fn.strftime("%Y-%m-%d %H:%M:%S") .. ":" 14 | 15 | return when(not vim.tbl_isempty(is_dirty), function() 16 | print("Folder is not clean : pushes needed") 17 | vim.ui.input({ prompt = "Do you want to add more to this commit ?" }, function(input) 18 | local valid_answers = { "y", "yes", "Y", "Yes", "YES", "YES!" } 19 | if vim.tbl_contains(valid_answers, input) then 20 | vim.ui.input({ prompt = "Enter commit message" }, function(commit) 21 | commit_message = commit_message .. "\n" .. commit 22 | end) 23 | else 24 | print("Commiting:") 25 | end 26 | end) 27 | 28 | for i, v in ipairs(is_dirty) do 29 | if string.sub(v, 1, 1) == "?" then 30 | is_dirty[i] = " A" .. string.sub(v, 3) 31 | end 32 | if string.len(is_dirty[i]) > 50 then 33 | is_dirty[i] = string.sub(is_dirty[i], 1, 50) .. "..." 34 | end 35 | commit_message = commit_message .. "\n" .. is_dirty[i] 36 | end 37 | cmd_parser({ 38 | "git add .", 39 | "git commit -m '" .. vim.fn.escape(commit_message, "\\") .. "'", 40 | "git push", 41 | }) 42 | 43 | print("Folder is dirty and pushed") 44 | end, function() 45 | print("No changes were made") 46 | end) 47 | end 48 | 49 | M.work_tree_check = function() 50 | return when(vim.fn.systemlist("git rev-parse --is-inside-work-tree")[1] == "true", function() 51 | print("Inside worktree") 52 | M.is_dirty() 53 | end, function() 54 | print("Folder is not a git repo") 55 | end) 56 | end 57 | 58 | M.is_in_git = function() 59 | local folder = "/home/viv/neorg/" 60 | return match(string.sub(vim.fs.find(".git", { upward = true })[1], 1, #folder))({ 61 | [folder] = function() 62 | M.work_tree_check() 63 | end, 64 | }) 65 | end 66 | 67 | M.start = function() 68 | vim.ui.input({ prompt = "Do you want to auto Commit ?" }, function(input) 69 | local valid_answers = { "y", "yes", "Y", "Yes", "YES", "YES!" } 70 | if vim.tbl_contains(valid_answers, input) then 71 | M.is_in_git() 72 | else 73 | print("No changes were made") 74 | end 75 | end) 76 | end 77 | 78 | return M 79 | -------------------------------------------------------------------------------- /lua/utils/plugins/numbers.lua: -------------------------------------------------------------------------------- 1 | local function readable_number() 2 | local curr = vim.fn.expand("") 3 | 4 | if tonumber(curr) then 5 | if #curr < 3 then 6 | return 7 | end 8 | local formatted = "" 9 | for i = #curr, 1, -3 do 10 | if i - 3 <= 0 then 11 | formatted = curr:sub(1, i) .. formatted 12 | break 13 | end 14 | formatted = "_" .. curr:sub(i - 2, i) .. formatted 15 | end 16 | vim.api.nvim_set_current_line(vim.fn.substitute(vim.fn.getline("."), curr, formatted, "")) 17 | end 18 | end 19 | 20 | local M = {} 21 | 22 | function M.setup() 23 | lambda.command("ReadNumber", readable_number, { force = true, range = true }) 24 | end 25 | return M 26 | -------------------------------------------------------------------------------- /lua/utils/plugins/save_clipboard_on_exit.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local function has_value(tab, val) 4 | for index, value in ipairs(tab) do 5 | if value == val then 6 | return true 7 | end 8 | end 9 | return false 10 | end 11 | 12 | local clipboard_commands = { 13 | ["xsel"] = { 14 | ["unnamed"] = "xsel -i --clipboard", 15 | ["unnamedplus"] = "xsel -i --primary", 16 | }, 17 | ["xclip"] = { 18 | ["unnamed"] = "xclip -i -selection clipboard", 19 | ["unnamedplus"] = "xclip -i -selection primary", 20 | }, 21 | } 22 | 23 | local function execute_command(command, register) 24 | if vim.fn.executable(command) == 1 then 25 | vim.fn.system(command, register) 26 | return true 27 | end 28 | return false 29 | end 30 | 31 | function M.save() 32 | if vim.fn.has("clipboard") == 0 or os.getenv("DISPLAY") == nil or os.getenv("WAYLAND_DISPLAY") == nil then 33 | return 34 | end 35 | 36 | local clipboard_supported = false 37 | 38 | for executable, commands in pairs(clipboard_commands) do 39 | for clipboard_option, command in pairs(commands) do 40 | if has_value(vim.opt.clipboard, clipboard_option) then 41 | clipboard_supported = execute_command(executable, command, vim.fn.getreg(clipboard_option)) 42 | if clipboard_supported then 43 | break 44 | end 45 | end 46 | end 47 | if clipboard_supported then 48 | break 49 | end 50 | end 51 | 52 | if not clipboard_supported then 53 | return 54 | end 55 | end 56 | function M.setup() 57 | lambda.augroup("save_clipboard_on_exit", { 58 | { 59 | event = { "VimLeavePre" }, 60 | pattern = "*", 61 | command = function() 62 | if lambda.config.save_clipboard_on_exit then 63 | require("utils.plugins.save_clipboard_on_exit").save() 64 | end 65 | end, 66 | once = false, 67 | }, 68 | }) 69 | end 70 | return M 71 | -------------------------------------------------------------------------------- /lua/utils/plugins/scratch.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | local buf, win 3 | local loaded = false 4 | 5 | local eval = function() 6 | loadstring(table.concat(vim.api.nvim_buf_get_lines(buf, 0, -1, false), "\n"))() 7 | end 8 | 9 | M.toggle = function() 10 | if not loaded or not vim.api.nvim_win_is_valid(win) then 11 | if not buf or not vim.api.nvim_buf_is_valid(buf) then 12 | buf = vim.api.nvim_create_buf(false, true) 13 | vim.api.nvim_buf_set_option(buf, "ft", "lua") 14 | vim.api.nvim_buf_set_option(buf, "bufhidden", "hide") 15 | vim.keymap.set("n", "R", eval, { buffer = buf }) 16 | end 17 | 18 | win = vim.api.nvim_open_win(buf, true, { 19 | relative = "editor", 20 | border = lambda.style.border.type_0, 21 | style = "minimal", 22 | row = 0, 23 | col = math.ceil(vim.o.columns / 2), 24 | height = math.ceil(vim.o.lines - 3), 25 | width = math.ceil(vim.o.columns / 2), 26 | }) 27 | else 28 | vim.api.nvim_win_hide(win) 29 | end 30 | 31 | loaded = not loaded 32 | end 33 | 34 | M.setup = function() 35 | vim.api.nvim_create_user_command("Scratch", M.toggle, {}) 36 | end 37 | 38 | return M 39 | -------------------------------------------------------------------------------- /lua/utils/plugins/stalk.lua: -------------------------------------------------------------------------------- 1 | local S = {} 2 | 3 | local pad = function(str, pad) 4 | return " " .. str .. (" "):rep(pad - #str) 5 | end 6 | local parse_json = function(json_data) 7 | local events = { "GH User Events", "--------------" } 8 | 9 | for _, event in ipairs(json_data) do 10 | local action, icon 11 | local user = event["actor"]["display_login"] 12 | 13 | if event.payload["forkee"] then 14 | action = "forked" 15 | icon = " " 16 | elseif event.type == "CreateEvent" then 17 | action = "created" 18 | icon = " " 19 | elseif event.type == "IssueCommentEvent" then 20 | action = "commented" 21 | icon = " " 22 | elseif event.type == "IssuesEvent" then 23 | action = "opened" 24 | icon = " " 25 | elseif event.payload.action == "started" then 26 | action = "starred" 27 | icon = " " 28 | else 29 | action = "undefined" 30 | icon = " " 31 | end 32 | 33 | local repo = event.repo.name 34 | table.insert(events, ("%s %s %s %s"):format(icon, pad(user, 20), pad(action, 10), repo)) 35 | end 36 | return events 37 | end 38 | 39 | S.stalk = function() 40 | vim.ui.input({ prompt = "Enter gh username: " }, function(username) 41 | vim.cmd([[vsp | enew | setl nonu nornu bt=nofile bh=wipe]]) 42 | vim.keymap.set("n", "q", "q", { buffer = 0 }) 43 | local url = ("https://api.github.com/users/%s/received_events"):format(username) 44 | 45 | vim.schedule(function() 46 | local sauce = require("plenary.job"):new({ command = "curl", args = { url } }):sync() 47 | local json_data = vim.json.decode(table.concat(sauce, "")) 48 | vim.api.nvim_put(parse_json(json_data), "", false, false) 49 | end) 50 | end) 51 | end 52 | 53 | S.setup = function() 54 | vim.api.nvim_create_user_command("Stalk", S.stalk, {}) 55 | end 56 | 57 | return S 58 | -------------------------------------------------------------------------------- /lua/utils/ui/kind.lua: -------------------------------------------------------------------------------- 1 | local lspkind = {} 2 | local fmt = string.format 3 | 4 | local kind_presets = { 5 | default = lambda.style.lsp.kinds.nerdfonts, 6 | } 7 | local kind_order = lambda.style.lsp.highlights.Symbol 8 | local kind_len = 25 9 | 10 | -- default true 11 | local function opt_with_text(opts) 12 | return opts == nil or opts["with_text"] == nil or opts["with_text"] 13 | end 14 | 15 | -- default 'default' 16 | local function opt_preset(opts) 17 | local preset 18 | if opts == nil or opts["preset"] == nil then 19 | preset = "default" 20 | else 21 | preset = opts["preset"] 22 | end 23 | return preset 24 | end 25 | 26 | function lspkind.init(opts) 27 | local preset = opt_preset(opts) 28 | 29 | local symbol_map = kind_presets[preset] 30 | lspkind.symbol_map = (opts and opts["symbol_map"] and vim.tbl_extend("force", symbol_map, opts["symbol_map"])) 31 | or symbol_map 32 | 33 | local symbols = {} 34 | local len = kind_len 35 | for i = 1, len do 36 | local name = kind_order[i] 37 | symbols[i] = lspkind.symbolic(name, opts) 38 | end 39 | 40 | for k, v in pairs(symbols) do 41 | require("vim.lsp.protocol").CompletionItemKind[k] = v 42 | end 43 | end 44 | 45 | lspkind.presets = kind_presets 46 | lspkind.symbol_map = kind_presets.default 47 | 48 | function lspkind.symbolic(kind, opts) 49 | local with_text = opt_with_text(opts) 50 | 51 | local symbol = lspkind.symbol_map[kind] 52 | if with_text == true then 53 | symbol = symbol and (symbol .. " ") or "" 54 | return fmt("%s%s", symbol, kind) 55 | else 56 | return symbol 57 | end 58 | end 59 | 60 | function lspkind.cmp_format(opts) 61 | if opts == nil then 62 | opts = {} 63 | end 64 | if opts.preset or opts.symbol_map then 65 | lspkind.init(opts) 66 | end 67 | 68 | return function(entry, vim_item) 69 | vim_item.kind = lspkind.symbolic(vim_item.kind, opts) 70 | 71 | if opts.menu ~= nil then 72 | vim_item.menu = opts.menu[entry.source.name] 73 | end 74 | 75 | if opts.maxwidth ~= nil then 76 | vim_item.abbr = string.sub(vim_item.abbr, 1, opts.maxwidth) 77 | end 78 | 79 | return vim_item 80 | end 81 | end 82 | function lspkind.setup() 83 | local kinds = vim.lsp.protocol.CompletionItemKind 84 | for i, kind in ipairs(kinds) do 85 | kinds[i] = lspkind.icons[kind] or kind 86 | end 87 | end 88 | 89 | return lspkind 90 | -------------------------------------------------------------------------------- /lua/vscripts/init.lua: -------------------------------------------------------------------------------- 1 | local cmd = vim.fn.expand("$HOME") .. "/.config/nvim/scripts/" 2 | for _, v in ipairs(vim.fn.globpath(cmd, "*.vim", false, true)) do 3 | vim.cmd("source " .. v) 4 | end 5 | -------------------------------------------------------------------------------- /lux.toml: -------------------------------------------------------------------------------- 1 | package = "nvim" 2 | version = "0.1.0" 3 | lua = ">=5.1" 4 | 5 | [description] 6 | summary = "" 7 | maintainer = "viv" 8 | license = "*** enter a license ***" 9 | labels = [ "" ] 10 | 11 | [dependencies] 12 | neorg = "9.3.0-1" 13 | # Add your dependencies here 14 | # `busted = ">=2.0"` 15 | 16 | [build] 17 | type = "builtin" 18 | -------------------------------------------------------------------------------- /plugin/env.lua: -------------------------------------------------------------------------------- 1 | if not lambda then 2 | return 3 | end 4 | 5 | local api, fn, fs = vim.api, vim.fn, vim.fs 6 | local fmt = string.format 7 | 8 | local function read_file(file, line_handler) 9 | for line in io.lines(file) do 10 | line_handler(line) 11 | end 12 | end 13 | 14 | api.nvim_create_user_command("DotEnv", function() 15 | local files = fs.find(".env", { 16 | upward = true, 17 | stop = fn.fnamemodify(fn.getcwd(), ":p:h:h"), 18 | path = fn.expand("%:p:h"), 19 | }) 20 | if vim.tbl_isempty(files) then 21 | return 22 | end 23 | local filename = files[1] 24 | local lines = {} 25 | read_file(filename, function(line) 26 | if #line > 0 then 27 | table.insert(lines, line) 28 | end 29 | if not vim.startswith(line, "#") then 30 | local name, value = unpack(vim.split(line, "=")) 31 | fn.setenv(name, value) 32 | end 33 | end) 34 | local markdown = table.concat(vim.tbl_flatten({ "", "```sh", lines, "```", "" }), "\n") 35 | vim.notify(fmt("Read **%s**\n", filename) .. markdown, "info", { 36 | title = "Nvim Env", 37 | on_open = function(win) 38 | local buf = api.nvim_win_get_buf(win) 39 | if not api.nvim_buf_is_valid(buf) then 40 | return 41 | end 42 | api.nvim_buf_set_option(buf, "filetype", "markdown") 43 | end, 44 | }) 45 | end, {}) 46 | -------------------------------------------------------------------------------- /plugin/lastplace.lua: -------------------------------------------------------------------------------- 1 | if not lambda then 2 | return 3 | end 4 | 5 | local fn = vim.fn 6 | -- adapted from https://github.com/ethanholz/nvim-lastplace/blob/main/lua/nvim-lastplace/init.lua 7 | local ignore_buftype = { "quickfix", "nofile", "help", "terminal" } 8 | local ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" } 9 | 10 | if lambda.config.use_lastplace then 11 | lambda.augroup("LastPlace", { 12 | { 13 | event = { "FileType" }, 14 | command = function() 15 | if vim.tbl_contains(ignore_buftype, vim.bo.buftype) then 16 | return 17 | end 18 | 19 | if vim.tbl_contains(ignore_filetype, vim.bo.filetype) then 20 | -- reset cursor to first line 21 | vim.cmd("normal! gg") 22 | return 23 | end 24 | 25 | -- If a line has already been specified on the command line, we are done e.g. nvim file +num 26 | if fn.line(".") > 1 then 27 | return 28 | end 29 | 30 | local last_line = fn.line([['"]]) 31 | local buff_last_line = fn.line("$") 32 | 33 | -- If the last line is set and the less than the last line in the buffer 34 | if last_line > 0 and last_line <= buff_last_line then 35 | local win_last_line = fn.line("w$") 36 | local win_first_line = fn.line("w0") 37 | -- Check if the last line of the buffer is the same as the win 38 | if win_last_line == buff_last_line then 39 | vim.cmd('normal! g`"') -- Set line to last line edited 40 | -- Try to center 41 | elseif buff_last_line - last_line > ((win_last_line - win_first_line) / 2) - 1 then 42 | vim.cmd('normal! g`"zz') 43 | else 44 | vim.cmd([[normal! G'"]]) 45 | end 46 | end 47 | end, 48 | }, 49 | }) 50 | end 51 | -------------------------------------------------------------------------------- /plugin/number.lua: -------------------------------------------------------------------------------- 1 | if not lambda then 2 | return 3 | end 4 | local ui = lambda.style 5 | 6 | -- Inspiration 7 | -- 1. vim-relativity 8 | -- 2. numbers.vim - https://github.com/myusuf3/numbers.vim/blob/master/plugin/numbers.vim 9 | 10 | local api, fn = vim.api, vim.fn 11 | local M = {} 12 | 13 | local function is_floating_win() 14 | return fn.win_gettype() == "popup" 15 | end 16 | 17 | local is_enabled = true 18 | 19 | ---Determines whether or not a window should be ignored by this plugin 20 | ---@return boolean 21 | local function is_ignored() 22 | return is_floating_win() 23 | end 24 | 25 | -- block list certain plugins and buffer types 26 | local function is_blocked() 27 | local win_type = fn.win_gettype() 28 | if not api.nvim_buf_is_valid(0) and not api.nvim_buf_is_loaded(0) then 29 | return true 30 | end 31 | if win_type == "command" or vim.wo.diff or vim.wo.previewwindow then 32 | return true 33 | end 34 | 35 | local decs = ui.decorations.get({ ft = vim.bo.ft, bt = vim.bo.bt, setting = "number" }) 36 | return decs.ft == false or decs.bt == false 37 | end 38 | 39 | local function enable_relative_number() 40 | if not is_enabled then 41 | return 42 | end 43 | if is_ignored() then 44 | return 45 | end 46 | local enabled = not is_blocked() 47 | vim.wo.number, vim.wo.relativenumber = enabled, enabled 48 | end 49 | 50 | local function disable_relative_number() 51 | if is_ignored() then 52 | return 53 | end 54 | vim.wo.number, vim.wo.relativenumber = not is_blocked(), false 55 | end 56 | 57 | lambda.command("ToggleRelativeNumber", function() 58 | is_enabled = not is_enabled 59 | if is_enabled then 60 | enable_relative_number() 61 | else 62 | disable_relative_number() 63 | end 64 | end) 65 | 66 | lambda.augroup("ToggleRelativeLineNumbers", { 67 | 68 | { 69 | 70 | event = { "BufEnter", "FileType", "FocusGained", "InsertLeave" }, 71 | command = enable_relative_number, 72 | }, 73 | { 74 | event = { "FocusLost", "BufLeave", "InsertEnter", "TermOpen" }, 75 | command = disable_relative_number, 76 | }, 77 | }) 78 | 79 | return M 80 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # PoloVim 2 | 3 | PoloVim is a highly customized and extensive Neovim configuration developed by [vsedov](https://github.com/vsedov). This configuration is designed for personal use and is constantly evolving. 4 | 5 | ## o_O Disclaimer 6 | 7 | **IMPORTANT**: This config is for MY personal use. Don't expect it to work for you or anyone else. It's unstable, constantly changing, and I make no guarantees about its functionality for others. 8 | 9 | ## >_< Features 10 | 11 | - One of the largest and most comprehensive Neovim configurations out there 12 | - Uses [rocks.nvim](https://github.com/nvim-neorocks/rocks.nvim) as the primary plugin manager 13 | - Implements [rocks-lazy](https://github.com/nvim-neorocks/rocks-lazy.nvim) for lazy-loading 14 | - Leverages [rocks bundles](https://github.com/nvim-neorocks/rocks.nvim#-bundles) for plugin management 15 | - Incorporates everything available from the rocks.nvim ecosystem 16 | 17 | ## ¯\_(ツ)_/¯ Installation 18 | 19 | Look, I'm not providing detailed instructions. If you really want to try: 20 | 21 | 22 | ## ^_^ Plugin Management 23 | 24 | PoloVim uses: 25 | 26 | - **rocks.nvim**: Core plugin manager 27 | - **rocks-lazy**: For lazy-loading 28 | - **rocks bundles**: Organizes plugins 29 | 30 | 31 | 32 | ## T_T License 33 | 34 | MIT License. See [LICENSE](LICENSE) file. 35 | 36 | ## (╯°□°)╯︵ ┻━┻ Acknowledgements 37 | 38 | - Neovim community 39 | - rocks.nvim ecosystem developers 40 | 41 | --- 42 | 43 | **Final Note**: This config is a constantly moving target. What works today might break tomorrow. Use at your own risk. 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /rocks_update.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vsedov/PoloVim/c0fc3f91b36ccc8d75274a072b36a03b5e23646e/rocks_update.lua -------------------------------------------------------------------------------- /scripts/log-autocmds.vim: -------------------------------------------------------------------------------- 1 | " https://github.com/lervag/dotvim/blob/master/personal/plugin/log-autocmds.vim 2 | 3 | command! LogAutocmds call s:log_autocmds_toggle() 4 | 5 | function! s:log_autocmds_toggle() 6 | augroup LogAutocmd 7 | autocmd! 8 | augroup END 9 | 10 | let l:date = strftime('%F', localtime()) 11 | let s:activate = get(s:, 'activate', 0) ? 0 : 1 12 | if !s:activate 13 | call s:log('Stopped autocmd log (' . l:date . ')') 14 | return 15 | endif 16 | 17 | call s:log('Started autocmd log (' . l:date . ')') 18 | augroup LogAutocmd 19 | for l:au in s:aulist 20 | silent execute 'autocmd' l:au '* call s:log(''' . l:au . ''')' 21 | endfor 22 | augroup END 23 | endfunction 24 | 25 | function! s:log(message) 26 | silent execute '!echo "' 27 | \ . strftime('%T', localtime()) . ' - ' . a:message . '"' 28 | \ '>> /tmp/vim_log_autocommands' 29 | endfunction 30 | 31 | " These are deliberately left out due to side effects 32 | " - SourceCmd 33 | " - FileAppendCmd 34 | " - FileWriteCmd 35 | " - BufWriteCmd 36 | " - FileReadCmd 37 | " - BufReadCmd 38 | " - FuncUndefined 39 | 40 | let s:aulist = [ 41 | \ 'BufNewFile', 42 | \ 'BufReadPre', 43 | \ 'BufRead', 44 | \ 'BufReadPost', 45 | \ 'FileReadPre', 46 | \ 'FileReadPost', 47 | \ 'FilterReadPre', 48 | \ 'FilterReadPost', 49 | \ 'StdinReadPre', 50 | \ 'StdinReadPost', 51 | \ 'BufWrite', 52 | \ 'BufWritePre', 53 | \ 'BufWritePost', 54 | \ 'FileWritePre', 55 | \ 'FileWritePost', 56 | \ 'FileAppendPre', 57 | \ 'FileAppendPost', 58 | \ 'FilterWritePre', 59 | \ 'FilterWritePost', 60 | \ 'BufAdd', 61 | \ 'BufCreate', 62 | \ 'BufDelete', 63 | \ 'BufWipeout', 64 | \ 'BufFilePre', 65 | \ 'BufFilePost', 66 | \ 'BufEnter', 67 | \ 'BufLeave', 68 | \ 'BufWinEnter', 69 | \ 'BufWinLeave', 70 | \ 'BufUnload', 71 | \ 'BufHidden', 72 | \ 'BufNew', 73 | \ 'SwapExists', 74 | \ 'FileType', 75 | \ 'Syntax', 76 | \ 'EncodingChanged', 77 | \ 'TermChanged', 78 | \ 'VimEnter', 79 | \ 'GUIEnter', 80 | \ 'GUIFailed', 81 | \ 'TermResponse', 82 | \ 'QuitPre', 83 | \ 'VimLeavePre', 84 | \ 'VimLeave', 85 | \ 'FileChangedShell', 86 | \ 'FileChangedShellPost', 87 | \ 'FileChangedRO', 88 | \ 'ShellCmdPost', 89 | \ 'ShellFilterPost', 90 | \ 'CmdUndefined', 91 | \ 'SpellFileMissing', 92 | \ 'SourcePre', 93 | \ 'VimResized', 94 | \ 'FocusGained', 95 | \ 'FocusLost', 96 | \ 'CursorHold', 97 | \ 'CursorHoldI', 98 | \ 'CursorMoved', 99 | \ 'CursorMovedI', 100 | \ 'WinEnter', 101 | \ 'WinLeave', 102 | \ 'TabEnter', 103 | \ 'TabLeave', 104 | \ 'CmdwinEnter', 105 | \ 'CmdwinLeave', 106 | \ 'InsertEnter', 107 | \ 'InsertChange', 108 | \ 'InsertLeave', 109 | \ 'InsertCharPre', 110 | \ 'TextChanged', 111 | \ 'TextChangedI', 112 | \ 'ColorScheme', 113 | \ 'RemoteReply', 114 | \ 'QuickFixCmdPre', 115 | \ 'QuickFixCmdPost', 116 | \ 'SessionLoadPost', 117 | \ 'MenuPopup', 118 | \ 'CompleteDone', 119 | \ 'User', 120 | \ ] 121 | -------------------------------------------------------------------------------- /scripts/sort.vim: -------------------------------------------------------------------------------- 1 | " modified from https://github.com/ralismark/opsort.vim/blob/main/plugin/opsort.vim 2 | if exists("g:loaded_opsort") || &cp || v:version < 800 3 | finish 4 | endif 5 | let g:loaded_opsort = 1 6 | 7 | function! s:opsort(motion) 8 | let flags = exists("g:opsort_flags") ? g:opsort_flags : "" 9 | 10 | if type(a:motion) == v:t_number 11 | let n = min([a:motion - 1, line("$") - line(".")]) 12 | exec ".,.+" . n . "sort" flags 13 | elseif a:motion ==# "line" || a:motion ==# "char" 14 | exec "'[,']sort" flags 15 | elseif a:motion ==# "V" || a:motion ==# "v" 16 | exec "normal! \\" 17 | exec "'<,'>sort" flags 18 | elseif a:motion ==# "block" 19 | let [left, right] = sort([virtcol("'["), virtcol("']")], "n") 20 | let regex = '/\%>' . (left - 1) . 'v.*\%<' . (right + 2) . 'v/' 21 | exec "'[,']sort" regex "r" . flags 22 | elseif a:motion ==# "\" 23 | exec "normal! \\" 24 | let [left, right] = sort([virtcol("'<"), virtcol("'>")], "n") 25 | let regex = '/\%>' . (left - 1) . 'v.*\%<' . (right + 2) . 'v/' 26 | exec "'<,'>sort" regex "r" . flags 27 | else 28 | echoe "Unknown motion " . a:motion . ", please report this to the maintainer(s)" 29 | endif 30 | endfunction 31 | 32 | nnoremap Opsort set operatorfunc=opsortg@ 33 | " TODO this seems like it works, do the visual mode handlers even need to exist? 34 | xnoremap Opsort set operatorfunc=opsortg@ 35 | " xnoremap Opsort call SortMotion(mode()) 36 | nnoremap OpsortLines call opsort(v:count1) \| silent! call repeat#set("\Plug>OpsortLines", v:count1) 37 | 38 | if !exists("g:opsort_no_mappings") || !g:opsort_no_mappings 39 | command! Opsort execute "normal \Opsort" 40 | " silent! xmap gs Opsort 41 | " silent! nmap gs Opsort 42 | " silent! nmap gss OpsortLines 43 | " silent! nmap gsgs OpsortLines 44 | endif 45 | -------------------------------------------------------------------------------- /snippets/conf.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /snippets/lua.json: -------------------------------------------------------------------------------- 1 | { 2 | "autocmd + filetype": { 3 | "body": [ 4 | "vim.keymap.set({ \"n\", \"x\" }, \"$0\", function()", 5 | " $2", 6 | "end, {$3})" 7 | ], 8 | "prefix": [ 9 | "autocmd", 10 | "filetype" 11 | ] 12 | }, 13 | "bob": { 14 | "body": [ 15 | "user({", 16 | " \"$1\",", 17 | " config = true", 18 | "})" 19 | ], 20 | "prefix": "bob" 21 | }, 22 | "keymaps": { 23 | "body": [ 24 | "require(\"scissors\").setup({", 25 | " snippetDir = \"$HOME/.config/nvim/snippets/\",", 26 | "})" 27 | ], 28 | "prefix": "keymaps" 29 | }, 30 | "keyset": { 31 | "body": [ 32 | "vim.keymap.set(\"n\", \"se\", function()", 33 | " require(\"scissors\").editSnippet()", 34 | " end)" 35 | ], 36 | "prefix": "keyset" 37 | }, 38 | "req_lua": { 39 | "body": [ 40 | "require(\"luasnip.loaders.from_vscode\").lazy_load({", 41 | " paths = { vim.fn.stdpath(\"config\") .. \"/snippets\" },", 42 | "})" 43 | ], 44 | "prefix": "req_lua" 45 | }, 46 | "tr + rt": { 47 | "body": [ 48 | "require(\"scissors\").setup({", 49 | " snippetDir = \"~/.config/nvim/snippets/\",", 50 | " })" 51 | ], 52 | "prefix": [ 53 | "tr", 54 | "rt" 55 | ] 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /snippets/lua/generated.lua: -------------------------------------------------------------------------------- 1 | local api = vim.api 2 | local ls = require("luasnip") 3 | local fmt = require("luasnip.extras.fmt").fmt 4 | local s = ls.snippet 5 | local i = ls.insert_node 6 | 7 | local snippets = { 8 | s( 9 | "my_snippet", 10 | fmt( 11 | [=[ 12 | Hello {} 13 | ]=], 14 | { i(1, "World") } 15 | ) 16 | ), 17 | 18 | s( 19 | "test", 20 | fmt( 21 | [=[ 22 | local {} = require("module") 23 | 24 | local function {}() 25 | local x = {} local y = {} 26 | end 27 | 28 | ]=], 29 | { 30 | i(1, "module"), 31 | i(2, "my_func"), 32 | i(3, "10"), 33 | i(4, "100"), 34 | } 35 | ) 36 | ), 37 | 38 | s( 39 | "control", 40 | fmt( 41 | [=[ 42 | local function {}() 43 | local x = {} 44 | local y = {} end 45 | ]=], 46 | { 47 | i(1, "my_func"), 48 | i(2, "10"), 49 | i(3, "100"), 50 | } 51 | ) 52 | ), 53 | 54 | s( 55 | "test", 56 | fmt([=[ 57 | "", 58 | 59 | function() 60 | require("SnippetGenie").create_new_snippet_or_add_placeholder() 61 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "x", true) 62 | end, 63 | ]=], { 64 | 65 | }) 66 | ), 67 | 68 | ------------------------------------------------------ Snippets goes here 69 | } 70 | 71 | local autosnippets = {} 72 | 73 | -- Snippets goes here 74 | return snippets, autosnippets 75 | -------------------------------------------------------------------------------- /snippets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "contributes": { 3 | "snippets": [ 4 | { 5 | "language": [ 6 | "lua" 7 | ], 8 | "path": "./lua.json" 9 | }, 10 | { 11 | "language": [ 12 | "python" 13 | ], 14 | "path": "./python.json" 15 | }, 16 | { 17 | "language": [ 18 | "conf" 19 | ], 20 | "path": "./conf.json" 21 | } 22 | ] 23 | }, 24 | "description": "This package.json has been generated by nvim-scissors.", 25 | "name": "my-snippets" 26 | } 27 | -------------------------------------------------------------------------------- /snippets/python.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /snippets/python/generated.lua: -------------------------------------------------------------------------------- 1 | local api = vim.api 2 | local ls = require("luasnip") 3 | local fmt = require("luasnip.extras.fmt").fmt 4 | local s = ls.snippet 5 | local i = ls.insert_node 6 | 7 | local snippets = { 8 | s( 9 | "pr", 10 | fmt([[print({})]], { 11 | i(1, "msg"), 12 | }) 13 | ), 14 | ------------------------------------------------------ Snippets goes here 15 | } 16 | 17 | local autosnippets = {} 18 | 19 | -- Snippets goes here 20 | return snippets, autosnippets 21 | -------------------------------------------------------------------------------- /snippets/snip/lua.json: -------------------------------------------------------------------------------- 1 | { 2 | "test_lua":{"body":["quire(\"scissors\").setup({"," snippetDir = \"~\/.config\/nvim\/snippets\/snip\","," })"],"prefix":"test_lua"}, 3 | "completion_test":{"body":["completion({"," \"$1\","," event = \"VeryLazy\","," dependencies = \"nvim-telescope\/telescope.nvim\", -- optional"," config = function()"," end",")}"],"prefix":"completion_test"} 4 | } 5 | -------------------------------------------------------------------------------- /snippets/snip/package.json: -------------------------------------------------------------------------------- 1 | {"contributes":{"snippets":[{"path":".\/lua.json","language":["lua"]}]},"description":"This package.json has been generated by nvim-scissors.","name":"my-snippets"} -------------------------------------------------------------------------------- /spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | hypervisor 2 | teardown 3 | autoload 4 | plugin 5 | TJ 6 | DeVries 7 | devries 8 | timothyj 9 | gmail 10 | Neovim 11 | vim 12 | vim 13 | vim 14 | vim 15 | vim 16 | plugins 17 | dev 18 | github 19 | tjdevries 20 | config 21 | nvim 22 | helpgrep 23 | neo 24 | E3N 25 | E3P 26 | LPP 27 | Caché 28 | #xcuted 29 | excuted/! 30 | HFP 31 | Wiki 32 | ApplCore 33 | flowsheets 34 | Chrontrol 35 | RW 36 | HGR 37 | flowsheet 38 | ETC 39 | wiki 40 | vim 41 | vim 42 | ツ 43 | PQA 44 | DLG 45 | DXR 46 | datalink 47 | #mbeddability 48 | Embeddability/! 49 | Embeddability 50 | LuaJIT 51 | Lua 52 | API 53 | userdata 54 | Sourceress 55 | refactor 56 | Golang 57 | Luajit 58 | LSP 59 | Builtin 60 | APIs 61 | Justinmk 62 | builtin 63 | Scriptable 64 | IDE 65 | Definer/! 66 | #olor/! 67 | color/! 68 | -------------------------------------------------------------------------------- /spell/en.utf-8.add.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vsedov/PoloVim/c0fc3f91b36ccc8d75274a072b36a03b5e23646e/spell/en.utf-8.add.spl -------------------------------------------------------------------------------- /spell/en.utf-8.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vsedov/PoloVim/c0fc3f91b36ccc8d75274a072b36a03b5e23646e/spell/en.utf-8.spl -------------------------------------------------------------------------------- /spell/en.utf-8.sug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vsedov/PoloVim/c0fc3f91b36ccc8d75274a072b36a03b5e23646e/spell/en.utf-8.sug -------------------------------------------------------------------------------- /startup/hyperfine.sh: -------------------------------------------------------------------------------- 1 | hyperfine --warmup 3 "nvim -c qa!" || true 2 | hyperfine --warmup 3 "nvim -u NONE -c qa" || true 3 | hyperfine --warmup 3 "/usr/bin/vim -u NONE -c qa" || true 4 | hyperfine --warmup 3 "/usr/bin/vim -c qa" || true 5 | 6 | nvim -e \ 7 | -c 'verbose python3 import platform;print("Python3 v" + platform.python_version())' \ 8 | -c 'qa!' 9 | # https://stackoverflow.com/questions/12213597/how-to-see-which-plugins-are-making-vim-slow 10 | # python <(curl -sSL https://raw.githubusercontent.com/hyiltiz/vim-plugins-profile/master/vim-plugins-profile.py) nvim 11 | nvim --cmd 'profile start /tmp/profile.log' \ 12 | --cmd 'profile func *' \ 13 | --cmd 'profile file *' \ 14 | -c 'profdel func *' \ 15 | -c 'profdel file *' \ 16 | -c 'profile pause *' \ 17 | -c 'qa!' 18 | hyperfine --warmup 3 "nvim -u NONE -c qa!" || true 19 | hyperfine --warmup 3 "nvim -c qa!" || true 20 | -------------------------------------------------------------------------------- /startup/quick_startup_test.sh: -------------------------------------------------------------------------------- 1 | get_time() { 2 | tail -1 $HOME/.config/nvim/startup/tmp | cut -d ' ' -f 1 3 | } 4 | pf() { 5 | printf '%s : ' "$@" 6 | } 7 | 8 | nvim --startuptime tmp 9 | get_time 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /startup/startup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | get_time() { 4 | tail -1 tmp | cut -d ' ' -f 1 5 | } 6 | 7 | pf() { 8 | printf '%s : ' "$@" 9 | } 10 | 11 | echo "Warmup test #1" 12 | nvim -c q 13 | echo "Warmup #2" 14 | nvim -c q 15 | echo "Warmup #3" 16 | nvim -c q 17 | echo "Warmup #4" 18 | nvim -c q 19 | echo "Warmup #5" 20 | nvim -c q 21 | echo "Warmup #6" 22 | nvim -c q 23 | 24 | pf "No config" 25 | nvim -nu none --startuptime tmp 26 | get_time 27 | pf "With config" 28 | nvim --startuptime tmp 29 | get_time 30 | pf "Opening init.lua" 31 | nvim "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.lua" --startuptime tmp 32 | get_time 33 | pf "Opening Python file" 34 | nvim tmp.py --startuptime tmp 35 | get_time 36 | pf "Opening C File" 37 | nvim tmp.c --startuptime tmp 38 | get_time 39 | pf "Opening norg File" 40 | nvim tmp.norg --startuptime tmp 41 | get_time 42 | 43 | # rm tmp 44 | -------------------------------------------------------------------------------- /updater.lua: -------------------------------------------------------------------------------- 1 | local toml = require("toml") 2 | local luv = require("luv") 3 | 4 | -- Function to read the TOML file 5 | local function read_toml_file(file_path) 6 | local file = io.open(file_path, "r") 7 | if not file then 8 | error("Could not open file: " .. file_path) 9 | end 10 | 11 | local content = file:read("*all") 12 | file:close() 13 | -- return toml.parse(content) 14 | return toml.parse(content) 15 | end 16 | 17 | -- Function to perform Rocks! update 18 | local function update_plugin(plugin_name) 19 | print("Updating plugin: " .. plugin_name) 20 | local handle = io.popen("Rocks! update " .. plugin_name) 21 | local result = handle:read("*a") 22 | handle:close() 23 | print(result) 24 | end 25 | 26 | -- Function to run updates concurrently 27 | local function concurrent_updates(plugins) 28 | local threads = {} 29 | 30 | for plugin_name, _ in pairs(plugins) do 31 | local thread = luv.new_thread(update_plugin, plugin_name) 32 | table.insert(threads, thread) 33 | end 34 | 35 | for _, thread in ipairs(threads) do 36 | luv.thread_join(thread) 37 | end 38 | end 39 | 40 | -- Main function 41 | local function main() 42 | local config = read_toml_file("rocks.toml") 43 | 44 | -- Combine all plugin tables (regular plugins and git plugins) 45 | local all_plugins = {} 46 | 47 | for section, plugins in pairs(config) do 48 | if section:find("plugins") then 49 | for plugin_name, _ in pairs(plugins) do 50 | print("Adding plugin: " .. plugin_name) 51 | all_plugins[plugin_name] = true 52 | end 53 | end 54 | end 55 | end 56 | 57 | main() 58 | --------------------------------------------------------------------------------