From 8594b5da115d81df1b437b01e46767747c771d11 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 24 Aug 2022 14:13:35 +0300 Subject: [PATCH 1/5] Added some more git stuff I guess --- dotfiles/neovim/lua/my/paq.lua | 6 +++- dotfiles/neovim/lua/my/plugins/init.lua | 10 ++++-- dotfiles/neovim/lua/my/plugins/lualine.lua | 36 +++++++++---------- dotfiles/neovim/lua/my/plugins/treesitter.lua | 4 ++- modules/applications/neovim.nix | 4 +-- modules/dev/kotlin.nix | 2 ++ modules/overlays/flakes.nix | 1 + modules/themes/themes.nix | 4 +-- modules/xserver.nix | 1 + 9 files changed, 41 insertions(+), 27 deletions(-) diff --git a/dotfiles/neovim/lua/my/paq.lua b/dotfiles/neovim/lua/my/paq.lua index 2bba4c7..b0479e5 100644 --- a/dotfiles/neovim/lua/my/paq.lua +++ b/dotfiles/neovim/lua/my/paq.lua @@ -44,7 +44,11 @@ function M.setup() "easymotion/vim-easymotion", -- removes the need for spamming w or e "tpope/vim-surround", -- work with brackets, quotes, tags, etc "MunifTanjim/nui.nvim", -- ui stuff required by idris2 - "ShinKage/idris2-nvim" -- idris2 support + "ShinKage/idris2-nvim", -- idris2 support + "udalov/kotlin-vim", -- kotlin support + -- Git stuff + "ruifm/gitlinker.nvim", -- generate permalinks for code + "TimUntersberger/neogit" -- magit clone } for _, v in ipairs(themePackages) do diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index c073242..d47a1a8 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -3,7 +3,10 @@ local M = {} function M.setup() require('nvim-autopairs').setup() - -- + require "gitlinker".setup() + require('neogit').setup() + + vscode.unless(function() require("presence"):setup({}) require("my.plugins.dashboard").setup() @@ -14,13 +17,14 @@ function M.setup() require("my.plugins.nvim-tree").setup() require("my.plugins.vimtex").setup() require("my.plugins.lean").setup() + require("my.plugins.lualine").setup() + require("my.plugins.vimux").setup() end) + require("my.plugins.vim-tmux-navigator").setup() - require("my.plugins.lualine").setup() require("my.plugins.comment").setup() require("my.plugins.telescope").setup() - require("my.plugins.vimux").setup() -- require("my.plugins.idris").setup() -- require("which-key").setup() diff --git a/dotfiles/neovim/lua/my/plugins/lualine.lua b/dotfiles/neovim/lua/my/plugins/lualine.lua index 2a4c140..0740bd4 100644 --- a/dotfiles/neovim/lua/my/plugins/lualine.lua +++ b/dotfiles/neovim/lua/my/plugins/lualine.lua @@ -1,24 +1,24 @@ local M = {} function M.setup() - require('lualine').setup({ - theme = vim.g.lualineTheme, - options = { - section_separators = {left = '', right = ''}, - component_separators = {left = '', right = ''} - }, - sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = {}, - -- lualine_y = {'encoding', 'fileformat', 'filetype'}, - lualine_y = {'filetype'}, - lualine_z = {'location'} - }, - -- Integration with other plugins - extensions = {"nvim-tree"} - }) + require('lualine').setup({ + theme = vim.g.lualineTheme, + options = { + section_separators = { left = '', right = '' }, + component_separators = { left = '', right = '' } + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = {}, + -- lualine_y = {'encoding', 'fileformat', 'filetype'}, + lualine_y = { 'filetype' }, + lualine_z = { 'location' } + }, + -- Integration with other plugins + extensions = { "nvim-tree" } + }) end return M diff --git a/dotfiles/neovim/lua/my/plugins/treesitter.lua b/dotfiles/neovim/lua/my/plugins/treesitter.lua index 348a7c1..6515f46 100644 --- a/dotfiles/neovim/lua/my/plugins/treesitter.lua +++ b/dotfiles/neovim/lua/my/plugins/treesitter.lua @@ -5,13 +5,15 @@ function M.setup() ensure_installed = { "bash", "javascript", "typescript", "c", "cpp", "css", "dockerfile", "elixir", "fish", "html", "json", "latex", "python", "rust", "scss", - "toml", "tsx", "vim", "yaml", "nix" + "toml", "tsx", "vim", "yaml", "nix", "kotlin" }, sync_install = false, indent = { enable = true }, highlight = { enable = true, + disable = { "kotlin" }, + -- 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. diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index ed3415b..8dbceab 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -3,8 +3,8 @@ let paq = pkgs.fetchFromGitHub { owner = "savq"; repo = "paq-nvim"; - rev = "cbbb8a550e35b1e6c9ddf7b098b25e6c2d8b1e86"; - sha256 = "0fsbww2kqwayi1azhglsjal6mwh68n03ylxxqzq17v7sar17vx4c"; + rev = "bc5950b990729464f2493b1eaab5a7721bd40bf5"; + sha256 = "0rsv3j5rxfv7ys9zvq775f63vy6w880b0xhyr164y8fcadhpypb3"; }; theme = pkgs.myThemes.current; diff --git a/modules/dev/kotlin.nix b/modules/dev/kotlin.nix index f001a3b..14e293e 100644 --- a/modules/dev/kotlin.nix +++ b/modules/dev/kotlin.nix @@ -3,6 +3,8 @@ home.packages = with pkgs; [ kotlin gradle + jdk + android-studio ]; }; } diff --git a/modules/overlays/flakes.nix b/modules/overlays/flakes.nix index 1e463c1..b2b7742 100644 --- a/modules/overlays/flakes.nix +++ b/modules/overlays/flakes.nix @@ -52,6 +52,7 @@ in }; + # Vim plugins myVimPlugins = { githubNvimTheme = foreign.githubNvimTheme; diff --git a/modules/themes/themes.nix b/modules/themes/themes.nix index 8983d47..6190af0 100644 --- a/modules/themes/themes.nix +++ b/modules/themes/themes.nix @@ -7,8 +7,8 @@ lib.lists.map (theme: pkgs.callPackage theme { }) [ (catppuccin { # wallpaper = "os/nix-magenta-pink-1920x1080.png"; # wallpaper = "minimalistic/tetris.png"; - # wallpaper = "os/nix-black-4k.png"; - wallpaper = "misc/comfy-home.png"; + wallpaper = "os/nix-black-4k.png"; + # wallpaper = "misc/comfy-home.png"; # wallpaper = "landscapes/forrest.png"; # wallpaper = "landscapes/salty_mountains.png"; # wallpaper = "misc/rainbow.png"; diff --git a/modules/xserver.nix b/modules/xserver.nix index b99bb13..8229c2d 100644 --- a/modules/xserver.nix +++ b/modules/xserver.nix @@ -56,6 +56,7 @@ in accelSpeed = "3.5"; tappingDragLock = false; + disableWhileTyping = true; }; }; }; From cc6a209d8d4d5dde416ceb253f799131ddd8eb4a Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 24 Aug 2022 14:21:21 +0300 Subject: [PATCH 2/5] Added custom keybind for neogit! --- dotfiles/neovim/lua/my/plugins/init.lua | 3 +-- dotfiles/neovim/lua/my/plugins/neogit.lua | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 dotfiles/neovim/lua/my/plugins/neogit.lua diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index d47a1a8..cd97c0f 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -4,7 +4,6 @@ local M = {} function M.setup() require('nvim-autopairs').setup() require "gitlinker".setup() - require('neogit').setup() vscode.unless(function() @@ -21,8 +20,8 @@ function M.setup() require("my.plugins.vimux").setup() end) - require("my.plugins.vim-tmux-navigator").setup() + require("my.plugins.neogit").setup() require("my.plugins.comment").setup() require("my.plugins.telescope").setup() diff --git a/dotfiles/neovim/lua/my/plugins/neogit.lua b/dotfiles/neovim/lua/my/plugins/neogit.lua new file mode 100644 index 0000000..b3c6811 --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/neogit.lua @@ -0,0 +1,11 @@ +local M = {} + +function M.setup() + local neogit = require("neogit") + + neogit.setup() + + vim.keymap.set("n", "", neogit.open) +end + +return M From 7c77d3a8ddce91ab4a84cf5d5394861bfc227f79 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 24 Aug 2022 14:29:04 +0300 Subject: [PATCH 3/5] Modified a bunch of stuff to work with the native vim.keymap.set function --- dotfiles/neovim/lua/my/keymaps.lua | 8 +-- dotfiles/neovim/lua/my/plugins/fzf-lua.lua | 20 +++---- dotfiles/neovim/lua/my/plugins/init.lua | 2 - .../neovim/lua/my/plugins/lh-brackets.lua | 59 +++++++++---------- dotfiles/neovim/lua/my/plugins/nvim-tree.lua | 8 +-- .../lua/my/plugins/vim-tmux-navigator.lua | 15 ----- 6 files changed, 45 insertions(+), 67 deletions(-) delete mode 100644 dotfiles/neovim/lua/my/plugins/vim-tmux-navigator.lua diff --git a/dotfiles/neovim/lua/my/keymaps.lua b/dotfiles/neovim/lua/my/keymaps.lua index bdf671b..e73518b 100644 --- a/dotfiles/neovim/lua/my/keymaps.lua +++ b/dotfiles/neovim/lua/my/keymaps.lua @@ -3,11 +3,11 @@ local arpeggio = require("my.plugins.arpeggio") local M = {} -function M.map(mode, lhs, rhs, opts) +local function map(mode, lhs, rhs, opts) if string.len(mode) > 1 then for i = 1, #mode do local c = mode:sub(i, i) - M.map(c, lhs, rhs, opts) + map(c, lhs, rhs, opts) end else local options = helpers.mergeTables(opts, { noremap = true }) @@ -17,11 +17,11 @@ end function M.mapSilent(mode, lhs, rhs, opts) local options = helpers.mergeTables(opts, { silent = true }) - M.map(mode, lhs, rhs, options) + map(mode, lhs, rhs, options) end function M.setup() - M.map("n", "qq", ":wq") -- Save and quit + vim.keymap.set("n", "qq", ":wq") -- Save and quit -- Create chords if arpeggio ~= nil then diff --git a/dotfiles/neovim/lua/my/plugins/fzf-lua.lua b/dotfiles/neovim/lua/my/plugins/fzf-lua.lua index 837e251..2248a0b 100644 --- a/dotfiles/neovim/lua/my/plugins/fzf-lua.lua +++ b/dotfiles/neovim/lua/my/plugins/fzf-lua.lua @@ -1,20 +1,18 @@ -local mapSilent = require("my.keymaps").mapSilent - local M = {} local bindings = { - -- Open files with control + P - files = "", - -- See diagnostics with space + d - lsp_document_diagnostics = "d", - lsp_workspace_diagnostics = "D" + -- Open files with control + P + files = "", + -- See diagnostics with space + d + lsp_document_diagnostics = "d", + lsp_workspace_diagnostics = "D" } function M.setup() - for action, keybind in pairs(bindings) do - -- Maps the keybind to the action - mapSilent('n', keybind, "lua require('fzf-lua')." .. action .. "()") - end + for action, keybind in pairs(bindings) do + -- Maps the keybind to the action + vim.keymap.set('n', keybind, require('fzf-lua')[action]) + end end return M diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index cd97c0f..d84c2aa 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -5,7 +5,6 @@ function M.setup() require('nvim-autopairs').setup() require "gitlinker".setup() - vscode.unless(function() require("presence"):setup({}) require("my.plugins.dashboard").setup() @@ -20,7 +19,6 @@ function M.setup() require("my.plugins.vimux").setup() end) - require("my.plugins.vim-tmux-navigator").setup() require("my.plugins.neogit").setup() require("my.plugins.comment").setup() require("my.plugins.telescope").setup() diff --git a/dotfiles/neovim/lua/my/plugins/lh-brackets.lua b/dotfiles/neovim/lua/my/plugins/lh-brackets.lua index 778b64a..f54977d 100644 --- a/dotfiles/neovim/lua/my/plugins/lh-brackets.lua +++ b/dotfiles/neovim/lua/my/plugins/lh-brackets.lua @@ -1,54 +1,53 @@ local A = require("my.helpers.augroup") -local map = require("my.keymaps").mapSilent local arpeggio = require("my.plugins.arpeggio") local M = {} local extraBrackets = { - lean = {{"⟨", "⟩"}}, -- lean - all = { - -- {"(", ")"}, {"[", "]"}, {"'", "'"}, {'"', '"'}, {"{", "}"}, {"`", "`"} - } -- more general stuff + lean = { { "⟨", "⟩" } }, -- lean + all = { + -- {"(", ")"}, {"[", "]"}, {"'", "'"}, {'"', '"'}, {"{", "}"}, {"`", "`"} + } -- more general stuff } function M.createBracketCommand(lhs, rhs, isGlobal, opts) - local suffix = "" - if isGlobal then suffix = "!" end + local suffix = "" + if isGlobal then suffix = "!" end - return ":Brackets" .. suffix .. " " .. lhs .. " " .. rhs .. " " .. - (opts or "") + return ":Brackets" .. suffix .. " " .. lhs .. " " .. rhs .. " " .. + (opts or "") end function M.createBracket(lhs, rhs, isGlobal, opts) - vim.cmd(M.createBracketCommand(lhs, rhs, isGlobal, opts)) + vim.cmd(M.createBracketCommand(lhs, rhs, isGlobal, opts)) end function M.setup() - if arpeggio == nil then return end + if arpeggio == nil then return end - vim.g.marker_define_jump_mappings = 0 -- disable automatic binding of marker jumping (conflicts with tmux-vim-navigator) + vim.g.marker_define_jump_mappings = 0 -- disable automatic binding of marker jumping (conflicts with tmux-vim-navigator) - arpeggio.chord("nv", "sj", 'MarkersJumpF') - arpeggio.chord("nv", "sk", 'MarkersJumpB') - arpeggio.chord("nv", "mi", 'MarkersMark') - arpeggio.chord("nv", "ml", 'MarkersCloseAllAndJumpToLast') - arpeggio.chord("nv", "mo", 'MarkersJumpOutside') + arpeggio.chord("nv", "sj", 'MarkersJumpF') + arpeggio.chord("nv", "sk", 'MarkersJumpB') + arpeggio.chord("nv", "mi", 'MarkersMark') + arpeggio.chord("nv", "ml", 'MarkersCloseAllAndJumpToLast') + arpeggio.chord("nv", "mo", 'MarkersJumpOutside') - for key, brackets in pairs(extraBrackets) do - A.augroup('custom-brackets' .. key, function() - for _, v in ipairs(brackets) do - local action = M.createBracketCommand(v[1], v[2], 0, v[3] or "") - local glob = '*.' .. key + for key, brackets in pairs(extraBrackets) do + A.augroup('custom-brackets' .. key, function() + for _, v in ipairs(brackets) do + local action = M.createBracketCommand(v[1], v[2], 0, v[3] or "") + local glob = '*.' .. key - if key == "all" then - -- The all key just matches everything - glob = "*" - end + if key == "all" then + -- The all key just matches everything + glob = "*" + end - A.autocmd('BufEnter', glob, action) - end - end) - end + A.autocmd('BufEnter', glob, action) + end + end) + end end return M diff --git a/dotfiles/neovim/lua/my/plugins/nvim-tree.lua b/dotfiles/neovim/lua/my/plugins/nvim-tree.lua index 63e5c05..92e415f 100644 --- a/dotfiles/neovim/lua/my/plugins/nvim-tree.lua +++ b/dotfiles/neovim/lua/my/plugins/nvim-tree.lua @@ -1,11 +1,9 @@ -local mapSilent = require("my.keymaps").mapSilent - local M = {} function M.setup() - require'nvim-tree'.setup() - -- Toggle nerdtree with Control-t - mapSilent("n", "", ":NvimTreeToggle") + require 'nvim-tree'.setup() + -- Toggle nerdtree with Control-n + vim.keymap.set("n", "", ":NvimTreeToggle") end return M diff --git a/dotfiles/neovim/lua/my/plugins/vim-tmux-navigator.lua b/dotfiles/neovim/lua/my/plugins/vim-tmux-navigator.lua deleted file mode 100644 index ab8b77b..0000000 --- a/dotfiles/neovim/lua/my/plugins/vim-tmux-navigator.lua +++ /dev/null @@ -1,15 +0,0 @@ -local map = require("my.keymaps").map - -local M = {} - --- For some reason the default mappings do not work for me -function M.setup() - vim.g.tmux_navigator_no_mappings = 1 - - map("n", "", ":TmuxNavigateLeft") - map("n", "", ":TmuxNavigateDown") - map("n", "", ":TmuxNavigateUp") - map("n", "", ":TmuxNavigateRight") -end - -return M From c610d1ce1af107ae302b992f3d24f5e083ed5c78 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 24 Aug 2022 14:54:19 +0300 Subject: [PATCH 4/5] Removed the need for my own augroup helper --- dotfiles/neovim/ftplugin/hkf.lua | 1 + dotfiles/neovim/lua/my/helpers/augroup.lua | 14 ----- .../lua/my/helpers/update-nix-fetchgit.lua | 6 +-- dotfiles/neovim/lua/my/options/folding.lua | 10 +--- dotfiles/neovim/lua/my/plugins/comment.lua | 26 --------- dotfiles/neovim/lua/my/plugins/init.lua | 2 +- .../neovim/lua/my/plugins/lh-brackets.lua | 53 ------------------- dotfiles/neovim/lua/my/plugins/lspconfig.lua | 13 +++-- 8 files changed, 12 insertions(+), 113 deletions(-) delete mode 100644 dotfiles/neovim/lua/my/helpers/augroup.lua delete mode 100644 dotfiles/neovim/lua/my/plugins/comment.lua delete mode 100644 dotfiles/neovim/lua/my/plugins/lh-brackets.lua diff --git a/dotfiles/neovim/ftplugin/hkf.lua b/dotfiles/neovim/ftplugin/hkf.lua index d1f855d..009ffd2 100644 --- a/dotfiles/neovim/ftplugin/hkf.lua +++ b/dotfiles/neovim/ftplugin/hkf.lua @@ -1 +1,2 @@ vim.cmd("syntax hkf") +vim.api.nvim_buf_set_option(0, "commentstring", "-- %s") diff --git a/dotfiles/neovim/lua/my/helpers/augroup.lua b/dotfiles/neovim/lua/my/helpers/augroup.lua deleted file mode 100644 index 12a6372..0000000 --- a/dotfiles/neovim/lua/my/helpers/augroup.lua +++ /dev/null @@ -1,14 +0,0 @@ -local M = {} - -function M.augroup(name, inside) - vim.cmd('augroup ' .. name) - vim.cmd('autocmd!') - inside() - vim.cmd('augroup END') -end - -function M.autocmd(event, glob, action) - vim.cmd('autocmd ' .. event .. ' ' .. glob .. ' ' .. action) -end - -return M diff --git a/dotfiles/neovim/lua/my/helpers/update-nix-fetchgit.lua b/dotfiles/neovim/lua/my/helpers/update-nix-fetchgit.lua index f49b62a..7ce4505 100644 --- a/dotfiles/neovim/lua/my/helpers/update-nix-fetchgit.lua +++ b/dotfiles/neovim/lua/my/helpers/update-nix-fetchgit.lua @@ -1,9 +1,9 @@ local M = {} function M.update() - require("my.helpers").saveCursor(function() - vim.cmd(":%!update-nix-fetchgit") - end) + require("my.helpers").saveCursor(function() + vim.cmd(":%!update-nix-fetchgit") + end) end return M diff --git a/dotfiles/neovim/lua/my/options/folding.lua b/dotfiles/neovim/lua/my/options/folding.lua index 0d0fe48..e3b3266 100644 --- a/dotfiles/neovim/lua/my/options/folding.lua +++ b/dotfiles/neovim/lua/my/options/folding.lua @@ -1,15 +1,7 @@ local M = {} function M.setup() - vim.o.foldmethod = "marker" - - -- vim.cmd([[ - -- augroup remember_folds - -- autocmd! - -- autocmd BufWinLeave *.* if &ft !=# 'help' | mkview | endif - -- autocmd BufWinEnter *.* if &ft !=# 'help' | silent! loadview | endif - -- augroup END - -- ]]) + vim.o.foldmethod = "marker" end return M diff --git a/dotfiles/neovim/lua/my/plugins/comment.lua b/dotfiles/neovim/lua/my/plugins/comment.lua deleted file mode 100644 index 229d835..0000000 --- a/dotfiles/neovim/lua/my/plugins/comment.lua +++ /dev/null @@ -1,26 +0,0 @@ -local A = require("my.helpers.augroup") -local M = {} - -local extraCommentStrings = { lean = "/- %s -/", bkf = "-- %s" } - --- Update comments for certain languages -function M.setCommentString(extension, commentString) - A.augroup('set-commentstring-' .. extension, function() - local action = - ':lua vim.api.nvim_buf_set_option(0, "commentstring", "' .. - commentString .. '")' - - A.autocmd('BufEnter', '*.' .. extension, action) - A.autocmd('BufFilePost', '*.' .. extension, action) - end) -end - -function M.setup() - require('nvim_comment').setup() - - for lang, commentString in pairs(extraCommentStrings) do - M.setCommentString(lang, commentString) - end -end - -return M diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index d84c2aa..bb85c39 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -4,6 +4,7 @@ local M = {} function M.setup() require('nvim-autopairs').setup() require "gitlinker".setup() + require('nvim_comment').setup() vscode.unless(function() require("presence"):setup({}) @@ -20,7 +21,6 @@ function M.setup() end) require("my.plugins.neogit").setup() - require("my.plugins.comment").setup() require("my.plugins.telescope").setup() -- require("my.plugins.idris").setup() diff --git a/dotfiles/neovim/lua/my/plugins/lh-brackets.lua b/dotfiles/neovim/lua/my/plugins/lh-brackets.lua deleted file mode 100644 index f54977d..0000000 --- a/dotfiles/neovim/lua/my/plugins/lh-brackets.lua +++ /dev/null @@ -1,53 +0,0 @@ -local A = require("my.helpers.augroup") -local arpeggio = require("my.plugins.arpeggio") -local M = {} - -local extraBrackets = { - lean = { { "⟨", "⟩" } }, -- lean - all = { - -- {"(", ")"}, {"[", "]"}, {"'", "'"}, {'"', '"'}, {"{", "}"}, {"`", "`"} - } -- more general stuff -} - -function M.createBracketCommand(lhs, rhs, isGlobal, opts) - local suffix = "" - if isGlobal then suffix = "!" end - - return ":Brackets" .. suffix .. " " .. lhs .. " " .. rhs .. " " .. - (opts or "") -end - -function M.createBracket(lhs, rhs, isGlobal, opts) - vim.cmd(M.createBracketCommand(lhs, rhs, isGlobal, opts)) -end - -function M.setup() - - if arpeggio == nil then return end - - vim.g.marker_define_jump_mappings = 0 -- disable automatic binding of marker jumping (conflicts with tmux-vim-navigator) - - arpeggio.chord("nv", "sj", 'MarkersJumpF') - arpeggio.chord("nv", "sk", 'MarkersJumpB') - arpeggio.chord("nv", "mi", 'MarkersMark') - arpeggio.chord("nv", "ml", 'MarkersCloseAllAndJumpToLast') - arpeggio.chord("nv", "mo", 'MarkersJumpOutside') - - for key, brackets in pairs(extraBrackets) do - A.augroup('custom-brackets' .. key, function() - for _, v in ipairs(brackets) do - local action = M.createBracketCommand(v[1], v[2], 0, v[3] or "") - local glob = '*.' .. key - - if key == "all" then - -- The all key just matches everything - glob = "*" - end - - A.autocmd('BufEnter', glob, action) - end - end) - end -end - -return M diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua index 72b4f06..e721fbb 100644 --- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua +++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua @@ -1,7 +1,6 @@ local M = {} local function map(buf, mode, lhs, rhs, opts) - local options = { noremap = true, silent = true } if opts then options = vim.tbl_extend('force', options, opts) end vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options) @@ -11,14 +10,14 @@ function M.on_attach(client, bufnr) -- Enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + if client.server_capabilities.documentFormattingProvider then print("Initializing formatter...") - vim.cmd([[ - augroup LspFormatting - autocmd! * - autocmd BufWritePre lua vim.lsp.buf.formatting_sync() - augroup END - ]]) + + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("LspFormatting", {}), + callback = vim.lsp.buf.formatting_sync + }) end print("Setting up keybinds...") From 3814de3b01587855eccb4c9b749f350ac781861e Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 24 Aug 2022 15:58:06 +0300 Subject: [PATCH 5/5] Fixed nix.lua erroring out --- dotfiles/neovim/ftplugin/nix.lua | 3 +-- dotfiles/neovim/lua/my/paq.lua | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dotfiles/neovim/ftplugin/nix.lua b/dotfiles/neovim/ftplugin/nix.lua index 5b3a950..5dba7d9 100644 --- a/dotfiles/neovim/ftplugin/nix.lua +++ b/dotfiles/neovim/ftplugin/nix.lua @@ -1,5 +1,4 @@ local A = require("my.plugins.arpeggio") -local C = require("my.plugins.comment") print("Initializing nix keybinds...") @@ -9,4 +8,4 @@ A.chordSilent("n", "ug", { settings = "b" }) -- Idk why this isn't here by default -C.setCommentString("nix", "# %s") +vim.api.nvim_buf_set_option(0, "commentstring", "# %s") diff --git a/dotfiles/neovim/lua/my/paq.lua b/dotfiles/neovim/lua/my/paq.lua index b0479e5..33515a4 100644 --- a/dotfiles/neovim/lua/my/paq.lua +++ b/dotfiles/neovim/lua/my/paq.lua @@ -3,7 +3,8 @@ local M = {} function M.setup() local paq = require("paq") local themePackages = require("my.theme").deps - local base = { "neovim/nvim-lspconfig", -- configures lsps for me + local base = { + "neovim/nvim-lspconfig", -- configures lsps for me "windwp/nvim-autopairs", -- closes pairs for me (should look for a better one) "nvim-lua/plenary.nvim", -- async utility lib it seems? "nvim-telescope/telescope.nvim", -- fuzzy search for say opening files @@ -46,6 +47,8 @@ function M.setup() "MunifTanjim/nui.nvim", -- ui stuff required by idris2 "ShinKage/idris2-nvim", -- idris2 support "udalov/kotlin-vim", -- kotlin support + "haringsrob/nvim_context_vt", -- show context on closing parenthesis + "vuki656/package-info.nvim", -- shows latest versions in package.json -- Git stuff "ruifm/gitlinker.nvim", -- generate permalinks for code "TimUntersberger/neogit" -- magit clone