diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-15 20:28:13 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-15 20:28:13 +0200 |
| commit | 17e319a4455f3135ed3cc759dee8ba5034fde75b (patch) | |
| tree | 6d07c1875ae2736a5f3eb026a243328ab5c73fca /.config | |
| parent | 346854ff3ea83202de7437f01f1c1c336f4c3edf (diff) | |
Diffstat (limited to '.config')
33 files changed, 182 insertions, 380 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index c75aed9..2931697 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,12 +1,3 @@ --- ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ --- ┃ ┏┓╻┏━┓ ╻ ╻╻┏┳┓ ┏━╸┏━┓┏┓╻┏━╸╻┏━╸╻ ╻┏━┓┏━┓╺┳╸╻┏━┓┏┓╻ ┃ --- ┃ ┃┗┫┣━┫ ┃┏┛┃┃┃┃ ┃ ┃ ┃┃┗┫┣╸ ┃┃╺┓┃ ┃┣┳┛┣━┫ ┃ ┃┃ ┃┃┗┫ ┃ --- ┃ ╹ ╹┗━┛ ┗┛ ╹╹ ╹ ┗━╸┗━┛╹ ╹╹ ╹┗━┛┗━┛╹┗╸╹ ╹ ╹ ╹┗━┛╹ ╹ ┃ --- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - -require('plug') +require('pm') require('keymap') require('settings') -require('lsp') -require('cmp-config') -require('tree') diff --git a/.config/nvim/lua/coc.lua b/.config/nvim/lua/coc.lua deleted file mode 100644 index 0620fcc..0000000 --- a/.config/nvim/lua/coc.lua +++ /dev/null @@ -1,181 +0,0 @@ --- Some servers have issues with backup files, see #649. -vim.opt.backup = false -vim.opt.writebackup = false - --- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable --- delays and poor user experience. -vim.opt.updatetime = 300 - --- Always show the signcolumn, otherwise it would shift the text each time --- diagnostics appear/become resolved. -vim.opt.signcolumn = "yes" - -local keyset = vim.keymap.set --- Auto complete -function _G.check_back_space() - local col = vim.fn.col('.') - 1 - return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil -end - --- Use tab for trigger completion with characters ahead and navigate. --- NOTE: There's always complete item selected by default, you may want to enable --- no select by `"suggest.noselect": true` in your configuration file. --- NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by --- other plugin before putting this into your config. -local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false} -keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts) -keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts) - --- Make <CR> to accept selected completion item or notify coc.nvim to format --- <C-g>u breaks current undo, please make your own choice. -keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts) - --- Use <c-j> to trigger snippets -keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)") --- Use <c-space> to trigger completion. -keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true}) - --- Use `[g` and `]g` to navigate diagnostics --- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. -keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true}) -keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true}) - --- GoTo code navigation. -keyset("n", "gd", "<Plug>(coc-definition)", {silent = true}) -keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true}) -keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true}) -keyset("n", "gr", "<Plug>(coc-references)", {silent = true}) - - --- Use K to show documentation in preview window. -function _G.show_docs() - local cw = vim.fn.expand('<cword>') - if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then - vim.api.nvim_command('h ' .. cw) - elseif vim.api.nvim_eval('coc#rpc#ready()') then - vim.fn.CocActionAsync('doHover') - else - vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw) - end -end -keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true}) - - --- Highlight the symbol and its references when holding the cursor. -vim.api.nvim_create_augroup("CocGroup", {}) -vim.api.nvim_create_autocmd("CursorHold", { - group = "CocGroup", - command = "silent call CocActionAsync('highlight')", - desc = "Highlight symbol under cursor on CursorHold" -}) - - --- Symbol renaming. -keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true}) - - --- Formatting selected code. -keyset("x", "<leader>cf", "<Plug>(coc-format-selected)", {silent = true}) -keyset("n", "<leader>cf", "<Plug>(coc-format-selected)", {silent = true}) - - --- Setup formatexpr specified filetype(s). -vim.api.nvim_create_autocmd("FileType", { - group = "CocGroup", - pattern = "typescript,json", - command = "setl formatexpr=CocAction('formatSelected')", - desc = "Setup formatexpr specified filetype(s)." -}) - --- Update signature help on jump placeholder. -vim.api.nvim_create_autocmd("User", { - group = "CocGroup", - pattern = "CocJumpPlaceholder", - command = "call CocActionAsync('showSignatureHelp')", - desc = "Update signature help on jump placeholder" -}) - - --- Applying codeAction to the selected region. --- Example: `<leader>aap` for current paragraph -local opts = {silent = true, nowait = true} -keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts) -keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts) - --- Remap keys for applying codeAction to the current buffer. -keyset("n", "<leader>ac", "<Plug>(coc-codeaction)", opts) - - --- Apply AutoFix to problem on the current line. -keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts) - - --- Run the Code Lens action on the current line. -keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts) - - --- Map function and class text objects --- NOTE: Requires 'textDocument.documentSymbol' support from the language server. -keyset("x", "if", "<Plug>(coc-funcobj-i)", opts) -keyset("o", "if", "<Plug>(coc-funcobj-i)", opts) -keyset("x", "af", "<Plug>(coc-funcobj-a)", opts) -keyset("o", "af", "<Plug>(coc-funcobj-a)", opts) -keyset("x", "ic", "<Plug>(coc-classobj-i)", opts) -keyset("o", "ic", "<Plug>(coc-classobj-i)", opts) -keyset("x", "ac", "<Plug>(coc-classobj-a)", opts) -keyset("o", "ac", "<Plug>(coc-classobj-a)", opts) - - --- Remap <C-f> and <C-b> for scroll float windows/popups. ----@diagnostic disable-next-line: redefined-local -local opts = {silent = true, nowait = true, expr = true} -keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts) -keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts) -keyset("i", "<C-f>", - 'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts) -keyset("i", "<C-b>", - 'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts) -keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts) -keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts) - - --- Use CTRL-S for selections ranges. --- Requires 'textDocument/selectionRange' support of language server. -keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true}) -keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true}) - - --- Add `:Format` command to format current buffer. -vim.api.nvim_create_user_command("Format", "call CocAction('format')", {}) - --- " Add `:Fold` command to fold current buffer. -vim.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'}) - --- Add `:OR` command for organize imports of the current buffer. -vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {}) - --- Add (Neo)Vim's native statusline support. --- NOTE: Please see `:h coc-status` for integrations with external plugins that --- provide custom statusline: lightline.vim, vim-airline. -vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}") - --- Mappings for CoCList --- code actions and coc stuff ----@diagnostic disable-next-line: redefined-local -local opts = {silent = true, nowait = true} --- Show all diagnostics. -keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts) --- Manage extensions. -keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts) --- Show commands. -keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts) --- Find symbol of current document. -keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts) --- Search workspace symbols. -keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts) --- Do default action for next item. -keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts) --- Do default action for previous item. -keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts) --- Resume latest coc list. -keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts) diff --git a/.config/nvim/lua/fs.lua b/.config/nvim/lua/fs.lua new file mode 100644 index 0000000..2b215ef --- /dev/null +++ b/.config/nvim/lua/fs.lua @@ -0,0 +1,13 @@ +return { + iterdir = function(path) + local dir = vim.uv.fs_opendir(path) + return function() + local next = vim.uv.fs_readdir(dir) + if (next == nil) then + vim.uv.fs_closedir(dir) + return nil + end + return next[1] + end + end +} diff --git a/.config/nvim/lua/keymap.lua b/.config/nvim/lua/keymap.lua index 5b709cb..20a4906 100644 --- a/.config/nvim/lua/keymap.lua +++ b/.config/nvim/lua/keymap.lua @@ -1,48 +1,36 @@ --- ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ --- ┃ ┏┓╻┏━┓ ╻ ╻╻┏┳┓ ╻┏ ┏━╸╻ ╻┏┳┓┏━┓┏━┓┏━┓ ┃ --- ┃ ┃┗┫┣━┫ ┃┏┛┃┃┃┃ ┣┻┓┣╸ ┗┳┛┃┃┃┣━┫┣━┛┗━┓ ┃ --- ┃ ╹ ╹┗━┛ ┗┛ ╹╹ ╹ ╹ ╹┗━╸ ╹ ╹ ╹╹ ╹╹ ┗━┛ ┃ --- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - vim.g.mapleader = ',' -vim.api.nvim_set_keymap("n", "<leader>C", "<leader>c<space>", {}) -vim.api.nvim_set_keymap("n", "<leader>n", "<C-w>n", {noremap = true}) -vim.api.nvim_set_keymap("n", "<leader>sc", ":so $MYVIMRC<CR>", {noremap = true}) -vim.api.nvim_set_keymap("n", "<leader>ec", ":e $MYVIMRC<CR>", {noremap = true}) -vim.api.nvim_set_keymap("n", "<leader>tn", ":tabnew<CR>", {noremap = true}) -vim.api.nvim_set_keymap("n", "<leader>tc", ":tabclose<CR>", {noremap = true}) -vim.api.nvim_set_keymap("n", "<leader>tt", ":tabnew<CR>:term<CR>a", {noremap = true}) +vim.keymap.set('n', '<leader>C', '<leader>c<space>', {}) +vim.keymap.set('n', '<leader>sc', ':so $MYVIMRC<CR>', { noremap = true }) +vim.keymap.set('n', '<leader>ec', ':e ~/.config/nvim/<CR>', { noremap = true }) +vim.keymap.set('n', '<leader>tn', ':tabnew<CR>', { noremap = true }) +vim.keymap.set('n', '<leader>tc', ':tabclose<CR>', { noremap = true }) +vim.keymap.set('n', '<leader>tT', ':tabnew<CR>:term<CR>', { noremap = true }) +vim.keymap.set('n', '<leader>Th', '<C-w>n:term<CR>', { noremap = true }) +vim.keymap.set('n', '<leader>Tv', '<C-w>v:term<CR>', { noremap = true }) -vim.api.nvim_set_keymap("n", "<leader>f", ":NvimTreeToggle<CR>", {noremap = true}) -vim.api.nvim_set_keymap("n", "<leader>F", ":NvimTreeFindFileToggle<CR>", {noremap = true}) +vim.keymap.set('n', '<leader>tf', ':NvimTreeToggle<CR>', { noremap = true }) +vim.keymap.set('n', '<leader>tF', ':NvimTreeFindFileToggle<CR>', { noremap = true }) -vim.api.nvim_set_keymap("i", "(", "()<Esc>i", {noremap = true}) -vim.api.nvim_set_keymap("i", ")", "<ESC>:call brackify#putbracket(')')<CR>la", {noremap = true}) -vim.api.nvim_set_keymap("i", "[", "[]<Esc>i", {noremap = true}) -vim.api.nvim_set_keymap("i", "]", "<ESC>:call brackify#putbracket(']')<CR>la", {noremap = true}) -vim.api.nvim_set_keymap("i", "{", "{}<Esc>i", {noremap = true}) -vim.api.nvim_set_keymap("i", "}", "<ESC>:call brackify#putbracket('}')<CR>la", {noremap = true}) -vim.api.nvim_set_keymap("i", '"', "<ESC>:call brackify#putquotes('\"')<CR>a", {noremap = true}) -vim.api.nvim_set_keymap("i", "'", "<ESC>:call brackify#putquotes(\"'\")<CR>a", {noremap = true}) -vim.cmd('autocmd Filetype html inoremap <buffer> < <><ESC>i') -vim.cmd('autocmd Filetype html inoremap <buffer> > <ESC>:call brackify#putbracket(">")<CR>la') -vim.cmd('autocmd FileType tex inoremap <buffer> " "') -vim.cmd('autocmd FileType tex inoremap <buffer> \' \'') +local builtin = require('telescope.builtin') +vim.keymap.set('n', '<leader>f', builtin.find_files, {}) +vim.keymap.set('n', '<leader>b', builtin.buffers, {}) +vim.keymap.set('v', '(', 's(<ESC>pa)', { noremap = true }) +vim.keymap.set('v', '[', 's[<ESC>pa]', { noremap = true }) +vim.keymap.set('v', '{', 's{<ESC>pa}', { noremap = true }) +vim.keymap.set('v', '"', 's"<ESC>pa"', { noremap = true }) +vim.keymap.set('v', "'", "s'<ESC>pa'", { noremap = true }) -vim.api.nvim_set_keymap("v", "(", "s(<ESC>pa)", {noremap = true}) -vim.api.nvim_set_keymap("v", "[", "s[<ESC>pa]", {noremap = true}) -vim.api.nvim_set_keymap("v", "{", "s{<ESC>pa}", {noremap = true}) -vim.api.nvim_set_keymap("v", '"', 's"<ESC>pa"', {noremap = true}) -vim.api.nvim_set_keymap("v", "'", "s'<ESC>pa'", {noremap = true}) +vim.keymap.set('i', '<C-u>a', 'ä', { noremap = true }) +vim.keymap.set('i', '<C-u>A', 'Ä', { noremap = true }) +vim.keymap.set('i', '<C-u>o', 'ö', { noremap = true }) +vim.keymap.set('i', '<C-u>O', 'Ö', { noremap = true }) +vim.keymap.set('i', '<C-u>u', 'ü', { noremap = true }) +vim.keymap.set('i', '<C-u>U', 'Ü', { noremap = true }) -vim.api.nvim_set_keymap("i", "<C-u>a", "ä", {noremap = true}) -vim.api.nvim_set_keymap("i", "<C-u>A", "Ä", {noremap = true}) -vim.api.nvim_set_keymap("i", "<C-u>o", "ö", {noremap = true}) -vim.api.nvim_set_keymap("i", "<C-u>O", "Ö", {noremap = true}) -vim.api.nvim_set_keymap("i", "<C-u>u", "ü", {noremap = true}) -vim.api.nvim_set_keymap("i", "<C-u>U", "Ü", {noremap = true}) +vim.keymap.set('n', '<space>T', ':lua require("cargotest").test_crate()<cr>', { noremap = true }) +vim.keymap.set('n', '<space>t', ':lua require("cargotest").test_module()<cr>', { noremap = true }) +vim.keymap.set('n', '<leader>z', 'va{zfzz', { noremap = true }) -vim.api.nvim_set_keymap("n", "<space>T", ":lua require('cargotest').test_crate()<cr>", {noremap = true}) -vim.api.nvim_set_keymap("n", "<space>t", ":lua require('cargotest').test_module()<cr>", {noremap = true}) -vim.api.nvim_set_keymap("n", "<leader>z", "va{zfzz", {noremap = true}) +vim.keymap.set('t', '<a-esc>', '<C-\\><C-n>', { noremap = true }) +vim.keymap.set('t', '<a-q>', '<C-\\><C-n>ZZ', { noremap = true }) diff --git a/.config/nvim/lua/plug.lua b/.config/nvim/lua/plug.lua deleted file mode 100644 index 91aa8be..0000000 --- a/.config/nvim/lua/plug.lua +++ /dev/null @@ -1,64 +0,0 @@ --- ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ --- ┃ ┏┓╻┏━┓ ╻ ╻╻┏┳┓ ┏━┓╻ ╻ ╻┏━╸╻┏┓╻┏━┓ ┃ --- ┃ ┃┗┫┣━┫ ┃┏┛┃┃┃┃ ┣━┛┃ ┃ ┃┃╺┓┃┃┗┫┗━┓ ┃ --- ┃ ╹ ╹┗━┛ ┗┛ ╹╹ ╹ ╹ ┗━╸┗━┛┗━┛╹╹ ╹┗━┛ ┃ --- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - - -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ - { "nvim-treesitter/nvim-treesitter" }, - { "neovim/nvim-lspconfig" }, - { "L3MON4D3/LuaSnip" }, - { "rafamadriz/friendly-snippets" }, - { "saadparwaiz1/cmp_luasnip" }, - { "hrsh7th/cmp-nvim-lua" }, - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-path" }, - { - 'hrsh7th/nvim-cmp', - event = "InsertEnter", - dependencies = { - { - -- snippet plugin - "L3MON4D3/LuaSnip", - dependencies = "rafamadriz/friendly-snippets", - opts = { history = true, updateevents = "TextChanged,TextChangedI" }, - config = function(_, opts) - require("luasnip").config.set_config(opts) - end, - }, - }, - { - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - }, - }, - { 'cargotest.nvim', url = 'https://git.nathanreiner.xyz/cargotest.nvim' }, - { - "nvim-tree/nvim-tree.lua", - version = "*", - lazy = false, - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - config = function() - require("nvim-tree").setup {} - end, - }, - { "elkowar/yuck.vim" } -}) diff --git a/.config/nvim/lua/pm/init.lua b/.config/nvim/lua/pm/init.lua new file mode 100644 index 0000000..bdc603c --- /dev/null +++ b/.config/nvim/lua/pm/init.lua @@ -0,0 +1,27 @@ +local fs = require('fs') + +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' +if not vim.uv.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +local plugins = {} + +for entry in fs.iterdir(vim.fn.stdpath('config') .. '/lua/pm/plugins/') do + local plugin = require('pm.plugins.' .. entry.name .. '.load') + table.insert(plugins, plugin) +end + +require('lazy').setup(plugins) + +for entry in fs.iterdir(vim.fn.stdpath('config') .. '/lua/pm/plugins/') do + require('pm.plugins.' .. entry.name .. '.setup') +end diff --git a/.config/nvim/lua/pm/plugins/cargotest/load.lua b/.config/nvim/lua/pm/plugins/cargotest/load.lua new file mode 100644 index 0000000..b33d268 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cargotest/load.lua @@ -0,0 +1 @@ +return { 'cargotest.nvim', url = 'https://git.nathanreiner.xyz/cargotest.nvim' } diff --git a/.config/nvim/lua/pm/plugins/cargotest/setup.lua b/.config/nvim/lua/pm/plugins/cargotest/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cargotest/setup.lua diff --git a/.config/nvim/lua/pm/plugins/cmp-luasnip/load.lua b/.config/nvim/lua/pm/plugins/cmp-luasnip/load.lua new file mode 100644 index 0000000..ee618d8 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cmp-luasnip/load.lua @@ -0,0 +1 @@ +return { "saadparwaiz1/cmp_luasnip" } diff --git a/.config/nvim/lua/pm/plugins/cmp-luasnip/setup.lua b/.config/nvim/lua/pm/plugins/cmp-luasnip/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cmp-luasnip/setup.lua diff --git a/.config/nvim/lua/pm/plugins/cmp-nvim-lsp/load.lua b/.config/nvim/lua/pm/plugins/cmp-nvim-lsp/load.lua new file mode 100644 index 0000000..8b66a82 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cmp-nvim-lsp/load.lua @@ -0,0 +1 @@ +return { "hrsh7th/cmp-nvim-lsp" } diff --git a/.config/nvim/lua/pm/plugins/cmp-nvim-lsp/setup.lua b/.config/nvim/lua/pm/plugins/cmp-nvim-lsp/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cmp-nvim-lsp/setup.lua diff --git a/.config/nvim/lua/pm/plugins/cmp-nvim-lua/load.lua b/.config/nvim/lua/pm/plugins/cmp-nvim-lua/load.lua new file mode 100644 index 0000000..9d93c20 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cmp-nvim-lua/load.lua @@ -0,0 +1 @@ +return { "hrsh7th/cmp-nvim-lua" } diff --git a/.config/nvim/lua/pm/plugins/cmp-nvim-lua/setup.lua b/.config/nvim/lua/pm/plugins/cmp-nvim-lua/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cmp-nvim-lua/setup.lua diff --git a/.config/nvim/lua/pm/plugins/cmp-path/load.lua b/.config/nvim/lua/pm/plugins/cmp-path/load.lua new file mode 100644 index 0000000..b007d93 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cmp-path/load.lua @@ -0,0 +1 @@ +return { "hrsh7th/cmp-path" } diff --git a/.config/nvim/lua/pm/plugins/cmp-path/setup.lua b/.config/nvim/lua/pm/plugins/cmp-path/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/cmp-path/setup.lua diff --git a/.config/nvim/lua/pm/plugins/friendly-snippets/load.lua b/.config/nvim/lua/pm/plugins/friendly-snippets/load.lua new file mode 100644 index 0000000..144e221 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/friendly-snippets/load.lua @@ -0,0 +1 @@ +return { "rafamadriz/friendly-snippets" } diff --git a/.config/nvim/lua/pm/plugins/friendly-snippets/setup.lua b/.config/nvim/lua/pm/plugins/friendly-snippets/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/friendly-snippets/setup.lua diff --git a/.config/nvim/lua/pm/plugins/lspconfig/load.lua b/.config/nvim/lua/pm/plugins/lspconfig/load.lua new file mode 100644 index 0000000..7e06214 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/lspconfig/load.lua @@ -0,0 +1 @@ +return { "neovim/nvim-lspconfig" } diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/pm/plugins/lspconfig/setup.lua index 87c00ed..2f604db 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/pm/plugins/lspconfig/setup.lua @@ -1,9 +1,3 @@ --- ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ --- ┃ ╻ ┏━┓┏━┓ ┏━╸┏━┓┏┓╻┏━╸╻┏━╸ ┃ --- ┃ ┃ ┗━┓┣━┛ ┃ ┃ ┃┃┗┫┣╸ ┃┃╺┓ ┃ --- ┃ ┗━╸┗━┛╹ ┗━╸┗━┛╹ ╹╹ ╹┗━┛ ┃ --- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - vim.diagnostic.config({ virtual_text = { prefix = "" @@ -13,7 +7,6 @@ vim.diagnostic.config({ vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) - vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' local opts = { buffer = ev.buf } @@ -46,52 +39,46 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities() local lspconfig = require('lspconfig') -local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver' } +local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'cssls' } for _, lsp in ipairs(servers) do lspconfig[lsp].setup { capabilities = capabilities, + on_init = function(client) + client.offset_encoding = "utf-8" + end, } end lspconfig.lua_ls.setup { - on_init = function(client) - local path = client.workspace_folders[1].name - if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then - client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using - -- (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT' - }, - -- Make the server aware of Neovim runtime files - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME - -- "${3rd}/luv/library" - -- "${3rd}/busted/library", - } - -- or pull in all of 'runtimepath'. NOTE: this is a lot slower - -- library = vim.api.nvim_get_runtime_file("", true) - } - } - }) - - client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) - end - return true - end + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = { + 'vim', + 'require' + }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + }, + telemetry = { + enable = false, + }, + }, + }, } + vim.api.nvim_create_autocmd("InsertLeave", { - callback = function() - if - require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] - and not require("luasnip").session.jump_active - then - require("luasnip").unlink_current() - end - end, + callback = function() + if + require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] + and not require("luasnip").session.jump_active + then + require("luasnip").unlink_current() + end + end, }) - diff --git a/.config/nvim/lua/pm/plugins/luasnip/load.lua b/.config/nvim/lua/pm/plugins/luasnip/load.lua new file mode 100644 index 0000000..2529e38 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/luasnip/load.lua @@ -0,0 +1 @@ +return { "L3MON4D3/LuaSnip" } diff --git a/.config/nvim/lua/pm/plugins/luasnip/setup.lua b/.config/nvim/lua/pm/plugins/luasnip/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/luasnip/setup.lua diff --git a/.config/nvim/lua/pm/plugins/nvim-cmp/load.lua b/.config/nvim/lua/pm/plugins/nvim-cmp/load.lua new file mode 100644 index 0000000..25509d5 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/nvim-cmp/load.lua @@ -0,0 +1,20 @@ +return { + 'hrsh7th/nvim-cmp', + event = "InsertEnter", + dependencies = { + { + "L3MON4D3/LuaSnip", + dependencies = "rafamadriz/friendly-snippets", + opts = { history = true, updateevents = "TextChanged,TextChangedI" }, + config = function(_, opts) + require("luasnip").config.set_config(opts) + end, + }, + { + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + }, + }, +} diff --git a/.config/nvim/lua/cmp-config.lua b/.config/nvim/lua/pm/plugins/nvim-cmp/setup.lua index 2bb6047..c1c9644 100644 --- a/.config/nvim/lua/cmp-config.lua +++ b/.config/nvim/lua/pm/plugins/nvim-cmp/setup.lua @@ -1,4 +1,4 @@ -local cmp = require "cmp" +local cmp = require("cmp") require("luasnip.loaders.from_vscode").lazy_load() local function border(hl_name) @@ -14,10 +14,6 @@ local function border(hl_name) } end ---if cmp_style ~= "atom" and cmp_style ~= "atom_colored" then --- options.window.completion.border = border "CmpBorder" --- end - cmp.setup { completion = { completeopt = "menu,menuone", diff --git a/.config/nvim/lua/pm/plugins/nvim-tree/load.lua b/.config/nvim/lua/pm/plugins/nvim-tree/load.lua new file mode 100644 index 0000000..adffb8a --- /dev/null +++ b/.config/nvim/lua/pm/plugins/nvim-tree/load.lua @@ -0,0 +1,11 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("nvim-tree").setup {} + end, +} diff --git a/.config/nvim/lua/tree.lua b/.config/nvim/lua/pm/plugins/nvim-tree/setup.lua index 4615e61..d7d6ade 100644 --- a/.config/nvim/lua/tree.lua +++ b/.config/nvim/lua/pm/plugins/nvim-tree/setup.lua @@ -50,7 +50,7 @@ require("nvim-tree").setup({ vim.api.nvim_create_autocmd({ 'WinEnter', 'BufWinEnter' }, { pattern = 'NvimTree*', callback = function() - local def = vim.api.nvim_get_hl_by_name('Cursor', true) + local def = vim.api.nvim_get_hl(0, { name = 'Cursor' }) vim.api.nvim_set_hl(0, 'Cursor', vim.tbl_extend('force', def, { blend = 100 })) vim.opt.guicursor:append('a:Cursor/lCursor') end, @@ -59,7 +59,7 @@ vim.api.nvim_create_autocmd({ 'WinEnter', 'BufWinEnter' }, { vim.api.nvim_create_autocmd({ 'BufLeave', 'WinClosed' }, { pattern = 'NvimTree*', callback = function() - local def = vim.api.nvim_get_hl_by_name('Cursor', true) + local def = vim.api.nvim_get_hl(0, { name = 'Cursor' }) vim.api.nvim_set_hl(0, 'Cursor', vim.tbl_extend('force', def, { blend = 0 })) vim.opt.guicursor = 'n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20' end, diff --git a/.config/nvim/lua/pm/plugins/telescope/load.lua b/.config/nvim/lua/pm/plugins/telescope/load.lua new file mode 100644 index 0000000..bf1514a --- /dev/null +++ b/.config/nvim/lua/pm/plugins/telescope/load.lua @@ -0,0 +1,5 @@ +return { + 'nvim-telescope/telescope.nvim', + tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' } +} diff --git a/.config/nvim/lua/pm/plugins/telescope/setup.lua b/.config/nvim/lua/pm/plugins/telescope/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/telescope/setup.lua diff --git a/.config/nvim/lua/pm/plugins/treesitter/load.lua b/.config/nvim/lua/pm/plugins/treesitter/load.lua new file mode 100644 index 0000000..c6bc242 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/treesitter/load.lua @@ -0,0 +1 @@ +return { "nvim-treesitter/nvim-treesitter" } diff --git a/.config/nvim/lua/pm/plugins/treesitter/setup.lua b/.config/nvim/lua/pm/plugins/treesitter/setup.lua new file mode 100644 index 0000000..031eec9 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/treesitter/setup.lua @@ -0,0 +1,26 @@ +local status_ok, configs = pcall(require, "nvim-treesitter.configs") +if not status_ok then + return +end + +configs.setup({ + ensure_installed = "all", + ignore_install = { "" }, + highlight = { + enable = true, + disable = { "css" }, + }, + auto_install = true, + sync_install = false, + modules = {}, + autopairs = { + enable = true, + }, + indent = { + enable = true, + }, +}) + +vim.filetype.add({ + pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, +}) diff --git a/.config/nvim/lua/pm/plugins/yuck/load.lua b/.config/nvim/lua/pm/plugins/yuck/load.lua new file mode 100644 index 0000000..224e173 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/yuck/load.lua @@ -0,0 +1 @@ +return { "elkowar/yuck.vim" } diff --git a/.config/nvim/lua/pm/plugins/yuck/setup.lua b/.config/nvim/lua/pm/plugins/yuck/setup.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/lua/pm/plugins/yuck/setup.lua diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index ca2b1e8..f6f590d 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -1,13 +1,7 @@ --- ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ --- ┃ ┏┓╻┏━┓ ╻ ╻╻┏┳┓ ┏━┓┏━╸╺┳╸╺┳╸╻┏┓╻┏━╸┏━┓ ┃ --- ┃ ┃┗┫┣━┫ ┃┏┛┃┃┃┃ ┗━┓┣╸ ┃ ┃ ┃┃┗┫┃╺┓┗━┓ ┃ --- ┃ ╹ ╹┗━┛ ┗┛ ╹╹ ╹ ┗━┛┗━╸ ╹ ╹ ╹╹ ╹┗━┛┗━┛ ┃ --- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - vim.opt.shell = '/usr/bin/zsh' vim.opt.path = "**" -vim.cmd('colorscheme n8') +vim.cmd('colorscheme knight') vim.opt.mouse = 'a' vim.opt.tabstop = 2 @@ -16,7 +10,7 @@ vim.opt.expandtab = false vim.opt.shiftwidth = 2 vim.opt.smartindent = true vim.opt.list = true; -vim.opt.listchars = { tab= '> ', eol = '¬', trail = '·', nbsp = '•'} +vim.opt.listchars = { tab = '> ', eol = '¬', trail = '·', nbsp = '•' } vim.opt.splitright = true vim.opt.splitbelow = false vim.opt.laststatus = 2 @@ -41,29 +35,8 @@ vim.g.netrw_browser_split = 2 vim.g.netrw_keepdir = true vim.g.netrw_winsize = 30 vim.cmd('autocmd Filetype netrw setlocal nolist') +vim.cmd('autocmd TermOpen * startinsert') +vim.cmd('autocmd TermOpen * setlocal nonumber') +vim.cmd('autocmd TermOpen * setlocal signcolumn=no') vim.cmd("call statusbar#refresh()") - -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end - -configs.setup({ - ensure_installed = "all", - ignore_install = { "" }, - highlight = { - enable = true, - disable = { "css" }, - }, - autopairs = { - enable = true, - }, - indent = { - enable = true, - }, -}) - -vim.filetype.add({ - pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, -}) |