diff options
Diffstat (limited to 'nvim-primeagen/after/plugin')
-rw-r--r-- | nvim-primeagen/after/plugin/ale.lua | 41 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/cmp.lua | 41 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/colors.lua | 14 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/copilot.lua | 17 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/dap.lua | 41 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/fugitive.lua | 1 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/harpoon.lua | 10 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/ledger.lua | 4 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/lsp.lua | 99 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/luasnip.lua | 26 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/marksman.lua | 1 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/neotest-python.lua | 116 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/telescope.lua | 17 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/todo-txt.lua | 44 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/treesitter.lua | 23 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/trouble.lua | 3 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/undotree.lua | 2 | ||||
-rw-r--r-- | nvim-primeagen/after/plugin/zenmode.lua | 30 |
18 files changed, 530 insertions, 0 deletions
diff --git a/nvim-primeagen/after/plugin/ale.lua b/nvim-primeagen/after/plugin/ale.lua new file mode 100644 index 0000000..b3b5c0d --- /dev/null +++ b/nvim-primeagen/after/plugin/ale.lua @@ -0,0 +1,41 @@ +-- Set the configuration options for the plugin +local linters = { + python = {'ruff', 'flake8', 'pyright'}, + ocaml = {'merlin'}, + cpp = {'clang'}, + yaml = {'yamllint'}, + c = {'clang'}, + go = {'gopls', 'golint', 'gofmt'}, +} + +local fixers = { + python = {'ruff', 'isort', 'yapf', 'black', 'autoimport'}, + go = {'gofmt'}, + rust = {'rustfmt'}, +} + +local pyright_config = { + useLibraryCodeForTypes = 1, + disableLanguageServices = 1, + autoImportCompletions = 1, +} + +vim.api.nvim_set_var('ale_linters', linters) +vim.api.nvim_set_var('ale_python_pyright_config', pyright_config) +vim.api.nvim_set_var('ale_fix_on_save', 1) +vim.api.nvim_set_var('ale_warn_about_trailing_whitespace', 1) +vim.api.nvim_set_var('ale_disable_lsp', 1) +vim.api.nvim_set_var('ale_use_neovim_diagnostics_api', 1) +vim.api.nvim_set_var('ale_set_quickfix', 1) +vim.api.nvim_set_var('ale_echo_cursor', 1) +vim.api.nvim_set_var('ale_echo_msg_error_str', 'Error') +vim.api.nvim_set_var('ale_echo_msg_form', '%linter% - %code: %%s') +vim.api.nvim_set_var('ale_loclist_msg_format', '%linter% - %code: %%s') +vim.api.nvim_set_var('ale_echo_msg_warning_s', 'Warning') +vim.api.nvim_set_var('ale_fixers', fixers) +vim.api.nvim_set_var('ale_python_mypy_ignore_invalid_syntax', 1) +vim.api.nvim_set_var('ale_python_mypy_executable', 'mypy') +vim.api.nvim_set_var('ale_python_mypy_options', '--config-file mypy.ini') +vim.api.nvim_set_var('g:ale_sign_error', '>>') +vim.api.nvim_set_var('ale_fix_on_save', 1) +vim.api.nvim_set_var('ale_linters_explicit', 0) diff --git a/nvim-primeagen/after/plugin/cmp.lua b/nvim-primeagen/after/plugin/cmp.lua new file mode 100644 index 0000000..a85ee9b --- /dev/null +++ b/nvim-primeagen/after/plugin/cmp.lua @@ -0,0 +1,41 @@ +local cmp = require("cmp") +local luasnip = require("luasnip") + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For luasnip users + end, + }, + sources = { + { name = "luasnip" }, + { name = "path" }, + }, + mapping = { + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- they way you will only jump inside the snippet region + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + + -- ... Your other mappings ... + }, +}) diff --git a/nvim-primeagen/after/plugin/colors.lua b/nvim-primeagen/after/plugin/colors.lua new file mode 100644 index 0000000..fe97b1b --- /dev/null +++ b/nvim-primeagen/after/plugin/colors.lua @@ -0,0 +1,14 @@ +require('rose-pine').setup({ + disable_background = true +}) + +function ColorMyPencils(color) + color = color or "rose-pine" + vim.cmd.colorscheme(color) + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + +end + +ColorMyPencils() diff --git a/nvim-primeagen/after/plugin/copilot.lua b/nvim-primeagen/after/plugin/copilot.lua new file mode 100644 index 0000000..7ed6529 --- /dev/null +++ b/nvim-primeagen/after/plugin/copilot.lua @@ -0,0 +1,17 @@ +vim.g.copilot_no_tab_map = true +vim.api.nvim_set_keymap("i", "<C-J>", 'copilot#Accept("<CR>")', { silent = true, expr = true }) +-- not working vim.g.copilot_assume_mapped = true + +vim.g.copilot_filetypes = { + ["*"] = false, + ["markdown"] = false, + ["javascript"] = false, + ["typescript"] = false, + ["lua"] = true, + ["rust"] = true, + ["c"] = true, + ["c#"] = true, + ["c++"] = true, + ["go"] = true, + ["python"] = true, +} diff --git a/nvim-primeagen/after/plugin/dap.lua b/nvim-primeagen/after/plugin/dap.lua new file mode 100644 index 0000000..fcfb94a --- /dev/null +++ b/nvim-primeagen/after/plugin/dap.lua @@ -0,0 +1,41 @@ +local dap = require('dap') +dap.adapters.python = { + type = 'executable'; + command = '.venv/bin/python'; + args = { '-m', 'debugpy.adapter' }; +} +dap.configurations.python = { + { + type = 'python'; + request = 'launch'; + name = "Launch file"; + program = "${file}"; + pythonPath = function() + return '.venv/bin/python' + end; + }, +} + +vim.keymap.set('n', '<F5>', function() require('dap').continue() end) +vim.keymap.set('n', '<F10>', function() require('dap').step_over() end) +vim.keymap.set('n', '<F11>', function() require('dap').step_into() end) +vim.keymap.set('n', '<F12>', function() require('dap').step_out() end) +vim.keymap.set('n', '<F9>', function() require('dap').toggle_breakpoint() end) +vim.keymap.set('n', '<Leader>B', function() require('dap').set_breakpoint() end) +vim.keymap.set('n', '<Leader>lp', function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end) +vim.keymap.set('n', '<Leader>dr', function() require('dap').repl.open() end) +vim.keymap.set('n', '<Leader>dl', function() require('dap').run_last() end) +vim.keymap.set({'n', 'v'}, '<Leader>dh', function() + require('dap.ui.widgets').hover() +end) +vim.keymap.set({'n', 'v'}, '<Leader>dp', function() + require('dap.ui.widgets').preview() +end) +vim.keymap.set('n', '<Leader>df', function() + local widgets = require('dap.ui.widgets') + widgets.centered_float(widgets.frames) +end) +vim.keymap.set('n', '<Leader>ds', function() + local widgets = require('dap.ui.widgets') + widgets.centered_float(widgets.scopes) +end) diff --git a/nvim-primeagen/after/plugin/fugitive.lua b/nvim-primeagen/after/plugin/fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/nvim-primeagen/after/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "<leader>gs", vim.cmd.Git) diff --git a/nvim-primeagen/after/plugin/harpoon.lua b/nvim-primeagen/after/plugin/harpoon.lua new file mode 100644 index 0000000..4f57af5 --- /dev/null +++ b/nvim-primeagen/after/plugin/harpoon.lua @@ -0,0 +1,10 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "<leader>a", mark.add_file) +vim.keymap.set("n", "<leader>bh", ui.toggle_quick_menu) + +vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end) +vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end) +vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end) +vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end) diff --git a/nvim-primeagen/after/plugin/ledger.lua b/nvim-primeagen/after/plugin/ledger.lua new file mode 100644 index 0000000..6a47935 --- /dev/null +++ b/nvim-primeagen/after/plugin/ledger.lua @@ -0,0 +1,4 @@ +-- easily make a transaction starred with <leader>- +vim.keymap.set("n", "<leader>-", "<cmd>call ledger#transaction_state_set(line('.'), '*')<CR>") + +vim.api.nvim_set_var("ledger_detailed_first", 0) diff --git a/nvim-primeagen/after/plugin/lsp.lua b/nvim-primeagen/after/plugin/lsp.lua new file mode 100644 index 0000000..e6e2bda --- /dev/null +++ b/nvim-primeagen/after/plugin/lsp.lua @@ -0,0 +1,99 @@ +local lsp = require("lsp-zero") + +lsp.preset("recommended") + +lsp.ensure_installed({ + 'pyright', 'lua_ls' +}) + +-- Fix Undefined global 'vim' +lsp.configure('lua_ls', { + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + } +}) + + +-- local cmp = require('cmp') +-- local cmp_select = {behavior = cmp.SelectBehavior.Select} +-- local cmp_mappings = lsp.defaults.cmp_mappings({ +-- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), +-- ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), +-- ['<C-y>'] = cmp.mapping.confirm({ select = true }), +-- ["<C-Space>"] = cmp.mapping.complete(), +-- }) + +-- cmp_mappings['<Tab>'] = nil +-- cmp_mappings['<S-Tab>'] = nil + +lsp.setup_nvim_cmp({ + mapping = cmp_mappings +}) + + +lsp.set_preferences({ + suggest_lsp_servers = false, + sign_icons = { + error = 'E', + warn = 'W', + hint = 'H', + info = 'I' + } +}) + +lsp.on_attach(function(client, bufnr) + local opts = {buffer = bufnr, remap = false} + + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) +end) + +lsp.skip_server_setup({ + 'pylsp', +}) + +lsp.setup() + +vim.diagnostic.config({ + virtual_text = true +}) + +-- rnix config + +local lspconfig = require'lspconfig' +lspconfig.nil_ls.setup{ + autostart = true, + capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()), + cmd = vim.env.NIL_LSP_PATH, + settings = { + rootMarkers = {".git/"}, + languages = { + nix = { + formatters = { + { + exe = "nixpkgs-fmt", + args = {} + } + }, + linters = { + { + exe = "nil_lsp", + args = {} + } + } + } + } + } +} diff --git a/nvim-primeagen/after/plugin/luasnip.lua b/nvim-primeagen/after/plugin/luasnip.lua new file mode 100644 index 0000000..7f6bbde --- /dev/null +++ b/nvim-primeagen/after/plugin/luasnip.lua @@ -0,0 +1,26 @@ +local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + + +local ls = require("luasnip") + +ls.filetype_extend("htmldjango", {"html"}) + +require("luasnip.loaders.from_lua").lazy_load({ paths = "~/.config/nvim/snippets" }) +require("luasnip.loaders.from_vscode").lazy_load() + +ls.config.set_config({ + history = true, + updateevents = "TextChanged, TextChangedI", --update changes as you type + enable_autosnippets = true, + ext_opts = { + [require("luasnip.util.types").choiceNode] = { + active = { + virt_text = { { ">" } }, + }, + }, + }, +}) diff --git a/nvim-primeagen/after/plugin/marksman.lua b/nvim-primeagen/after/plugin/marksman.lua new file mode 100644 index 0000000..63865ef --- /dev/null +++ b/nvim-primeagen/after/plugin/marksman.lua @@ -0,0 +1 @@ +require'lspconfig'.marksman.setup{} diff --git a/nvim-primeagen/after/plugin/neotest-python.lua b/nvim-primeagen/after/plugin/neotest-python.lua new file mode 100644 index 0000000..6505eec --- /dev/null +++ b/nvim-primeagen/after/plugin/neotest-python.lua @@ -0,0 +1,116 @@ +require("neotest").setup({ + quickfix = { + open = true, + enabled = true, + }, + status = { + enabled = true, + signs = true, -- Sign after function signature + virtual_text = false + }, + icons = { + child_indent = "│", + child_prefix = "├", + collapsed = "─", + expanded = "╮", + failed = "✘", + final_child_indent = " ", + final_child_prefix = "╰", + non_collapsible = "─", + passed = "✓", + running = "", + running_animated = { "/", "|", "\\", "-", "/", "|", "\\", "-" }, + skipped = "↓", + unknown = "" + }, + floating = { + border = "rounded", + max_height = 0.9, + max_width = 0.9, + options = {} + }, + summary = { + open = "botright vsplit | vertical resize 60" + }, + highlights = { + adapter_name = "NeotestAdapterName", + border = "NeotestBorder", + dir = "NeotestDir", + expand_marker = "NeotestExpandMarker", + failed = "NeotestFailed", + file = "NeotestFile", + focused = "NeotestFocused", + indent = "NeotestIndent", + marked = "NeotestMarked", + namespace = "NeotestNamespace", + passed = "NeotestPassed", + running = "NeotestRunning", + select_win = "NeotestWinSelect", + skipped = "NeotestSkipped", + target = "NeotestTarget", + test = "NeotestTest", + unknown = "NeotestUnknown" + }, + adapters = { + require("neotest-python")({ + -- Extra arguments for nvim-dap configuration + -- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values + dap = { justMyCode = false }, + -- Command line arguments for runner + -- Can also be a function to return dynamic values + args = {"--log-level", "DEBUG"}, + -- Runner to use. Will use pytest if available by default. + -- Can be a function to return dynamic value. + runner = "pytest", + -- Custom python path for the runner. + -- Can be a string or a list of strings. + -- Can also be a function to return dynamic value. + -- If not provided, the path will be inferred by checking for + -- virtual envs in the local directory and for Pipenev/Poetry configs + python = ".venv/bin/python", + -- Returns if a given file path is a test file. + -- NB: This function is called a lot so don't perform any heavy tasks within it. + }) + }, +}) + +require("neodev").setup({ + library = { plugins = { "neotest" }, types = true }, + ... +}) + +vim.keymap.set("n", "tn", function() + require("neotest").run.run() +end) + +vim.keymap.set("n", "tf", function() + require("neotest").run.run(vim.fn.expand("%")) +end) + +vim.keymap.set("n", "td", function() + require("neotest").run.run({strategy = "dap"}) +end) + +vim.keymap.set("n", "tr", function() + local neotest = require("neotest") + neotest.run.run() + neotest.summary.open() +end, +{ noremap = true, silent = true, nowait = true }) + +vim.keymap.set("n", "ta", function() + local neotest = require("neotest") + neotest.run.attach() +end) + +vim.keymap.set("n", "to", function() + local neotest = require("neotest") + neotest.output.open({ last_run = true, enter = true }) +end, +{ noremap = true, silent = true, nowait = true }) + +vim.keymap.set("n", "tt", function() + local neotest = require("neotest") + neotest.summary.toggle() +end, +{ noremap = true, silent = true, nowait = true }) diff --git a/nvim-primeagen/after/plugin/telescope.lua b/nvim-primeagen/after/plugin/telescope.lua new file mode 100644 index 0000000..d11622b --- /dev/null +++ b/nvim-primeagen/after/plugin/telescope.lua @@ -0,0 +1,17 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) +vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) +vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) +vim.keymap.set('n', '<leader>fh', builtin.help_tags, {}) +vim.keymap.set('n', '<leader>fs', builtin.grep_string, {}) +vim.keymap.set('n', '<leader>fc', builtin.command_history, {}) +vim.keymap.set('n', '<leader>fk', builtin.keymaps, {}) +vim.keymap.set('n', '<leader>fl', builtin.diagnostics, {}) +vim.keymap.set('n', '<leader>fo', builtin.builtin, {}) +vim.keymap.set('n', '<leader>f-', builtin.oldfiles, {}) + +vim.keymap.set('n', '<leader>ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end) + +require("telescope").load_extension("emoji") diff --git a/nvim-primeagen/after/plugin/todo-txt.lua b/nvim-primeagen/after/plugin/todo-txt.lua new file mode 100644 index 0000000..09be576 --- /dev/null +++ b/nvim-primeagen/after/plugin/todo-txt.lua @@ -0,0 +1,44 @@ +require('todotxt-nvim').setup({ + todo_file = "/home/lemon/Documents/Notes/todo/todo.txt", + capture = { + alternative_priority = { + A = "today", + B = "tomorrow", + C = "this week", + D = "next week", + E = "next month", + }, + }, + highlights = { + priorities = { + A = { + fg = "yellow", + bg = "NONE", + style = "bold", + }, + B = { + fg = "green", + bg = "NONE", + style = "bold", + }, + C = { + fg = "cyan", + bg = "NONE", + style = "bold", + }, + D = { + fg = "magenta", + bg = "NONE", + style = "bold", + }, + }, + }, + sidebar = { + width = 70, + position = "right", -- default: "right" + }, +}) + +-- Keyboard shortcuts for todotxt-nvim. +vim.keymap.set("n", "<localleader>tp", "<cmd>ToDoTxtTasksToggle<CR>") +vim.keymap.set("n", "<localleader>ta", "<cmd>ToDoTxtCapture<CR>") diff --git a/nvim-primeagen/after/plugin/treesitter.lua b/nvim-primeagen/after/plugin/treesitter.lua new file mode 100644 index 0000000..3a7c091 --- /dev/null +++ b/nvim-primeagen/after/plugin/treesitter.lua @@ -0,0 +1,23 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { "python", "bash", "javascript", "typescript", "c", "go", "css", "html", "htmldjango", "lua", "rust" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} + diff --git a/nvim-primeagen/after/plugin/trouble.lua b/nvim-primeagen/after/plugin/trouble.lua new file mode 100644 index 0000000..cf1256a --- /dev/null +++ b/nvim-primeagen/after/plugin/trouble.lua @@ -0,0 +1,3 @@ +vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>", + {silent = true, noremap = true} +) diff --git a/nvim-primeagen/after/plugin/undotree.lua b/nvim-primeagen/after/plugin/undotree.lua new file mode 100644 index 0000000..97bb7ab --- /dev/null +++ b/nvim-primeagen/after/plugin/undotree.lua @@ -0,0 +1,2 @@ +vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle) + diff --git a/nvim-primeagen/after/plugin/zenmode.lua b/nvim-primeagen/after/plugin/zenmode.lua new file mode 100644 index 0000000..753fbf8 --- /dev/null +++ b/nvim-primeagen/after/plugin/zenmode.lua @@ -0,0 +1,30 @@ + +vim.keymap.set("n", "<leader>zz", function() + require("zen-mode").setup { + window = { + width = 90, + options = { } + }, + } + require("zen-mode").toggle() + vim.wo.wrap = false + vim.wo.number = true + vim.wo.rnu = true + ColorMyPencils() +end) + + +vim.keymap.set("n", "<leader>zZ", function() + require("zen-mode").setup { + window = { + width = 80, + options = { } + }, + } + require("zen-mode").toggle() + vim.wo.wrap = false + vim.wo.number = false + vim.wo.rnu = false + vim.opt.colorcolumn = "0" + ColorMyPencils() +end) |