diff --git a/ftplugin/http.lua b/ftplugin/http.lua deleted file mode 100644 index 5b2f68c..0000000 --- a/ftplugin/http.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.keymap.set('n', 'r', require('rest-nvim').run) -vim.keymap.set('n', 'l', require('rest-nvim').last) diff --git a/init.lua b/init.lua index 5d1fa9b..c154cc3 100644 --- a/init.lua +++ b/init.lua @@ -2,7 +2,6 @@ require 'options' require 'init_lazy' require 'lsp' require 'mappings' -require 'setup_dap' require 'autocmd' require 'neovide' --- diff --git a/lazy-lock.json b/lazy-lock.json index 3294194..822717e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,6 +1,6 @@ { - "ChatGPT.nvim": { "branch": "main", "commit": "df53728e05129278d6ea26271ec086aa013bed90" }, - "LuaSnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" }, + "ChatGPT.nvim": { "branch": "main", "commit": "f081338f07216a46d3915ce46c1fcb083bcb5016" }, + "LuaSnip": { "branch": "master", "commit": "ce0a05ab4e2839e1c48d072c5236cce846a387bc" }, "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, @@ -8,44 +8,46 @@ "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, - "copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" }, + "copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" }, + "copilot.lua": { "branch": "master", "commit": "86537b286f18783f8b67bccd78a4ef4345679625" }, "cspell.nvim": { "branch": "main", "commit": "508b64a23bd8f9473c59d083a92712486f6f138d" }, - "diffview.nvim": { "branch": "main", "commit": "3afa6a053f680e9f1329c4a151db988a482306cd" }, - "dressing.nvim": { "branch": "master", "commit": "e3714c8049b2243e792492c4149e4cc395c68eb9" }, - "gitsigns.nvim": { "branch": "main", "commit": "4a143f13e122ab91abdc88f89eefbe70a4858a56" }, + "delegate.nvim": { "branch": "main", "commit": "b7c40a72019d799e3a49cb6be2791688a3de4fa4" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" }, + "gitsigns.nvim": { "branch": "main", "commit": "6b1a14eabcebbcca1b9e9163a26b2f8371364cb7" }, "icon-picker.nvim": { "branch": "master", "commit": "3ee9a0ea9feeef08ae35e40c8be6a2fa2c20f2d3" }, - "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, + "indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" }, "lazy-reload.nvim": { "branch": "main", "commit": "5b781fbd4e5eaa4002f5bd52ceb1febf07d5ecbf" }, - "lazy.nvim": { "branch": "main", "commit": "eb4957442e3182f051b0ae11da32e06d22c190e3" }, + "lazy.nvim": { "branch": "main", "commit": "0507e19289539396313503f6eb6b02bbe8a5e483" }, + "lazydev.nvim": { "branch": "main", "commit": "78d8a11fbd02ad4eafa07dd8a43a959a69fb3bf8" }, "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" }, "meadow.nvim": { "branch": "master", "commit": "6ae047827ff9b5062e6119acafa8a7b88f388308" }, "neodev.nvim": { "branch": "main", "commit": "02893eeb9d6e8503817bd52385e111cba9a90500" }, - "neogit": { "branch": "master", "commit": "4b9d1893bc303ba9c2a9fe7d42b59ba7eb70184a" }, - "noice.nvim": { "branch": "main", "commit": "b828b575805f1b303c2f4b768744609835140739" }, - "none-ls.nvim": { "branch": "main", "commit": "8691504118b252d64fc5023a104aedd100ab754a" }, - "nui.nvim": { "branch": "main", "commit": "322978c734866996274467de084a95e4f9b5e0b1" }, + "neogit": { "branch": "master", "commit": "76380b650ce2bb752cebf34a15583b9f2f141d62" }, + "noice.nvim": { "branch": "main", "commit": "03c6a75661e68012e30b0ed81f050358b1e2233c" }, + "none-ls.nvim": { "branch": "main", "commit": "0d1b3fa2ad0b371b94cb4b9a27ba6e5a1a915c91" }, + "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, "nvim-dap": { "branch": "master", "commit": "6f79b822997f2e8a789c6034e147d42bc6706770" }, "nvim-dap-ui": { "branch": "master", "commit": "b7267003ba4dd860350be86f75b9d9ea287cedca" }, - "nvim-lspconfig": { "branch": "master", "commit": "4d38bece98300e3e5cd24a9aa0d0ebfea4951c16" }, + "nvim-lspconfig": { "branch": "master", "commit": "7edfd6692ba17f8d4fe08d84142781898ab0a672" }, "nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, - "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, - "nvim-treesitter": { "branch": "master", "commit": "26171d8f105d97746371d1b6c07c8d88bf13fec2" }, + "nvim-tree.lua": { "branch": "master", "commit": "8b2c5c678be4b49dff6a2df794877000113fd77b" }, + "nvim-treesitter": { "branch": "master", "commit": "f0e3b5c5fe38d0012c63368db90017fef87c85a2" }, "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, - "obsidian.nvim": { "branch": "main", "commit": "c6bd6d93e4724ac2dc0cae73ebe1d568bf406537" }, - "octo.nvim": { "branch": "master", "commit": "22f34582a4eb1fb221eafd0daa9eb1b2bacfb813" }, - "oil.nvim": { "branch": "master", "commit": "76bfc25520e4edc98d089d023b4ed06013639849" }, + "obsidian.nvim": { "branch": "main", "commit": "f0bc495b4a3852a83b48636e9f564586f5e2d29e" }, + "octo.nvim": { "branch": "master", "commit": "7731ca4e31b32c176a383642ffcd7d593ac17774" }, + "oil.nvim": { "branch": "master", "commit": "65c53dbe4f2140236590a7568a5f22a77d16be39" }, "openingh.nvim": { "branch": "main", "commit": "613c18967d42202f3e2a9ac788caf62a402e7c1a" }, "persistence.nvim": { "branch": "main", "commit": "95d03ad5450389ad7dc2a0fab14ebb3d46bc2c96" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "073e45546acaff6b4248e3faea8e67b399d3e864" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "5c9660801ce345cd3835e1947c12b54290ab7e71" }, "rest.nvim": { "branch": "main", "commit": "1ce984c694345f3801bc656072f9a8dd51286a04" }, "telescope-dap.nvim": { "branch": "master", "commit": "8c88d9716c91eaef1cdea13cb9390d8ef447dbfe" }, - "telescope.nvim": { "branch": "master", "commit": "f12b15e1b3a33524eb06a1ae7bc852fb1fd92197" }, - "toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" }, - "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" } + "telescope.nvim": { "branch": "master", "commit": "7bd2f9b72f8449780b79bcf351534e2cd36ec43a" }, + "toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" } } \ No newline at end of file diff --git a/lua/autocmd.lua b/lua/autocmd.lua index 0614abd..191a68e 100644 --- a/lua/autocmd.lua +++ b/lua/autocmd.lua @@ -21,7 +21,7 @@ vim.api.nvim_create_autocmd({ 'TermOpen' }, { -- }) vim.api.nvim_create_autocmd({ 'FileType' }, { - pattern = { 'lua,c,cpp,python,bash' }, + pattern = { 'rust,go,lua,c,cpp,python,bash' }, callback = function() vim.opt_local.colorcolumn = '81,82,83' end, diff --git a/lua/init_lazy.lua b/lua/init_lazy.lua index c6625ca..68ad3ba 100644 --- a/lua/init_lazy.lua +++ b/lua/init_lazy.lua @@ -13,3 +13,4 @@ end vim.opt.rtp:prepend(lazypath) require('lazy').setup('plugins', { dev = { path = '~/Documents/lua' } }) +require('utils').nmap('ll', require('lazy').log) diff --git a/lua/mappings.lua b/lua/mappings.lua index eb649dd..794abce 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -1,40 +1,13 @@ ---[[ -nnoremap r :source ~/.vim/vimrc -c>-]] -local map = require('utils').map local nmap = require('utils').nmap local imap = require('utils').imap -local press_key = require('utils').press_key -- Disable help by F1 nmap('', '') imap('', '') --- nmap('', ':bnext') --- nmap('', ':bprev') - -nmap('', function() - vim.cmd.ToggleTerm() -end) -map('t', '', function() - press_key '' - vim.cmd '1ToggleTerm' -end) -nmap('', function() - local pathStr = vim.api.nvim_buf_get_name(0) - local path = require('plenary.path'):new(pathStr) - if not path:is_path() then - vim.notify('Current buffer is not a file', vim.log.levels.WARN) - return - end - vim.cmd.ToggleTerm('dir=' .. path:parent():expand()) -end) - nmap('', '') nmap('', '') -imap('', '') - vim.keymap.set( 't', '', @@ -43,18 +16,15 @@ vim.keymap.set( ) vim.api.nvim_create_user_command('LspLog', function() + vim.cmd.tabnew() vim.cmd.edit(vim.lsp.get_log_path()) end, {}) --- Plugins - ------ LSP -local telescope = require 'telescope.builtin' nmap('gd', vim.lsp.buf.declaration) nmap('gf', vim.lsp.buf.definition) nmap('gs', vim.cmd.ClangdSwitchSourceHeader) nmap('K', vim.lsp.buf.hover) -nmap('gr', telescope.lsp_references) nmap('lh', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end) @@ -86,77 +56,8 @@ nmap(']h', function() vim.diagnostic.goto_next { severity = { max = vim.diagnostic.severity.INFO } } end) -nmap('ds', telescope.lsp_document_symbols) -nmap('dS', telescope.lsp_workspace_symbols) nmap('qf', vim.lsp.buf.code_action) nmap('rn', vim.lsp.buf.rename) nmap('cf', function() vim.lsp.buf.format { async = true } end) - --- DAP and debug -nmap('', require('dap').continue) -nmap('', require('dap').step_over) -nmap('', require('dap').step_into) -nmap('db', require('dap').toggle_breakpoint) - --- Gitsigns -local gs = require 'gitsigns' -nmap(']c', gs.next_hunk) -nmap('[c', gs.prev_hunk) -nmap('gp', gs.preview_hunk) -nmap('gr', gs.reset_hunk) -nmap('ga', gs.stage_hunk) - --- Neogit -local neogit = require 'neogit' -nmap('gg', function() - neogit.open { kind = 'split' } -end) - --- DiffView -nmap('gd', require('diffview').open) - ------- nvim-tree -local nvim_tree_toggle = function() - require('nvim-tree.api').tree.toggle { find_file = true, update_root = true } -end -nmap('', nvim_tree_toggle) -imap('', function() - press_key '' - nvim_tree_toggle() -end) - --- Telescope -nmap('', function() - telescope.buffers { show_all_buffers = true } -end) -nmap('tc', telescope.commands) -nmap('th', telescope.command_history) -nmap('tH', telescope.highlights) -nmap('tk', telescope.keymaps) -nmap('tr', telescope.registers) -nmap('to', telescope.vim_options) -nmap('tm', telescope.help_tags) -nmap('ti', telescope.highlights) -nmap('tg', telescope.live_grep) -nmap('tw', telescope.grep_string) -nmap('ts', telescope.spell_suggest) -nmap('tq', telescope.quickfix) -nmap('tf', telescope.oldfiles) -nmap('', telescope.find_files) -nmap('gb', telescope.git_branches) -nmap('gs', telescope.git_stash) -nmap('gc', telescope.git_commits) - --- Lazy mapping -nmap('ll', require('lazy').log) - --- ChatGPT -nmap('cg', vim.cmd.ChatGPT) - --- Restore session -nmap('ss', require('persistence').load) -nmap('sl', function() - require('persistence').load { last = true } -end) diff --git a/lua/options.lua b/lua/options.lua index c6026af..d6ab4eb 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -53,7 +53,6 @@ vim.opt.conceallevel = 0 vim.opt.list = true vim.opt.listchars = { trail = '_', tab = '>-' } -vim.opt.grepprg = 'rg --vimgrep' vim.g.mapleader = ' ' vim.opt.mouse = 'r' diff --git a/lua/plugins/copilot_lua.lua b/lua/plugins/copilot_lua.lua index 76d2546..10caf6e 100644 --- a/lua/plugins/copilot_lua.lua +++ b/lua/plugins/copilot_lua.lua @@ -22,7 +22,8 @@ return { require('copilot.command').disable() end end, - 'Toggle copilot', + desc = 'Toggle copilot', }, }, + cmd = 'Copilot' } diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua new file mode 100644 index 0000000..a7a98b9 --- /dev/null +++ b/lua/plugins/dap.lua @@ -0,0 +1,111 @@ +local setup_dap = function() + local dap = require 'dap' + dap.adapters.lldb = { + type = 'executable', + command = '/opt/homebrew/opt/llvm@18/bin/lldb-dap', + name = 'lldb', + } + + dap.configurations.cpp = { + { + name = 'Launch', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input( + 'Path to executable: ', + vim.fn.getcwd() .. '/', + 'file' + ) + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = function() + return vim.split(vim.fn.input 'Input args: ', ' ') + end, + initCommands = { 'command source ~/.lldbinit' }, + }, + { + -- If you get an "Operation not permitted" error using this, try disabling YAMA: + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + name = 'Attach to process', + type = 'lldb', -- Adjust this to match your adapter name (`dap.adapters.`) + request = 'attach', + pid = require('dap.utils').pick_process, + args = {}, + }, + { + name = 'Load core file', + type = 'lldb', + request = 'attach', + program = function() + return vim.fn.input( + 'Path to executable: ', + vim.fn.getcwd() .. '/', + 'file' + ) + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + coreFile = function() + return vim.fn.input('Corefile: ', vim.fn.getcwd() .. '/', 'file') + end, + }, + } + dap.configurations.c = dap.configurations.cpp +end + +return { + { + 'mfussenegger/nvim-dap', + dependencies = { + 'rcarriga/nvim-dap-ui', + 'nvim-telescope/telescope-dap.nvim', + 'nvim-neotest/nvim-nio', + }, + lazy = true, + config = function() + local dap, dapui = require 'dap', require 'dapui' + dapui.setup() + dap.listeners.after.event_initialized['dapui_config'] = function() + dapui.open() + end + dap.listeners.before.event_exited['dapui_config'] = function() + dapui.close() + end + setup_dap() + vim.api.nvim_create_user_command('DapUiToggle', function() + dapui.toggle() + end, {}) + end, + keys = { + { + '', + function() + require('dap').continue() + end, + }, + { + '', + function() + require('dap').step_over() + end, + }, + { + '', + function() + require('dap').step_into() + end, + }, + { + 'db', + function() + require('dap').toggle_breakpoint() + end, + }, + }, + cmd = { + 'DapUiToggle', + }, + }, +} diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua deleted file mode 100644 index eefb11e..0000000 --- a/lua/plugins/debug.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - { - 'mfussenegger/nvim-dap', - dependencies = { - 'rcarriga/nvim-dap-ui', - 'nvim-telescope/telescope-dap.nvim', - }, - }, - { - 'rcarriga/nvim-dap-ui', - dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' }, - config = function() - local dap, dapui = require 'dap', require 'dapui' - dapui.setup() - dap.listeners.after.event_initialized['dapui_config'] = function() - dapui.open() - end - dap.listeners.before.event_terminated['dapui_config'] = function() - dapui.close() - end - dap.listeners.before.event_exited['dapui_config'] = function() - dapui.close() - end - end, - }, -} diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua new file mode 100644 index 0000000..4c43225 --- /dev/null +++ b/lua/plugins/diffview.lua @@ -0,0 +1,15 @@ +return { + { + 'sindrets/diffview.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + keys = { + { + 'gd', + function() + require('diffview').open() + end, + }, + }, + cmd = 'DiffviewOpen', + }, +} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua deleted file mode 100644 index 1fffb46..0000000 --- a/lua/plugins/git.lua +++ /dev/null @@ -1,42 +0,0 @@ -return { - { - 'lewis6991/gitsigns.nvim', - config = true, - dependencies = { 'nvim-lua/plenary.nvim' }, - }, - { - 'sindrets/diffview.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, - }, - 'tpope/vim-fugitive', - { - 'NeogitOrg/neogit', - dependencies = { - 'nvim-lua/plenary.nvim', -- required - 'nvim-telescope/telescope.nvim', -- optional - 'sindrets/diffview.nvim', -- optional - }, - config = function() - require('neogit').setup { - commit_editor = { - kind = 'split', - }, - console_timeout = 10000, - } - end, - }, - -- Github plugins - { - 'pwntester/octo.nvim', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-telescope/telescope.nvim', - 'nvim-tree/nvim-web-devicons', - }, - config = true, - }, - { - 'Almo7aya/openingh.nvim', - config = true, - }, -} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..264a9db --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,40 @@ +return { + { + 'lewis6991/gitsigns.nvim', + config = true, + dependencies = { 'nvim-lua/plenary.nvim' }, + event = { 'BufReadPre', 'BufNewFile' }, + keys = { + { + ']c', + function() + require('gitsigns').next_hunk() + end, + }, + { + '[c', + function() + require('gitsigns').prev_hunk() + end, + }, + { + 'gp', + function() + require('gitsigns').preview_hunk() + end, + }, + { + 'gr', + function() + require('gitsigns').reset_hunk() + end, + }, + { + 'ga', + function() + require('gitsigns').stage_hunk() + end, + }, + }, + } +} diff --git a/lua/plugins/icon-picker.lua b/lua/plugins/icon-picker.lua new file mode 100644 index 0000000..2f6bf48 --- /dev/null +++ b/lua/plugins/icon-picker.lua @@ -0,0 +1,7 @@ +return { + { + 'ziontee113/icon-picker.nvim', + config = true, + cmd = { 'IconPickerNormal', 'IconPickerInsert', 'IconPickerYank' }, + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua deleted file mode 100644 index 26f1d79..0000000 --- a/lua/plugins/init.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - 'neovim/nvim-lspconfig', - { - 'folke/neodev.nvim', - config = true, - }, - { 'kyazdani42/nvim-tree.lua', config = true }, - { - 'MaximilianLloyd/lazy-reload.nvim', - config = true - }, - { - 'ziontee113/icon-picker.nvim', - config = true, - }, -} diff --git a/lua/plugins/lazydev.lua b/lua/plugins/lazydev.lua new file mode 100644 index 0000000..442efaf --- /dev/null +++ b/lua/plugins/lazydev.lua @@ -0,0 +1,14 @@ +return { + { + 'folke/lazydev.nvim', + ft = 'lua', -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, +} diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua new file mode 100644 index 0000000..404b0f2 --- /dev/null +++ b/lua/plugins/neogit.lua @@ -0,0 +1,27 @@ +return { + { + 'NeogitOrg/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', -- required + 'nvim-telescope/telescope.nvim', -- optional + 'sindrets/diffview.nvim', -- optional + }, + config = function() + require('neogit').setup { + commit_editor = { + kind = 'split', + }, + console_timeout = 10000, + } + end, + keys = { + { + 'gg', + function() + require('neogit').open { kind = 'split' } + end, + }, + }, + cmd = 'Neogit', + }, +} diff --git a/lua/plugins/none_ls.lua b/lua/plugins/none_ls.lua index c358790..f64f260 100644 --- a/lua/plugins/none_ls.lua +++ b/lua/plugins/none_ls.lua @@ -1,6 +1,7 @@ return { 'nvimtools/none-ls.nvim', dependencies = { 'nvim-lua/plenary.nvim', 'davidmh/cspell.nvim' }, + event = { 'BufReadPre', 'BufNewFile' }, config = function() local null_ls = require 'null-ls' local cspell = require 'cspell' diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..0eb85ca --- /dev/null +++ b/lua/plugins/nvim-tree.lua @@ -0,0 +1,19 @@ +local nvim_tree_toggle = function() + require('nvim-tree.api').tree.toggle { find_file = true, update_root = true } +end + +return { + 'kyazdani42/nvim-tree.lua', + config = true, + keys = { + { '', nvim_tree_toggle, mode = 'n' }, + { + '', + function() + vim.cmd.stopinsert() + nvim_tree_toggle() + end, + mode = 'i', + }, + }, +} diff --git a/lua/plugins/nvim_cmp.lua b/lua/plugins/nvim_cmp.lua index 983d9c1..0f15807 100644 --- a/lua/plugins/nvim_cmp.lua +++ b/lua/plugins/nvim_cmp.lua @@ -78,6 +78,7 @@ return { end, }, sources = { + { name = 'lazydev' }, { name = 'copilot' }, { name = 'nvim_lsp' }, { name = 'luasnip' }, diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua index a43264d..1ba54f6 100644 --- a/lua/plugins/obsidian.lua +++ b/lua/plugins/obsidian.lua @@ -2,7 +2,7 @@ return { 'epwalsh/obsidian.nvim', version = '*', -- recommended, use latest release instead of latest commit -- lazy = true, - -- ft = 'markdown', + ft = 'markdown', -- Load obsidian.nvim only for markdown files in the vault: -- event = { -- 'BufReadPre ' .. vim.fn.expand('~') .. '/Documents/zk/**.md', diff --git a/lua/plugins/octo.lua b/lua/plugins/octo.lua new file mode 100644 index 0000000..5fc3f6e --- /dev/null +++ b/lua/plugins/octo.lua @@ -0,0 +1,12 @@ +return { + { + 'pwntester/octo.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope.nvim', + 'nvim-tree/nvim-web-devicons', + }, + config = true, + cmd = 'Octo', + }, +} diff --git a/lua/plugins/openingh.lua b/lua/plugins/openingh.lua new file mode 100644 index 0000000..3ffa227 --- /dev/null +++ b/lua/plugins/openingh.lua @@ -0,0 +1,7 @@ +return { + { + 'Almo7aya/openingh.nvim', + config = true, + cmd = { 'OpenInGHFile', 'OpenInGHFileLines', 'OpenInGHRepo' }, + }, +} diff --git a/lua/plugins/other.lua b/lua/plugins/other.lua new file mode 100644 index 0000000..9b64bdc --- /dev/null +++ b/lua/plugins/other.lua @@ -0,0 +1,3 @@ +return { + 'neovim/nvim-lspconfig' +} diff --git a/lua/plugins/rainbow_delimiters.lua b/lua/plugins/rainbow_delimiters.lua new file mode 100644 index 0000000..23975b8 --- /dev/null +++ b/lua/plugins/rainbow_delimiters.lua @@ -0,0 +1,17 @@ +return { + 'hiphish/rainbow-delimiters.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + vim.g.rainbow_delimiters = { + highlight = { + 'RainbowDelimiterGreen', + 'RainbowDelimiterYellow', + 'RainbowDelimiterOrange', + 'RainbowDelimiterViolet', + 'RainbowDelimiterCyan', + 'RainbowDelimiterBlue', + 'RainbowDelimiterRed', + }, + } + end, +} diff --git a/lua/plugins/rest.lua b/lua/plugins/rest.lua index cf48a81..a363270 100644 --- a/lua/plugins/rest.lua +++ b/lua/plugins/rest.lua @@ -6,5 +6,8 @@ return { config = function() require('rest-nvim').setup() end, + keys = { + {'r', function() require'rest-nvim'.run() end}, + } }, } diff --git a/lua/plugins/session.lua b/lua/plugins/session.lua index 9523521..63ddfd4 100644 --- a/lua/plugins/session.lua +++ b/lua/plugins/session.lua @@ -2,4 +2,8 @@ return { 'folke/persistence.nvim', config = true, event = 'BufReadPre', + keys = + { + { 'ss', function() require('persistence').load() end }, + } } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 9c7aabc..2ac34a7 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -7,4 +7,135 @@ return { config = function() require('telescope').load_extension 'dap' end, + cmd = 'Telescope', + keys = { + { + 'gr', + function() + require('telescope.builtin').lsp_references() + end, + }, + + { + 'ds', + function() + require('telescope.builtin').lsp_document_symbols() + end, + }, + { + 'dS', + function() + require('telescope.builtin').lsp_workspace_symbols() + end, + }, + { + '', + function() + require('telescope.builtin').buffers { show_all_buffers = true } + end, + }, + + { + 'tc', + function() + require('telescope.builtin').commands() + end, + }, + { + 'th', + function() + require('telescope.builtin').command_history() + end, + }, + { + 'tH', + function() + require('telescope.builtin').highlights() + end, + }, + { + 'tk', + function() + require('telescope.builtin').keymaps() + end, + }, + { + 'tr', + function() + require('telescope.builtin').registers() + end, + }, + { + 'to', + function() + require('telescope.builtin').vim_options() + end, + }, + { + 'tm', + function() + require('telescope.builtin').help_tags() + end, + }, + { + 'ti', + function() + require('telescope.builtin').highlights() + end, + }, + { + 'tg', + function() + require('telescope.builtin').live_grep() + end, + }, + { + 'tw', + function() + require('telescope.builtin').grep_string() + end, + }, + { + 'ts', + function() + require('telescope.builtin').spell_suggest() + end, + }, + { + 'tq', + function() + require('telescope.builtin').quickfix() + end, + }, + { + 'tf', + function() + require('telescope.builtin').oldfiles() + end, + }, + { + '', + function() + require('telescope.builtin').find_files() + end, + }, + { + 'gb', + function() + require('telescope.builtin').git_branches() + end, + }, + { + 'gs', + function() + require('telescope.builtin').git_stash() + end, + }, + { + 'gc', + function() + require('telescope.builtin').git_commits() + end, + }, + }, } diff --git a/lua/plugins/terminal.lua b/lua/plugins/terminal.lua deleted file mode 100644 index 9ac87b1..0000000 --- a/lua/plugins/terminal.lua +++ /dev/null @@ -1 +0,0 @@ -return {'akinsho/toggleterm.nvim', version = "*", config = true} diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua new file mode 100644 index 0000000..cf8570c --- /dev/null +++ b/lua/plugins/toggleterm.lua @@ -0,0 +1,35 @@ +return { + 'akinsho/toggleterm.nvim', + version = '*', + config = true, + keys = { + { + '', + function() + require('toggleterm').toggle() + end, + mode = 'n', + }, + { + '', + function() + -- vim.cmd '1ToggleTerm' + require('toggleterm').toggle(1) + end, + mode = 't', + }, + { + '', + function() + local pathStr = vim.api.nvim_buf_get_name(0) + local path = require('plenary.path'):new(pathStr) + if not path:is_path() then + vim.notify('Current buffer is not a file', vim.log.levels.WARN) + return + end + vim.cmd.ToggleTerm('dir=' .. path:parent():expand()) + end, + mode = 'n', + }, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 14f0bca..f6569dd 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,33 +1,12 @@ return { - { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - config = function() - require('nvim-treesitter.configs').setup { - ensure_installed = 'all', - highlight = { enable = true }, - indent = { enable = true }, - } - end, - }, - { - 'nvim-treesitter/playground', - dependencies = { 'nvim-treesitter/nvim-treesitter' }, - }, - { - 'hiphish/rainbow-delimiters.nvim', - config = function() - vim.g.rainbow_delimiters = { - highlight = { - 'RainbowDelimiterGreen', - 'RainbowDelimiterYellow', - 'RainbowDelimiterOrange', - 'RainbowDelimiterViolet', - 'RainbowDelimiterCyan', - 'RainbowDelimiterBlue', - 'RainbowDelimiterRed', - }, - } - end, - }, + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = 'all', + highlight = { enable = true }, + indent = { enable = true }, + } + end, } diff --git a/lua/setup_dap.lua b/lua/setup_dap.lua deleted file mode 100644 index adf3509..0000000 --- a/lua/setup_dap.lua +++ /dev/null @@ -1,54 +0,0 @@ -local dap = require 'dap' -dap.adapters.lldb = { - type = 'executable', - command = '/opt/homebrew/opt/llvm@18/bin/lldb-dap', - name = 'lldb', -} - -dap.configurations.cpp = { - { - name = 'Launch', - type = 'lldb', - request = 'launch', - program = function() - return vim.fn.input( - 'Path to executable: ', - vim.fn.getcwd() .. '/', - 'file' - ) - end, - cwd = '${workspaceFolder}', - stopOnEntry = false, - args = function() - return vim.split(vim.fn.input 'Input args: ', ' ') - end, - initCommands = { 'command source ~/.lldbinit' }, - }, - { - -- If you get an "Operation not permitted" error using this, try disabling YAMA: - -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope - name = 'Attach to process', - type = 'lldb', -- Adjust this to match your adapter name (`dap.adapters.`) - request = 'attach', - pid = require('dap.utils').pick_process, - args = {}, - }, - { - name = 'Load core file', - type = 'lldb', - request = 'attach', - program = function() - return vim.fn.input( - 'Path to executable: ', - vim.fn.getcwd() .. '/', - 'file' - ) - end, - cwd = '${workspaceFolder}', - stopOnEntry = false, - coreFile = function() - return vim.fn.input('Corefile: ', vim.fn.getcwd() .. '/', 'file') - end, - }, -} -dap.configurations.c = dap.configurations.cpp diff --git a/lua/utils.lua b/lua/utils.lua index 0fc2c4b..d65cdce 100644 --- a/lua/utils.lua +++ b/lua/utils.lua @@ -3,9 +3,9 @@ local M = {} function M.save_file() local filename = vim.api.nvim_buf_get_name(0) if - not vim.bo.readonly - and vim.bo.buftype == '' - and string.len(filename) > 0 + not vim.bo.readonly + and vim.bo.buftype == '' + and string.len(filename) > 0 then vim.cmd.update() end @@ -18,25 +18,12 @@ M.signs = { Info = ' ', } -M.press_key = function(keys) - vim.api.nvim_feedkeys(keys, 'm', true) -end - M.map = function(mode, lhs, rhs, options) options = - vim.tbl_extend('force', { noremap = false, silent = true }, options or {}) + vim.tbl_extend('force', { noremap = false, silent = true }, options or {}) vim.keymap.set(mode, lhs, rhs, options) end -M.local_map = function(buffer, mode, mapping, command, expr, noremap) - local options = { - expr = expr or false, - noremap = noremap or true, - silent = true, - } - vim.api.nvim_buf_set_keymap(buffer, mode, mapping, command, options) -end - M.nmap = function(lhs, rhs, options) M.map('n', lhs, rhs, options) end