diff --git a/config/neovim/after/plugin/colorscheme.lua b/config/neovim/after/plugin/colorscheme.lua index 32c4d15..ec74134 100644 --- a/config/neovim/after/plugin/colorscheme.lua +++ b/config/neovim/after/plugin/colorscheme.lua @@ -1,58 +1,12 @@ -if not pcall(require, "colorbuddy") then +local status_ok, catppuccin = pcall(require, "catppuccin") +if not status_ok then return end +catppuccin.setup {} + vim.opt.termguicolors = true -require "colorbuddy".colorscheme "gruvbuddy" -require "colorizer".setup {} +vim.g.catppuccin_flavour = "mocha" -local Group = require("colorbuddy.group").Group -local c = require("colorbuddy.color").colors -local g = require("colorbuddy.group").groups -local s = require("colorbuddy.style").styles - --- Global --- Group.new("TSComment", c.none) -Group.new("TSInclude", nil) -Group.new("TSOperator", nil) -Group.new("TSPunctBracket", nil) -Group.new("TSPunctDelimiter", nil) -Group.new("WinSeparator", nil) - --- Lua -Group.new("luaTSConstant", c.blue) -Group.new("luaTSField", nil, nil) -Group.new("luaTSFuncBuiltin", nil) -Group.new("luaTSFunction", nil) -Group.new("luaTSKeyword", nil) -Group.new("luaTSKeywordFunction", c.violet) -Group.new("luaTSKeywordOperator", c.orange) -Group.new("luaTSKeywordReturn", nil) -Group.new("luaTSParameter", nil) -Group.new("luaTSPunctBracket", nil) -Group.new("luaTSString", c.blue) -Group.new("luaTSVariable", nil) - --- PHP -Group.new("phpTSInclude", nil) -Group.new("phpTSKeyword", nil) -Group.new("phpTSKeywordFunction", nil) -Group.new("phpTSMethod", c.blue) -Group.new("phpTSOperator", nil) -Group.new("phpTSVariableBuiltin", nil) -Group.new("phpTSNamespace", c.blue) - --- JavaScript -Group.new("javascriptTSConstructor", c.blue) -Group.new("javascriptTSException", c.red) -Group.new("javascriptTSFunction", c.none) -Group.new("javascriptTSMethod", nil) -Group.new("javascriptTSProperty", nil) -Group.new("javascriptTSVariable", c.blue) - --- TypeScript -Group.new("typescriptTSConditional", c.none) -Group.new("typescriptTSKeyword", c.none) -Group.new("typescriptTSProperty", c.violet) -Group.new("typescriptTSType", c.blue) +vim.cmd([[ colorscheme catppuccin ]]) diff --git a/config/neovim/after/plugin/gitsigns.lua b/config/neovim/after/plugin/gitsigns.lua index bba022c..14dfb74 100644 --- a/config/neovim/after/plugin/gitsigns.lua +++ b/config/neovim/after/plugin/gitsigns.lua @@ -8,11 +8,9 @@ gitsigns.setup { numhl = true, } -local actions = require("gitsigns.actions") - -vim.keymap.set('n', '[h', actions.prev_hunk); -vim.keymap.set('n', ']h', actions.next_hunk); -vim.keymap.set('n', 'gS', actions.undo_stage_hunk); -vim.keymap.set('n', 'gb', actions.blame_line); -vim.keymap.set('n', 'gp', actions.preview_hunk); -vim.keymap.set('n', 'gs', actions.stage_hunk); +vim.keymap.set('n', '[h', "Gitsigns prev_hunk"); +vim.keymap.set('n', ']h', "Gitsigns next_hunk"); +vim.keymap.set('n', 'gS', "Gitsigns undo_stage_hunk"); +vim.keymap.set('n', 'gb', "Gitsigns blame_line"); +vim.keymap.set('n', 'gp', "Gitsigns preview_hunk"); +vim.keymap.set('n', 'gs', "Gitsigns stage_hunk"); diff --git a/config/neovim/after/plugin/nvim-rest.lua b/config/neovim/after/plugin/nvim-rest.lua index 1bc5b33..857a433 100644 --- a/config/neovim/after/plugin/nvim-rest.lua +++ b/config/neovim/after/plugin/nvim-rest.lua @@ -3,15 +3,10 @@ if not status_ok then return end +rest_nvim.setup() + local nmap = require("opdavies.keymap").nmap --- Run the request. -nmap { "rr", "require('rest-nvim').run()" } - --- Preview the request. -nmap { "rp", "require('rest-nvim').run(true)" } - --- Re-run the last request. -nmap { "rl", "require('rest-nvim').last()" } - -rest_nvim.setup() +nmap { "rr", "RestNvim" } +nmap { "rp", "RestNvimPreview" } +nmap { "rl", "RestNvimLast" } diff --git a/config/neovim/lua/opdavies/lsp/init.lua b/config/neovim/lua/opdavies/lsp/init.lua index 6c80013..c48ca10 100644 --- a/config/neovim/lua/opdavies/lsp/init.lua +++ b/config/neovim/lua/opdavies/lsp/init.lua @@ -36,10 +36,9 @@ local custom_attach = function(client) -- Keymaps buf_inoremap { "", vim.lsp.buf.signature_help } + buf_nnoremap { "[d", vim.diagnostic.goto_prev } + buf_nnoremap { "]d", vim.diagnostic.goto_next } buf_nnoremap { "ca", vim.lsp.buf.code_action } - buf_nnoremap { "dn", vim.diagnostic.goto_next } - buf_nnoremap { "dp", vim.diagnostic.goto_prev } - buf_nnoremap { "f", vim.lsp.buf.format } buf_nnoremap { "rn", vim.lsp.buf.rename } buf_nnoremap { "rr", "LspRestart" } buf_nnoremap { "K", vim.lsp.buf.hover } @@ -159,11 +158,19 @@ for server, config in pairs(servers) do end vim.diagnostic.config { + float = { + source = true, + }, signs = true, underline = false, update_in_insert = false, virtual_text = { spacing = 2 }, } +vim.keymap.set("n", "f", function() + vim.lsp.buf.format { async = true } +end +); + require "opdavies.lsp.null-ls" require "opdavies.lsp.signature" diff --git a/config/neovim/lua/opdavies/options.lua b/config/neovim/lua/opdavies/options.lua index 6b2d235..a5fa485 100644 --- a/config/neovim/lua/opdavies/options.lua +++ b/config/neovim/lua/opdavies/options.lua @@ -125,6 +125,7 @@ local function set_vim_o() autoindent = true, backup = true, breakindent = true, + cmdheight = 0, conceallevel = 0, cursorline = true, expandtab = true, diff --git a/config/neovim/lua/opdavies/snippets/ft/markdown.lua b/config/neovim/lua/opdavies/snippets/ft/markdown.lua index c194d2a..b2a76e4 100644 --- a/config/neovim/lua/opdavies/snippets/ft/markdown.lua +++ b/config/neovim/lua/opdavies/snippets/ft/markdown.lua @@ -13,6 +13,8 @@ local M = { ]], { i(1), i(0) } ), + + link = fmt([[[{}]({}){} ]], { i(1), i(2), i(0) }), } return M diff --git a/config/neovim/lua/opdavies/telescope/init.lua b/config/neovim/lua/opdavies/telescope/init.lua index c42525e..c80a8ab 100644 --- a/config/neovim/lua/opdavies/telescope/init.lua +++ b/config/neovim/lua/opdavies/telescope/init.lua @@ -97,10 +97,16 @@ function M.file_browser() require("telescope").extensions.file_browser.file_browser(opts) end -function M.fd() +function M.find_files() + local opts = themes.get_ivy { + file_ignore_patterns = { ".git/", "**/{core,contrib}", "vendor" }, + } + + require("telescope.builtin").find_files(opts) +end + +function M.find_all_files() local opts = themes.get_ivy { - file_ignore_patterns = { ".git/" }, - hidden = true, no_ignore = true, } @@ -118,7 +124,7 @@ function M.git_files() end function M.live_grep() - require("telescope.builtin").live_grep { + require("telescope").extensions.live_grep_args.live_grep_args { file_ignore_patterns = { ".git/" }, hidden = true, no_ignore = true, @@ -126,6 +132,14 @@ function M.live_grep() } end +function M.oldfiles() + local opts = themes.get_ivy { + prompt_title = "History", + } + + require("telescope").extensions.frecency.frecency(opts) +end + return setmetatable({}, { __index = function(_, k) reloader() diff --git a/config/neovim/lua/opdavies/telescope/mappings.lua b/config/neovim/lua/opdavies/telescope/mappings.lua index 865618c..3b2ba31 100644 --- a/config/neovim/lua/opdavies/telescope/mappings.lua +++ b/config/neovim/lua/opdavies/telescope/mappings.lua @@ -23,12 +23,13 @@ local telescope_mapper = function(key, f, options, buffer) end telescope_mapper("fb", "buffers") -telescope_mapper("fd", "fd") +telescope_mapper("fd", "find_files") telescope_mapper("fe", "file_browser") telescope_mapper("ff", "current_buf") telescope_mapper("fg", "git_files") telescope_mapper("fh", "help_tags") telescope_mapper("fl", "live_grep") +telescope_mapper("fo", "oldfiles") telescope_mapper("ds", "lsp_document_symbols") telescope_mapper("dl", "diagnostics") diff --git a/config/neovim/lua/opdavies/telescope/setup.lua b/config/neovim/lua/opdavies/telescope/setup.lua index c0abbf0..5d2643f 100644 --- a/config/neovim/lua/opdavies/telescope/setup.lua +++ b/config/neovim/lua/opdavies/telescope/setup.lua @@ -28,10 +28,16 @@ end local action_layout = require "telescope.actions.layout" local actions = require "telescope.actions" +local lga_actions = require "telescope-live-grep-args.actions" telescope.setup { defaults = { buffer_previewer_maker = new_maker, + file_ignore_patterns = { '.git/' }, + layout_config = { + prompt_position = 'top', + }, + mappings = { i = { [""] = actions.which_key, @@ -41,8 +47,28 @@ telescope.setup { [""] = action_layout.toggle_preview, }, }, + no_ignore = true, + path_display = { truncate = 1 }, prompt_prefix = "$ ", + sorting_strategy = 'ascending', + }, + + pickers = { + find_files = { + hidden = true, + }, + + buffers = { + previewer = false, + layout_config = { + width = 80, + }, + }, + + lsp_references = { + previewer = false, + }, }, extensions = { @@ -50,6 +76,16 @@ telescope.setup { theme = "ivy", }, + live_grep_args = { + auto_quoting = true, + mappings = { + i = { + [""] = lga_actions.quote_prompt {}, + [""] = lga_actions.quote_prompt { postfix = " --iglob " }, + }, + }, + }, + ["ui-select"] = { require("telescope.themes").get_dropdown {}, }, diff --git a/home-manager/modules/common.nix b/home-manager/modules/common.nix index 27021c5..07055eb 100644 --- a/home-manager/modules/common.nix +++ b/home-manager/modules/common.nix @@ -52,6 +52,7 @@ in { black gopls html-tidy + lua53Packages.lua-lsp nodePackages."@astrojs/language-server" nodePackages."@tailwindcss/language-server" nodePackages.bash-language-server @@ -158,6 +159,8 @@ in { customVim.vim-textobj-xmlattr customVim.vim-visual-star-search + vimPlugins.catppuccin-nvim + vimPlugins.comment-nvim vimPlugins.dial-nvim vimPlugins.git-worktree-nvim @@ -176,6 +179,7 @@ in { vimPlugins.vim-eunuch vimPlugins.vim-floaterm vimPlugins.vim-highlightedyank + vimPlugins.vim-nix vimPlugins.vim-pasta vimPlugins.vim-polyglot vimPlugins.vim-repeat @@ -227,6 +231,7 @@ in { vimPlugins.plenary-nvim vimPlugins.popup-nvim vimPlugins.telescope-file-browser-nvim + vimPlugins.telescope-frecency-nvim vimPlugins.telescope-fzf-native-nvim vimPlugins.telescope-live-grep-args-nvim vimPlugins.telescope-nvim