summaryrefslogtreecommitdiff
path: root/pkgs/custom-neovim
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/custom-neovim')
-rw-r--r--pkgs/custom-neovim/config/init.lua9
-rw-r--r--pkgs/custom-neovim/config/lua/autocommands.lua30
-rw-r--r--pkgs/custom-neovim/config/lua/colorscheme.lua5
-rw-r--r--pkgs/custom-neovim/config/lua/mappings.lua42
-rw-r--r--pkgs/custom-neovim/config/lua/neovide.lua5
-rw-r--r--pkgs/custom-neovim/config/lua/options.lua3
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/lspconfig.lua40
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/lualine.lua2
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/mini/clue.lua9
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/snacks.lua6
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/tabby.lua2
-rw-r--r--pkgs/custom-neovim/config/lua/utilities.lua37
-rw-r--r--pkgs/custom-neovim/default.nix11
-rw-r--r--pkgs/custom-neovim/flake.nix1
14 files changed, 103 insertions, 99 deletions
diff --git a/pkgs/custom-neovim/config/init.lua b/pkgs/custom-neovim/config/init.lua
index 6bca6e5..b30173b 100644
--- a/pkgs/custom-neovim/config/init.lua
+++ b/pkgs/custom-neovim/config/init.lua
@@ -7,23 +7,22 @@ require("options")
require("autocommands")
require("colorscheme")
require("neovide")
+require("mappings")
-- Require plugin configs.
-- UI Plugins:
require("plugins.lualine")
require("plugins.tabby")
-require("plugins.which-key")
require("plugins.snacks")
--- require("plugins.alpha")
require("plugins.mini.clue")
require("plugins.mini.indentscope")
require("plugins.mini.notify")
+require("plugins.treesitter")
-- LSP Plugins:
require("plugins.lspconfig")
+require("plugins.actions-preview")
-- Misc Plugins:
require("plugins.presence")
-
--- Require mappings last.
-require("mappings")
+require("hardtime").setup()
diff --git a/pkgs/custom-neovim/config/lua/autocommands.lua b/pkgs/custom-neovim/config/lua/autocommands.lua
index 48a976e..5780482 100644
--- a/pkgs/custom-neovim/config/lua/autocommands.lua
+++ b/pkgs/custom-neovim/config/lua/autocommands.lua
@@ -1,34 +1,6 @@
-- Autocommands
--- Use relative line number in normal mode and absolute in insert mode
--- vim.opt.number = true
--- local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", {})
--- vim.api.nvim_create_autocmd(
--- { "BufEnter", "FocusGained", "InsertLeave", "WinEnter", "CmdlineLeave" },
--- {
--- group = numbertoggle,
--- callback = function()
--- if vim.opt.number and vim.api.nvim_get_mode() ~= "i" then
--- vim.opt.relativenumber = true
--- end
--- end,
--- }
--- )
-
--- vim.api.nvim_create_autocmd(
--- { "BufLeave", "FocusLost", "InsertEnter", "WinLeave", "CmdlineEnter" },
--- {
--- group = numbertoggle,
--- callback = function()
--- if vim.opt.number then
--- vim.opt.relativenumber = false
--- vim.cmd("redraw")
--- end
--- end,
--- }
--- )
-
- -- start terminal in insert mode
+-- start terminal in insert mode
vim.api.nvim_create_autocmd("TermOpen", {
callback = function()
vim.cmd "startinsert!"
diff --git a/pkgs/custom-neovim/config/lua/colorscheme.lua b/pkgs/custom-neovim/config/lua/colorscheme.lua
index 03f0ad3..d15039c 100644
--- a/pkgs/custom-neovim/config/lua/colorscheme.lua
+++ b/pkgs/custom-neovim/config/lua/colorscheme.lua
@@ -1,9 +1,12 @@
-- Set colorscheme.
-vim.cmd.colorscheme("oxocarbon")
+vim.cmd.colorscheme("carbonfox")
-- Set boolean to use patches.
local correct_borderless_windows = true
+-- Enable good colors.
+vim.o.termguicolors = true
+
-- Patches.
local link_highlight = function(first_highlight, second_highlight)
vim.cmd.highlight {bang = true, "link", first_highlight, second_highlight}
diff --git a/pkgs/custom-neovim/config/lua/mappings.lua b/pkgs/custom-neovim/config/lua/mappings.lua
index dcad4b2..39f2bd3 100644
--- a/pkgs/custom-neovim/config/lua/mappings.lua
+++ b/pkgs/custom-neovim/config/lua/mappings.lua
@@ -1,21 +1,22 @@
-- Keymap function.
-local mapkey = utils.mapkey
+local mapkey = Utils.mapkey
-- Map the leader key.
vim.g.mapleader = ' '
-- Pickers
-mapkey("n", "<leader>f", "Open file picker", Snacks.picker.files)
-mapkey("n", "<leader>c", "Open recent file picker", Snacks.picker.recent)
-mapkey("n", "<leader>e", "Open file explorer", Snacks.picker.explorer)
-mapkey("n", "<leader>b", "Open buffer picker", Snacks.picker.buffers)
-mapkey("n", "<leader>B", "Open buffer live grep picker", Snacks.picker.grep_buffers)
-mapkey("n", "<leader>y", "Open clipboard history picker", Snacks.picker.cliphist)
-mapkey("n", "<leader>/", "Open live grep picker", Snacks.picker.grep)
-mapkey("n", "<leader>\\", "Open command palette", Snacks.picker.commands)
-mapkey("n", "<leader>?", "Open help picker", Snacks.picker.help)
-mapkey("n", "<leader>p", "Open picker picker", Snacks.picker.pickers)
-mapkey("n", "<leader>'", "Open last picker", Snacks.picker.resume)
+mapkey("n", "<leader>f", "Open file picker", ":lua Snacks.picker.files()<cr>")
+mapkey("n", "<leader>l", "Open recent file picker", ":lua Snacks.picker.recent()<cr>")
+mapkey("n", "<leader>e", "Open file explorer", ":lua Snacks.picker.explorer()<cr>")
+mapkey("n", "<leader>b", "Open buffer picker", ":lua Snacks.picker.buffers()<cr>")
+mapkey("n", "<leader>B", "Open buffer live grep picker", ":lua Snacks.picker.grep_buffers()<cr>")
+mapkey("n", "<leader>y", "Open clipboard history picker", ":lua Snacks.picker.cliphist()<cr>")
+mapkey("n", "<leader>/", "Open live grep picker", ":lua Snacks.picker.grep()<cr>")
+mapkey("n", "<leader>\\", "Open command palette", ":lua Snacks.picker.commands()<cr>")
+mapkey("n", "<leader>?", "Open help picker", ":lua Snacks.picker.help()<cr>")
+mapkey("n", "<leader>p", "Open picker picker", ":lua Snacks.picker.pickers()<cr>")
+mapkey("n", "<leader>'", "Open last picker", ":lua Snacks.picker.resume()<cr>")
+mapkey("n", "<leader><leader>", "Open smart picker", ":lua Snacks.picker.smart()<cr>")
-- Commenting.
mapkey("n", "<C-c>", "Comment line", ":norm gcc<cr>")
@@ -30,7 +31,14 @@ mapkey("n", "<leader>tp", "Go to previous tab", ":tabprev<cr>")
-- Sessions
mapkey("n", "<leader>s", "Manage sessions", "")
-mapkey("n", "<leader>ss", "Open session picker", ":SessionSelect<cr")
+mapkey("n", "<leader>ss", "Open session picker", ":SessionSelect<cr>")
+
+-- Terminals
+mapkey("n", "<leader>c", "Manage terminals", "")
+
+-- Git
+mapkey("n", "<leader>g", "Manage git", "")
+mapkey("n", "<leader>gg", "Open lazygit", ":lua Snacks.lazygit()<cr>")
-- QOL Keys
mapkey("t", "<Esc><Esc>", "Exit terminal insert mode", "<C-\\><C-n>")
@@ -45,7 +53,7 @@ mapkey({"n", "v"}, "j", "Go down visually", "gj")
mapkey({"n", "v"}, "k", "Go up visually", "gk")
-- Learn hjkl.
-mapkey({"n", "v"}, "<left>", "Correct the keypress", function() print("Try pressing h instead.") end)
-mapkey({"n", "v"}, "<down>", "Correct the keypress", function() print("Try pressing j instead.") end)
-mapkey({"n", "v"}, "<up>", "Correct the keypress", function() print("Try pressing k instead.") end)
-mapkey({"n", "v"}, "<right>", "Correct the keypress", function() print("Try pressing l instead.") end)
+-- mapkey({"n", "v"}, "<left>", "Correct the keypress", function() print("Try pressing h instead.") end)
+-- mapkey({"n", "v"}, "<down>", "Correct the keypress", function() print("Try pressing j instead.") end)
+-- mapkey({"n", "v"}, "<up>", "Correct the keypress", function() print("Try pressing k instead.") end)
+-- mapkey({"n", "v"}, "<right>", "Correct the keypress", function() print("Try pressing l instead.") end)
diff --git a/pkgs/custom-neovim/config/lua/neovide.lua b/pkgs/custom-neovim/config/lua/neovide.lua
index d088413..9d648c4 100644
--- a/pkgs/custom-neovim/config/lua/neovide.lua
+++ b/pkgs/custom-neovim/config/lua/neovide.lua
@@ -1,7 +1,8 @@
if vim.g.neovide then
--- if false then
vim.o.guifont = "CodeNewRoman Nerd Font:h12"
- -- vim.g.neovide_scale_factor = 0.8
+ vim.g.neovide_scale_factor = 0.8
+
+ vim.g.neovide_floating_shadow = false
-- Zoom keymaps.
local change_scale_factor = function(delta)
diff --git a/pkgs/custom-neovim/config/lua/options.lua b/pkgs/custom-neovim/config/lua/options.lua
index 8981dad..cd59941 100644
--- a/pkgs/custom-neovim/config/lua/options.lua
+++ b/pkgs/custom-neovim/config/lua/options.lua
@@ -40,6 +40,3 @@ vim.o.foldlevel = 99 -- Don't fold initially.
vim.o.foldnestmax = 4 -- Don't fold if more than 4 folds deep.
vim.o.foldtext = "" -- Color text in folds.
--- Set Colorscheme
-vim.cmd.colorscheme("oxocarbon")
-vim.o.termguicolors = true
diff --git a/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua b/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua
index 445caee..850ebe5 100644
--- a/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua
@@ -21,33 +21,31 @@ vim.api.nvim_create_autocmd('LspAttach', {
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
- local keymap = function(mode, key, desc, action)
- vim.keymap.set(mode, key, action, {noremap = true, silent = true, desc = desc})
- end
+ local mapkey = Utils.mapkey
- keymap('n', 'gD', "Go to declaration", vim.lsp.buf.declaration)
- keymap('n', 'gd', "Go to definition", vim.lsp.buf.definition)
- keymap('n', 'gy', "Go to type definition", vim.lsp.buf.type_definition)
- keymap('n', 'gi', "Go to implementation", vim.lsp.buf.implementation)
- keymap('n', '<M-k>', "Signature Help", vim.lsp.buf.signature_help)
- keymap('i', '<M-k>', "Signature Help", vim.lsp.buf.signature_help)
- keymap('n', "<space>o", "Manage LSP workspace", "")
- keymap('n', '<space>oa', "Add Workspace Folder", vim.lsp.buf.add_workspace_folder)
- keymap('n', '<space>or', "Remove Workspace Folder", vim.lsp.buf.remove_workspace_folder)
- keymap('n', '<space>ol', "List Workspace Folders", function()
+ mapkey('n', 'gD', "Go to declaration", vim.lsp.buf.declaration)
+ mapkey('n', 'gd', "Go to definition", vim.lsp.buf.definition)
+ mapkey('n', 'gy', "Go to type definition", vim.lsp.buf.type_definition)
+ mapkey('n', 'gi', "Go to implementation", vim.lsp.buf.implementation)
+ mapkey('n', '<M-k>', "Signature Help", vim.lsp.buf.signature_help)
+ mapkey('i', '<M-k>', "Signature Help", vim.lsp.buf.signature_help)
+ mapkey('n', "<space>o", "Manage LSP workspace", "")
+ mapkey('n', '<space>oa', "Add Workspace Folder", vim.lsp.buf.add_workspace_folder)
+ mapkey('n', '<space>or', "Remove Workspace Folder", vim.lsp.buf.remove_workspace_folder)
+ mapkey('n', '<space>ol', "List Workspace Folders", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end)
- keymap('n', '<space>r', "Rename Symbol", vim.lsp.buf.rename)
- keymap("n", "<leader>s", "Open symbol picker", ":Telescope lsp_document_symbols<cr>")
- keymap("n", "<leader>S", "Open workspace symbol picker", ":Telescope lsp_workspace_symbols<cr>")
+ mapkey('n', '<space>r', "Rename Symbol", vim.lsp.buf.rename)
+ mapkey("n", "<leader>s", "Open symbol picker", ":lua Snacks.picker.lsp_symbols()<cr>")
+ mapkey("n", "<leader>S", "Open workspace symbol picker", ":lua Snacks.picker.lsp_workspace_symbols()<cr>")
-- LSP Pickers
- keymap({'n', 'v'}, "<leader>a", "Perform code action", require("actions-preview").code_actions)
- keymap("n", "<leader>D", "Open workspace diagnostic picker", ":Pick diagnostic<cr>")
- keymap("n", "<leader>d", "Open diagnostic picker", [[:Pick diagnostic scope="current"<cr>]])
+ mapkey({'n', 'v'}, "<leader>a", "Perform code action", require("actions-preview").code_actions)
+ mapkey("n", "<leader>D", "Open workspace diagnostic picker", ":lua Snacks.picker.diagnostics()<cr>")
+ mapkey("n", "<leader>d", "Open diagnostic picker", [[:lua Snacks.picker.diagnostics_buffer()<cr>]])
- keymap('n', 'gr', "Buffer References", vim.lsp.buf.references)
- keymap('n', '<localleader>f', "Format Buffer", function()
+ mapkey('n', 'gr', "Buffer References", vim.lsp.buf.references)
+ mapkey('n', '<localleader>f', "Format Buffer", function()
vim.lsp.buf.format { async = true }
end)
end,
diff --git a/pkgs/custom-neovim/config/lua/plugins/lualine.lua b/pkgs/custom-neovim/config/lua/plugins/lualine.lua
index b38d3ed..1726f67 100644
--- a/pkgs/custom-neovim/config/lua/plugins/lualine.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/lualine.lua
@@ -1,5 +1,5 @@
local generate_lualine_theme = function()
- local colors = utils.generate_theme_from_lualine()
+ local colors = Utils.generate_theme_from_highlight_groups()
return {
normal = {
a = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'},
diff --git a/pkgs/custom-neovim/config/lua/plugins/mini/clue.lua b/pkgs/custom-neovim/config/lua/plugins/mini/clue.lua
index 3d213f9..12ce52d 100644
--- a/pkgs/custom-neovim/config/lua/plugins/mini/clue.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/mini/clue.lua
@@ -34,6 +34,8 @@ miniclue.setup({
clues = {
-- Enhance this by adding descriptions for <Leader> mapping groups
+ { mode = 'n', keys = '<Leader>' },
+ { mode = 'x', keys = '<Leader>' },
miniclue.gen_clues.builtin_completion(),
miniclue.gen_clues.g(),
miniclue.gen_clues.marks(),
@@ -41,4 +43,11 @@ miniclue.setup({
miniclue.gen_clues.windows(),
miniclue.gen_clues.z(),
},
+
+ window = {
+ delay = 0,
+
+ scroll_down = "<C-d>",
+ scroll_up = "<C-u>",
+ },
})
diff --git a/pkgs/custom-neovim/config/lua/plugins/snacks.lua b/pkgs/custom-neovim/config/lua/plugins/snacks.lua
index 57c3bc9..9410544 100644
--- a/pkgs/custom-neovim/config/lua/plugins/snacks.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/snacks.lua
@@ -1,4 +1,10 @@
require("snacks").setup {
bigfile = { enabled = true },
picker = { enabled = true },
+ lazygit = {
+ enabled = true,
+ config = {
+ quitOnTopLevelReturn = true,
+ },
+ },
}
diff --git a/pkgs/custom-neovim/config/lua/plugins/tabby.lua b/pkgs/custom-neovim/config/lua/plugins/tabby.lua
index 211c0c0..c4533c7 100644
--- a/pkgs/custom-neovim/config/lua/plugins/tabby.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/tabby.lua
@@ -1,4 +1,4 @@
-local general_theme = utils.generate_theme_from_lualine()
+local general_theme = Utils.generate_theme_from_highlight_groups()
local colors = {
current = { fg = general_theme.modes.insert, bg = general_theme.background, style = 'bold'},
not_current = { fg = general_theme.text.light, bg = general_theme.background };
diff --git a/pkgs/custom-neovim/config/lua/utilities.lua b/pkgs/custom-neovim/config/lua/utilities.lua
index 3de4a54..77645ca 100644
--- a/pkgs/custom-neovim/config/lua/utilities.lua
+++ b/pkgs/custom-neovim/config/lua/utilities.lua
@@ -1,25 +1,34 @@
-utils = {}
+Utils = {}
-utils.mapkey = function(mode, key, desc, action)
+Utils.mapkey = function(mode, key, desc, action)
vim.keymap.set(mode, key, action, {noremap = true, silent = true, desc = desc})
end
-utils.generate_theme_from_lualine = function()
- local auto_theme = require("lualine.themes.auto")
+Utils.generate_theme_from_highlight_groups = function()
+ local get_highlight_colors = function(group)
+ local raw_colors = vim.api.nvim_get_hl(0, {name = group})
+ local decimal_to_hex = function(decimal_color)
+ if decimal_color == nil then return nil end
+ return string.format("#%06X", decimal_color)
+ end
+ return {
+ fg = decimal_to_hex(raw_colors.fg),
+ bg = decimal_to_hex(raw_colors.bg),
+ }
+ end
return {
modes = {
- normal = auto_theme.normal.a.bg,
- insert = auto_theme.insert.a.bg,
- visual = auto_theme.visual.a.bg,
- replace = auto_theme.replace.a.bg,
- command = auto_theme.command.a.bg,
- inactive = auto_theme.inactive.a.bg,
+ normal = get_highlight_colors("MiniStatuslineModeNormal").bg,
+ insert = get_highlight_colors("MiniStatuslineModeInsert").bg,
+ visual = get_highlight_colors("MiniStatuslineModeVisual").bg,
+ replace = get_highlight_colors("MiniStatuslineModeReplace").bg,
+ command = get_highlight_colors("MiniStatuslineModeCommand").bg,
+ inactive = get_highlight_colors("MiniStatuslineModeInactive").bg,
},
text = {
- dark = auto_theme.normal.a.fg,
- light = auto_theme.normal.c.fg,
+ dark = get_highlight_colors("MiniStatuslineModeNormal").fg,
+ light = get_highlight_colors("Normal").fg,
},
- background = auto_theme.normal.c.bg,
+ background = get_highlight_colors("Normal").bg,
}
end
-
diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix
index 27a195c..85099f8 100644
--- a/pkgs/custom-neovim/default.nix
+++ b/pkgs/custom-neovim/default.nix
@@ -18,19 +18,16 @@ in
nvim-treesitter.withAllGrammars # All treesitter grammars.
tabby-nvim # Tab bar.
lualine-nvim # Status line.
- # plenary-nvim # General Library.
- # plenary-nvim-git
alpha-nvim # Dashboard.
persisted-nvim # Session manager.
- git-plugins.which-key-nvim-git
snacks-nvim
# Colorschemes
oxocarbon-nvim # IBM Carbon themes.
rose-pine # Rose Pine themes.
- kanagawa-nvim # Kanagawa themes.
+ kanagawa-nvim # Kanagawa inspired themes.
everforest # Green themes.
- nordic-nvim # Warm dark nordic theme.
+ nordic-nvim # Cool dark nordic theme.
tokyonight-nvim
nightfox-nvim
@@ -38,6 +35,7 @@ in
presence-nvim # Discord RPC for nvim.
cellular-automaton-nvim # Fun useless plugin.
vim-wakatime # For hack club challenge.
+ hardtime-nvim # Break bad vim habits.
];
opt = [];
};
@@ -57,7 +55,10 @@ in
# Extra Tools
ripgrep
fd
+ cliphist
+ lazygit
+ # Temporary
wakatime-cli
];
}
diff --git a/pkgs/custom-neovim/flake.nix b/pkgs/custom-neovim/flake.nix
index dfb4eb9..6611516 100644
--- a/pkgs/custom-neovim/flake.nix
+++ b/pkgs/custom-neovim/flake.nix
@@ -23,6 +23,7 @@
packages.default = pkgs.callPackage ./default.nix {inherit inputs;};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
+ neovide
];
};
}