treesitter doesn't install all, whichkey updated

This commit is contained in:
Solomon Laing 2023-01-12 08:56:02 +10:30
parent 1a984d2e0f
commit 3260b6dc80
5 changed files with 123 additions and 53 deletions

View File

@ -48,9 +48,6 @@ map("n", "<C-d>", "<C-d>zz", opts)
-- Easy exit insert mode -- Easy exit insert mode
map("i", "jk", "<ESC>", opts) map("i", "jk", "<ESC>", opts)
-- Paste
map("i", "<C-p>", '"+y', opts)
-- Save -- Save
map("i", "<C-s>", "<ESC>:w<CR>a", opts) map("i", "<C-s>", "<ESC>:w<CR>a", opts)
@ -62,33 +59,4 @@ map("v", ">", ">gv", opts)
map("v", "<C-j>", ":m .+1<CR>==<ESC>V", opts) map("v", "<C-j>", ":m .+1<CR>==<ESC>V", opts)
map("v", "<C-k>", ":m .-2<CR>==<ESC>V", opts) map("v", "<C-k>", ":m .-2<CR>==<ESC>V", opts)
local util = require("lazyvim.functions") vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
-- lazygit
vim.keymap.set("n", "<leader>gg", function()
require("lazyvim.util").float_term({ "lazygit" })
end, { desc = "Lazygit (cwd)" })
vim.keymap.set("n", "<leader>gG", function()
util.float_term({ "lazygit" }, { cwd = util.get_root() })
end, { desc = "Lazygit (root dir)" })
-- toggle options
vim.keymap.set("n", "<leader>of", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" })
vim.keymap.set("n", "<leader>os", function()
util.toggle("spell")
end, { desc = "Toggle Spelling" })
vim.keymap.set("n", "<leader>ow", function()
util.toggle("wrap")
end, { desc = "Toggle Word Wrap" })
vim.keymap.set("n", "<leader>on", function()
util.toggle("relativenumber", true)
util.toggle("number")
end, { desc = "Toggle Line Numbers" })
vim.keymap.set("n", "<leader>od", util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
vim.keymap.set("n", "<leader>oc", function()
util.toggle("conceallevel", false, { 0, conceallevel })
end, { desc = "Toggle Conceal" })
vim.keymap.set("n", "<leader>ll", "<cmd>lopen<cr>", { desc = "Open Location List" })
vim.keymap.set("n", "<leader>lq", "<cmd>copen<cr>", { desc = "Open Quickfix List" })

View File

@ -82,6 +82,17 @@ function M.toggle(option, silent, values)
end end
end end
-- FIXME: create a togglable termiminal
-- Opens a floating terminal (interactive by default)
---@param cmd? string[]|string
---@param opts? LazyCmdOptions|{interactive?:boolean}
function M.float_term(cmd, opts)
opts = vim.tbl_deep_extend("force", {
size = { width = 0.9, height = 0.9 },
}, opts or {})
require("lazy.util").float_term(cmd, opts)
end
local enabled = true local enabled = true
function M.toggle_diagnostics() function M.toggle_diagnostics()
enabled = not enabled enabled = not enabled

View File

@ -18,7 +18,6 @@ return {
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>" return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
end, end,
expr = true, expr = true,
remap = true,
silent = true, silent = true,
mode = "i", mode = "i",
}, },

View File

@ -10,9 +10,21 @@ return {
autopairs = { enable = true }, autopairs = { enable = true },
indent = { enable = true }, indent = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false }, context_commentstring = { enable = true, enable_autocmd = false },
ensure_installed = "all", ensure_installed = {
"c_sharp",
"lua",
"c",
"vim",
"help",
"javascript",
"typescript",
"sql",
"html",
"jsonc",
}, },
config = function(plugin, opts) auto_install = true,
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts) require("nvim-treesitter.configs").setup(opts)
end, end,
}, },

View File

@ -24,22 +24,24 @@ return {
scroll_down = "<C-d>", -- binding to scroll down inside the popup scroll_down = "<C-d>", -- binding to scroll down inside the popup
scroll_up = "<C-u>", -- binding to scroll up inside the popup scroll_up = "<C-u>", -- binding to scroll up inside the popup
}, },
-- window = { window = {
-- border = "rounded", -- none, single, double, shadow border = "rounded", -- none, single, double, shadow
-- position = "bottom", -- bottom, top position = "bottom", -- bottom, top
-- margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
-- padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
-- winblend = 0, winblend = 0,
-- }, },
-- layout = { layout = {
-- height = { min = 4, max = 25 }, -- min and max height of the columns height = { min = 4, max = 25 }, -- min and max height of the columns
-- width = { min = 20, max = 50 }, -- min and max width of the columns width = { min = 20, max = 50 }, -- min and max width of the columns
-- spacing = 3, -- spacing between columns spacing = 3, -- spacing between columns
-- align = "center", -- align columns left, center or right align = "center", -- align columns left, center or right
-- }, },
}, },
config = function(_, opts) config = function(_, opts)
local whichkey = require("which-key") local whichkey = require("which-key")
local Util = require("lazyvim.functions")
whichkey.setup(opts) whichkey.setup(opts)
local leader_opts = { local leader_opts = {
@ -60,16 +62,13 @@ return {
}) })
local leader_mappings = { local leader_mappings = {
l = { name = "+lsp" },
b = { name = "+buffer" }, b = { name = "+buffer" },
r = { name = "+replace" }, r = { name = "+replace" },
f = { name = "+file" },
s = { name = "+search" }, s = { name = "+search" },
h = { name = "+help" }, h = { name = "+help" },
g = { name = "+git" }, gh = { name = "+hunks" },
t = { name = "+todo" }, t = { name = "+todo" },
N = { name = "+noice" }, N = { name = "+noice" },
o = { name = "+option" },
H = { "<cmd>split<cr>", "Split" }, H = { "<cmd>split<cr>", "Split" },
V = { "<cmd>vsplit<cr>", "V Split" }, V = { "<cmd>vsplit<cr>", "V Split" },
@ -81,12 +80,93 @@ return {
["'"] = { "<cmd>close<CR>", "Close split" }, ["'"] = { "<cmd>close<CR>", "Close split" },
u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" }, u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" },
f = {
name = "+file",
n = { "<cmd>enew<cr>", "New File" },
t = {
function()
Util.float_term(nil, { cwd = Util.get_root() })
end,
"Terminal (rood dir)",
},
T = {
function()
Util.float_term()
end,
"Terminal (cwd)",
},
},
l = {
name = "+lsp",
l = { "<cmd>lopen<cr>", "Open Location List" },
q = { "<cmd>copen<cr>", "Open Quickfix List" },
},
C = { C = {
name = "Compiler", name = "Compiler",
c = { "<cmd>w! | !compiler %<cr>", "Compile File" }, c = { "<cmd>w! | !compiler %<cr>", "Compile File" },
b = { "<cmd>w! | !pandoc % -t beamer -o presentation.pdf<cr>", "Beamer Presentation" }, b = { "<cmd>w! | !pandoc % -t beamer -o presentation.pdf<cr>", "Beamer Presentation" },
}, },
o = {
name = "+option",
f = {
function()
require("lazyvim.plugins.lsp.format").toggle()
end,
"Toggle format on save",
},
s = {
function()
Util.toggle("spell")
end,
"Toggle spelling",
},
w = {
function()
Util.toggle("wrap")
end,
"Toggle word wrap",
},
n = {
function()
Util.toggle("relativenumber", true)
Util.toggle("number")
end,
"Toggle line numbers",
},
d = {
function()
Util.toggle_diagnostics()
end,
"Toggle Diagnostics",
},
c = {
function()
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
Util.toggle("conceallevel", false, { 0, conceallevel })
end,
"Toggle conceal",
},
},
g = {
name = "+git",
g = {
function()
Util.float_term({ "lazygit" })
end,
"Lazygit (cwd)",
},
G = {
function()
Util.float_term({ "lazygit" }, { cwd = Util.get_root() })
end,
"Lazygit (root dir)",
},
},
-- o = { -- o = {
-- name = "Options", -- name = "Options",
-- c = { "<cmd>lua vim.g.cmp_active=false<cr>", "Completion off" }, -- c = { "<cmd>lua vim.g.cmp_active=false<cr>", "Completion off" },