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/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/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/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/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/paq.lua b/dotfiles/neovim/lua/my/paq.lua index 28f3fb8..3c5c9d4 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 @@ -44,7 +45,13 @@ 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 + "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 } table.insert(base, "nvim-treesitter/nvim-treesitter") 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/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 c073242..bb85c39 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -3,7 +3,9 @@ local M = {} function M.setup() require('nvim-autopairs').setup() - -- + require "gitlinker".setup() + require('nvim_comment').setup() + vscode.unless(function() require("presence"):setup({}) require("my.plugins.dashboard").setup() @@ -14,13 +16,12 @@ 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.neogit").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/lh-brackets.lua b/dotfiles/neovim/lua/my/plugins/lh-brackets.lua deleted file mode 100644 index 778b64a..0000000 --- a/dotfiles/neovim/lua/my/plugins/lh-brackets.lua +++ /dev/null @@ -1,54 +0,0 @@ -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 -} - -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...") 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/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 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/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/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 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; }; }; };