diff options
| author | Mike Vink <59492084+ivi-vink@users.noreply.github.com> | 2024-10-25 13:53:56 +0000 |
|---|---|---|
| committer | Mike Vink <59492084+ivi-vink@users.noreply.github.com> | 2024-10-25 13:53:56 +0000 |
| commit | a137fb0f1b16287f73100212f0f1980523fcac18 (patch) | |
| tree | 8032bfbcaff2300f66af28571e8c6a05bb73a1a9 | |
| parent | 2f44ef79c5dd1548c45971aed1dce10104208c02 (diff) | |
fix cmp
| -rw-r--r-- | flake.lock | 36 | ||||
| -rw-r--r-- | mut/neovim/lua/my/init.lua | 145 | ||||
| -rw-r--r-- | mut/neovim/lua/my/packages/cmp.lua | 9 | ||||
| -rw-r--r-- | mut/neovim/lua/my/packages/luasnip.lua | 4 | ||||
| -rw-r--r-- | overlays/vimPlugins.nix | 5 | ||||
| -rw-r--r-- | profiles/core/neovim.nix | 1 |
6 files changed, 104 insertions, 96 deletions
@@ -164,11 +164,11 @@ ] }, "locked": { - "lastModified": 1719994518, - "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", "type": "github" }, "original": { @@ -227,11 +227,11 @@ ] }, "locked": { - "lastModified": 1720524665, - "narHash": "sha256-ni/87oHPZm6Gv0ECYxr1f6uxB0UKBWJ6HvS7lwLU6oY=", + "lastModified": 1729104314, + "narHash": "sha256-pZRZsq5oCdJt3upZIU4aslS9XwFJ+/nVtALHIciX/BI=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "8d6a17d0cdf411c55f12602624df6368ad86fac1", + "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", "type": "github" }, "original": { @@ -271,11 +271,11 @@ ] }, "locked": { - "lastModified": 1719226092, - "narHash": "sha256-YNkUMcCUCpnULp40g+svYsaH1RbSEj6s4WdZY/SHe38=", + "lastModified": 1724947644, + "narHash": "sha256-MHHrHasTngp7EYQOObHJ1a/IsRF+wodHqOckhH6uZbk=", "owner": "hercules-ci", "repo": "hercules-ci-effects", - "rev": "11e4b8dc112e2f485d7c97e1cee77f9958f498f5", + "rev": "dba4367b9a9d9615456c430a6d6af716f6e84cef", "type": "github" }, "original": { @@ -314,11 +314,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1720861673, - "narHash": "sha256-gh34LtCLvXCd/Xyk33mgQU3QqNyJ7ZwJj59c4Qdad78=", + "lastModified": 1729147490, + "narHash": "sha256-F0/iQVbbIFctMPwK4JEd4fxVzNwaq7NnD5oen59S24s=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "34b8101a10dfb4cb38832a17ef33281d59e2b2b3", + "rev": "e2047498667aeb24e8493ff430a20cff713915f4", "type": "github" }, "original": { @@ -330,11 +330,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1720816717, - "narHash": "sha256-C8bdG2wrI29afHI1705W37M7CPudz5117YafiBlW0Y4=", + "lastModified": 1729121305, + "narHash": "sha256-c94xkA/RuszC4PfmB+MWqOo2vbO66GTO6XKer0mbltA=", "owner": "neovim", "repo": "neovim", - "rev": "10256bb760fcab0dc25f7eb5b0b45966cb771939", + "rev": "852954ff6d96adce0158f74ca494fdcef3aa1921", "type": "github" }, "original": { @@ -410,11 +410,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1720750130, - "narHash": "sha256-y2wc7CdK0vVSIbx7MdVoZzuMcUoLvZXm+pQf2RIr1OU=", + "lastModified": 1728863046, + "narHash": "sha256-DZBO2465PL5V89e8hFSJewyH4QbCPpW3ssws7ckT/0A=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6794d064edc69918bb0fc0e0eda33ece324be17a", + "rev": "d4f247e89f6e10120f911e2e2d2254a050d0f732", "type": "github" }, "original": { diff --git a/mut/neovim/lua/my/init.lua b/mut/neovim/lua/my/init.lua index 27476c3..9efb4c8 100644 --- a/mut/neovim/lua/my/init.lua +++ b/mut/neovim/lua/my/init.lua @@ -1,13 +1,11 @@ +require("my.settings") _G.P = function(...) vim.iter({...}):map(vim.inspect):each(print) end _G.ternary = function ( cond , T , F ) if cond then return T else return F end end - -vim.schedule(function() - vim.cmd "colorscheme kanagawa-wave" -end) +vim.cmd "colorscheme kanagawa-wave" vim.cmd("filetype plugin on") vim.cmd("filetype indent on") @@ -19,70 +17,7 @@ vim.api.nvim_set_hl(0, "VirtualTextError", {link= "DiffDelete"}) vim.api.nvim_set_hl(0, "VirtualTextInfo", {link= "DiffChange"}) vim.api.nvim_set_hl(0, "VirtualTextHint", {link= "DiffAdd"}) -vim.opt.clipboard:append({"unnamedplus"}) - -local osc52 = require("vim.ui.clipboard.osc52") - -function paste() - return { - vim.fn.split(vim.fn.getreg(""), "\n"), - vim.fn.getregtype("") - } -end -function xclip(lines) - vim.system({"xclip"}, {text= true, stdin=lines}, function(exit) end) - vim.system({"xclip", "-selection", "clipboard"}, {text= true, stdin=lines}, function(exit) end) -end -vim.g.clipboard = { - name = "OSC 52", - copy = { - ["+"] = xclip, ["*"] = xclip - }, - paste = { - ["+"] = paste, ["*"] = paste - } -} - -local oil = require("oil.actions") -local fzf = require("fzf-lua") -local action = (require "fzf-lua.actions") -fzf.setup {"max-perf"} -fzf.register_ui_select() -require("lsp_signature").setup() -require("nvim-treesitter.configs").setup({highlight = {enable = true}}) -require("gitsigns").setup({ - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'right_align', -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - virt_text_priority = 100, - use_focus = true, - }, -}) -require("nvim_comment").setup() - --- (local --- draw --- (fn [toggle] --- (if --- toggle --- (do --- (vim.cmd "set virtualedit=all") --- (vim.keymap.set :v "<leader>;" "<esc>:VBox<CR>") --- (vim.keymap.set "n" "J" "<C-v>j:VBox<CR>") --- (vim.keymap.set "n" "K" "<C-v>k:VBox<CR>") --- (vim.keymap.set "n" "L" "<C-v>l:VBox<CR>") --- (vim.keymap.set "n" "H" "<C-v>h:VBox<CR>")) --- (do --- (vim.cmd "set virtualedit=") --- (vim.keymap.del :v "<leader>;") --- (vim.keymap.del "n" "J") --- (vim.keymap.del "n" "K") --- (vim.keymap.del "n" "L") --- (vim.keymap.del "n" "H"))))) - +local map = vim.keymap.set function i_grep(word, file) vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( @@ -100,14 +35,11 @@ function cope() vim.cmd(":botright copen " .. math.floor(vim.o.lines / 2.1)) end -local map = vim.keymap.set map("n", "gb", ":GBrowse<CR>") map("n", "g<cr>", ":G<cr>") map("n", "ge", function() vim.diagnostic.open_float() end) -- (vim.diagnostic.config {:virtual_text false}) map("n", "-", ":Oil<cr>") -map("n", "_", oil.open_cwd.callback) - map("n", "<leader>qf", cope) map("n", "<leader>q<BS>", ":cclose<cr>") map("n", "<leader>ll", ":lopen<cr>") @@ -151,12 +83,23 @@ map("n", "]x",":lnext<cr>") map("n", "[g",":GV<cr>") map("n", "]g",":GV?<cr>") map("n", "]G",":GV!<cr>") -map("n", "<leader>xp", fzf.files) map("n", "<leader>:", function() i_grep("<c-r><c-w>", vim.fn.bufname("%")) end) map("v", "<leader>:", ":Vgrep!<cr>") map("n", "<leader>;", function() i_grep("", vim.fn.fnamemodify(vim.fn.bufname("%"), ":h")) end) map("v", "<leader>;", ":Vgrep<cr>") map("n", "<leader>'", ":silent args `fd `<left>") +map("n", "<leader>x<cr>", function() vim.cmd "b #" end) + +require("nvim_comment").setup() + +local oil_actions = require("oil.actions") +map("n", "_", oil_actions.open_cwd.callback) + +local fzf = require("fzf-lua") +local action = (require "fzf-lua.actions") +fzf.setup {"max-perf"} +fzf.register_ui_select() +map("n", "<leader>xp", fzf.files) map("n", "<leader>xa", fzf.args) map("n", "<leader>x;", fzf.quickfix) map("n", "<leader>xb", function() @@ -164,7 +107,6 @@ map("n", "<leader>xb", function() actions={default={fn=action.buf_edit_or_qf}} }) end) -map("n", "<leader>x<cr>", function() vim.cmd "b #" end) local obsidian = require("obsidian") obsidian.setup { workspaces = { @@ -390,7 +332,62 @@ vim.api.nvim_create_user_command( -- (set vim.g.fugitive_browse_handlers -- [browse_git_remote]) -require("my.settings") +-- require("lsp_signature").setup() +require("nvim-treesitter.configs").setup({highlight = {enable = true}}) +require("gitsigns").setup({ + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'right_align', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + virt_text_priority = 100, + use_focus = true, + }, +}) + +vim.opt.clipboard:append({"unnamedplus"}) + +local osc52 = require("vim.ui.clipboard.osc52") + +function paste() + return { + vim.fn.split(vim.fn.getreg(""), "\n"), + vim.fn.getregtype("") + } +end +function xclip(lines) + vim.system({"xclip"}, {text= true, stdin=lines}, function(exit) end) + vim.system({"xclip", "-selection", "clipboard"}, {text= true, stdin=lines}, function(exit) end) +end +vim.g.clipboard = { + name = "OSC 52", + copy = { + ["+"] = xclip, ["*"] = xclip + }, + paste = { + ["+"] = paste, ["*"] = paste + } +} require("my.events") require("my.packages") +-- (local +-- draw +-- (fn [toggle] +-- (if +-- toggle +-- (do +-- (vim.cmd "set virtualedit=all") +-- (vim.keymap.set :v "<leader>;" "<esc>:VBox<CR>") +-- (vim.keymap.set "n" "J" "<C-v>j:VBox<CR>") +-- (vim.keymap.set "n" "K" "<C-v>k:VBox<CR>") +-- (vim.keymap.set "n" "L" "<C-v>l:VBox<CR>") +-- (vim.keymap.set "n" "H" "<C-v>h:VBox<CR>")) +-- (do +-- (vim.cmd "set virtualedit=") +-- (vim.keymap.del :v "<leader>;") +-- (vim.keymap.del "n" "J") +-- (vim.keymap.del "n" "K") +-- (vim.keymap.del "n" "L") +-- (vim.keymap.del "n" "H"))))) diff --git a/mut/neovim/lua/my/packages/cmp.lua b/mut/neovim/lua/my/packages/cmp.lua index 6a22d73..0c63170 100644 --- a/mut/neovim/lua/my/packages/cmp.lua +++ b/mut/neovim/lua/my/packages/cmp.lua @@ -19,8 +19,13 @@ function has_words_before() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local word = unpack(vim.api.nvim_buf_get_lines(0, line-1, line, true)) local before = word:sub(col, col) - local is_string = before:match("%s") - return (not (col == 0)) and is_string + local is_whitespace = before:match("%s") + + local is_not_first_col = (not (col == 0)) + local is_not_whitespace = (is_whitespace == nil) + local result = is_not_first_col and is_not_whitespace + P("has_words_before: " .. tostring(result) .. ", because is_not_first_col and is_not_whitespace: " .. tostring(is_not_first_col) .. " and " .. tostring(is_not_whitespace) .. ", is_whitespace: '" .. tostring(is_whitespace) .. "'") + return result end function in_edit_mode(line) diff --git a/mut/neovim/lua/my/packages/luasnip.lua b/mut/neovim/lua/my/packages/luasnip.lua index eb2f0c6..0362d94 100644 --- a/mut/neovim/lua/my/packages/luasnip.lua +++ b/mut/neovim/lua/my/packages/luasnip.lua @@ -27,7 +27,7 @@ local ms = ls.multi_snippet local k = require("luasnip.nodes.key_indexer").new_key vim.keymap.set( { "i", }, "<C-K>", ls.expand, {silent= true}) -vim.keymap.set( { "i", "s" }, "<C-L>", function() ls.expand_or_jump(1) end, {silent= true}) +vim.keymap.set( { "i", "s" }, "<C-L>", function() if ls.expand_or_jumpable() then ls.expand_or_jump(1) end end, {silent=true}) vim.keymap.set( { "i", "s" }, "<C-J>", function() ls.jump(-1) end, {silent=true}) vim.keymap.set( { "i", "s" }, "<C-E>", function() if ls.choice_active() then @@ -37,5 +37,5 @@ end, {silent=true}) ls.add_snippets( "go", { - s("echo", { t("fmt.Printf("), i(1), t(")"), i(2) }) + s("echo", { t("fmt.Println("), i(1), t(")"), i(2) }) }) diff --git a/overlays/vimPlugins.nix b/overlays/vimPlugins.nix index 9011556..8885e9b 100644 --- a/overlays/vimPlugins.nix +++ b/overlays/vimPlugins.nix @@ -18,6 +18,11 @@ in prev.vimPlugins // { + avante-nvim = getVimPlugin { + name = "avante-nvim"; + git = "yetone/avante.nvim"; + rev = "a8e2b9a00c73b11d28857f0f5de79a9022281182"; + }; nvim-cinnamon = getVimPlugin { name = "vim-easygrep"; git = "declancm/cinnamon.nvim"; diff --git a/profiles/core/neovim.nix b/profiles/core/neovim.nix index 9e32c93..894d11c 100644 --- a/profiles/core/neovim.nix +++ b/profiles/core/neovim.nix @@ -45,6 +45,7 @@ plugins = with pkgs.vimPlugins; [ # highlighting nvim-treesitter.withAllGrammars + avante-nvim playground gruvbox-material kanagawa-nvim |
