feat(nvim): telescope/which-key config

This commit is contained in:
winston 2022-12-01 00:27:52 +01:00
parent b49b0596a0
commit 8be4fa917d
Signed by: winston
GPG key ID: 3786770EDBC2B481
3 changed files with 143 additions and 0 deletions

View file

@ -0,0 +1,37 @@
require("copilot").setup({
panel = {
enabled = false,
},
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
keymap = {
accept = "<C-J>",
},
},
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
["."] = false,
},
copilot_node_command = "node",
server_opts_overrides = {},
})
-- local present, cmp = pcall(require, "cmp")
-- if not present or not cmp then
-- return
-- end
-- cmp.event:on("menu_opened", function()
-- vim.b.copilot_suggestion_hidden = true
-- end)
-- cmp.event:on("menu_closed", function()
-- vim.b.copilot_suggestion_hidden = false
-- end)

View file

@ -0,0 +1,49 @@
local telescope = require("telescope")
telescope.setup({
defaults = {
selection_caret = "",
borderchars = {
results = {
"",
"",
" ",
"",
"",
"",
"",
"",
},
prompt = {
"",
"",
"",
"",
"",
"",
"",
"",
},
preview = {
"",
"",
"",
" ",
"",
"",
"",
"",
},
},
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
},
},
})
telescope.load_extension("fzf")

View file

@ -0,0 +1,57 @@
local wk = require("which-key")
wk.setup({
key_labels = {
["<space>"] = "SPC",
["<leader>"] = "SPC",
["<cr>"] = "",
["<tab>"] = "",
},
window = {
border = "double",
margin = { 0, 0, 0, 0 },
},
})
-- Telescope
wk.register({
["<leader>f"] = {
name = "+Telescope",
d = { "<cmd>Telescope find_files<cr>", "Find File" },
r = { "<cmd>Telescope asynctasks all<cr>", "Run Asynctasks" },
b = { "<cmd>Telescope file_browser<cr>", "File Browser" },
g = { "<cmd>Telescope live_grep<cr>", "Live Grep" },
h = { "<cmd>Telescope help_tags<cr>", "Help Tags" },
p = { "<cmd>Telescope project<cr>", "Project" },
s = {
function()
local confpath = vim.fn.resolve(vim.fn.stdpath("config"))
require("telescope.builtin").find_files({ cwd = confpath })
end,
"Find in config",
},
},
})
-- clipboard
wk.register({
["<leader>"] = {
y = { '"+y', "Copy to clipboard" },
p = { '"+p', "Paste from clipboard" },
},
}, { mode = { "n", "v" } })
wk.register({
-- easier split navigation
["<C-J>"] = { "<C-W>j" },
["<C-K>"] = { "<C-W>k" },
["<C-L>"] = { "<C-W>l" },
["<C-H>"] = { "<C-W>h" },
["<C-W>\\"] = { "<cmd>vsplit<cr>" },
["<C-W>-"] = { "<cmd>split<cr>" },
["<C-W>x"] = { "<cmd>q<cr>" },
-- diffs
["<leader>gd"] = { "<cmd>Gvdiff!<cr>", "Diff vsplit" },
["gd"] = { "<cmd>diffget<cr>", "Get from diff" },
["gdh"] = { "<cmd>diffget //2<cr>", "Get diff from the left" },
["gdl"] = { "<cmd>diffget //3<cr>", "Get diff from the right" },
})