feat(nvim): config updates

This commit is contained in:
Oliver Davies 2023-03-22 22:22:08 +00:00
parent 5581ebc1f3
commit 8b8a9f1ce5
10 changed files with 91 additions and 78 deletions

View file

@ -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 ]])

View file

@ -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', "<cmd>Gitsigns prev_hunk<cr>");
vim.keymap.set('n', ']h', "<cmd>Gitsigns next_hunk<cr>");
vim.keymap.set('n', 'gS', "<cmd>Gitsigns undo_stage_hunk<cr>");
vim.keymap.set('n', 'gb', "<cmd>Gitsigns blame_line<cr>");
vim.keymap.set('n', 'gp', "<cmd>Gitsigns preview_hunk<cr>");
vim.keymap.set('n', 'gs', "<cmd>Gitsigns stage_hunk<cr>");

View file

@ -3,15 +3,10 @@ if not status_ok then
return
end
rest_nvim.setup()
local nmap = require("opdavies.keymap").nmap
-- Run the request.
nmap { "<leader>rr", "require('rest-nvim').run()" }
-- Preview the request.
nmap { "<leader>rp", "require('rest-nvim').run(true)" }
-- Re-run the last request.
nmap { "<leader>rl", "require('rest-nvim').last()" }
rest_nvim.setup()
nmap { "<leader>rr", "<plug>RestNvim<cr>" }
nmap { "<leader>rp", "<plug>RestNvimPreview<cr>" }
nmap { "<leader>rl", "<plug>RestNvimLast<cr>" }

View file

@ -36,10 +36,9 @@ local custom_attach = function(client)
-- Keymaps
buf_inoremap { "<c-s>", vim.lsp.buf.signature_help }
buf_nnoremap { "<leader>[d", vim.diagnostic.goto_prev }
buf_nnoremap { "<leader>]d", vim.diagnostic.goto_next }
buf_nnoremap { "<leader>ca", vim.lsp.buf.code_action }
buf_nnoremap { "<leader>dn", vim.diagnostic.goto_next }
buf_nnoremap { "<leader>dp", vim.diagnostic.goto_prev }
buf_nnoremap { "<leader>f", vim.lsp.buf.format }
buf_nnoremap { "<leader>rn", vim.lsp.buf.rename }
buf_nnoremap { "<leader>rr", "<cmd>LspRestart<cr>" }
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", "<leader>f", function()
vim.lsp.buf.format { async = true }
end
);
require "opdavies.lsp.null-ls"
require "opdavies.lsp.signature"

View file

@ -125,6 +125,7 @@ local function set_vim_o()
autoindent = true,
backup = true,
breakindent = true,
cmdheight = 0,
conceallevel = 0,
cursorline = true,
expandtab = true,

View file

@ -13,6 +13,8 @@ local M = {
]],
{ i(1), i(0) }
),
link = fmt([[[{}]({}){} ]], { i(1), i(2), i(0) }),
}
return M

View file

@ -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()

View file

@ -23,12 +23,13 @@ local telescope_mapper = function(key, f, options, buffer)
end
telescope_mapper("<leader>fb", "buffers")
telescope_mapper("<leader>fd", "fd")
telescope_mapper("<leader>fd", "find_files")
telescope_mapper("<leader>fe", "file_browser")
telescope_mapper("<leader>ff", "current_buf")
telescope_mapper("<leader>fg", "git_files")
telescope_mapper("<leader>fh", "help_tags")
telescope_mapper("<leader>fl", "live_grep")
telescope_mapper("<leader>fo", "oldfiles")
telescope_mapper("<leader>ds", "lsp_document_symbols")
telescope_mapper("<leader>dl", "diagnostics")

View file

@ -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 = {
["<C-h>"] = actions.which_key,
@ -41,8 +47,28 @@ telescope.setup {
["<C-p>"] = 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 = {
["<C-k>"] = lga_actions.quote_prompt {},
["<C-i>"] = lga_actions.quote_prompt { postfix = " --iglob " },
},
},
},
["ui-select"] = {
require("telescope.themes").get_dropdown {},
},

View file

@ -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