Mon, 13 Feb 2023 02:20:08 -0600
Ongoing nvim config
--- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,2 +1,4 @@ require("config.options") require("config.lazy") +require("config.maps") +require("config.lsp")
new file mode 100644 --- /dev/null +++ b/.config/nvim/lua/config/maps.lua @@ -0,0 +1,19 @@ + +local map = vim.keymap +local opts = {noremap = true, silent = true} + +map.set("n", "<F2>", ":20Lexplore<CR>", opts) +map.set("n", "<F3>", "n", opts) +map.set("n", "<S-F3>", "N", opts) +map.set("", "<F4>", ":let v:hlsearch = !v:hlsearch<CR>", opts) +-- map.set("n", "<F5>", ":UndotreeToggle<CR>", opts) +-- map.set("n", "<F8>", ":TagbarToggle<CR>", opts) + +-- Allow :noh even in insert mode +map.set("i", "<F4>", "<C-O><F4>") + +-- cover for search habit +map.set("c", "<F3>", "<CR>") + +map.set("n", "<leader>cd", ":cd %:p:h<CR>:pwd<CR>") +
--- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -26,21 +26,25 @@ end -- Behavior o.autowriteall = true +o.backup = true +o.completeopt:append({"menuone", "noselect"}) o.ignorecase = true o.scrolloff = 15 +o.sessionoptions = {"buffers", "curdir", "localoptions"} o.sidescrolloff = 10 o.smartcase = true o.splitbelow = true o.splitright = true +o.undofile = true o.wildignorecase = true -- Paths -o.tags:append(".tags,./.tags;") +o.tags:append({".tags", "./.tags;"}) o.wildignore = "*~,*.o,*.pyc,.git/*,hg/*,.svn/*" -vim.api.nvim_create_autocmd("LspAttach", { - once = true, - callback = function(args) - vim.opt.number = true - end, -}) +if vim.fn.executable("ag") then + o.grepprg = "ag --vimgrep" + o.grepformat:prepend({"%f:%l:%c:%m", "%f"}) + o.errorformat:append("%f") +end +
--- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -35,20 +35,21 @@ return { ["<Tab>"] = cmp.mapping.select_next_item(), ["<S-Tab>"] = cmp.mapping.select_prev_item(), ["<C-g>"] = cmp.mapping.abort(), + -- FIXME: add extra space after in select case? ["<Space>"] = cmp.mapping.confirm({select = false}), ["<Right>"] = cmp.mapping.confirm({select = true}), }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "nvim_lsp_signature_help" }, - { name = "buffer" }, - { name = "path" }, - }), - experimental = { - ghost_text = { - hl_group = "LspCodeLens", - }, - }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "nvim_lsp_signature_help" }, + { name = "buffer" }, + { name = "path" }, + }), + experimental = { + ghost_text = { + hl_group = "LspCodeLens", + }, + }, } end, },