Added indent lines and moved over to better whichkey implementation

This commit is contained in:
Warwick 2023-08-16 16:52:25 +01:00
parent 79e895551d
commit be41c8120c
5 changed files with 41 additions and 29 deletions

View file

@ -14,3 +14,6 @@ vim.opt.tabstop = 2 -- Seems to be default for most lsp's now
vim.opt.shiftwidth = 2 vim.opt.shiftwidth = 2
vim.opt.shiftround = true vim.opt.shiftround = true
vim.opt.expandtab = true vim.opt.expandtab = true
-- line numbers are handy
vim.opt.number = true

View file

@ -0,0 +1,6 @@
require("indent_blankline").setup {
-- for example, context is off by default, use this to turn it on
show_current_context = false,
show_current_context_start = false,
}
vim.cmd [[colorscheme gruvbox]]

View file

@ -1,4 +1,3 @@
require("core.plugin_config.gruvbox")
require("core.plugin_config.lualine") require("core.plugin_config.lualine")
require("core.plugin_config.nvim-tree") require("core.plugin_config.nvim-tree")
require("core.plugin_config.telescope") require("core.plugin_config.telescope")
@ -7,3 +6,5 @@ require("core.plugin_config.lsp_config")
require("core.plugin_config.completions") require("core.plugin_config.completions")
require("core.plugin_config.terminal") require("core.plugin_config.terminal")
require("core.plugin_config.whichkey") require("core.plugin_config.whichkey")
require("core.plugin_config.indent-blankline")
require("core.plugin_config.gruvbox")

View file

@ -1,35 +1,31 @@
local whichkey = require("whichkey_setup") local whichkey = require("which-key")
-- lsp format
vim.g.formatfix = function()
vim.lsp.buf.format { async = true }
end
-- TODO fix <cmd> based instructions -- TODO fix <cmd> based instructions
local keymap = { local keymap = {
t = 'Toggle Terminal', t = 'Toggle Terminal',
l = { l = {
name = '+lsp', name = '+lsp',
e = { "vim.diagnostic.open_float", 'Diagnostic Float' }, e = { "<cmd>lua vim.diagnostic.open_float()<cr>", 'Diagnostic Float' },
n = { "vim.diagnostic.goto_next", 'Next Diagnostic' }, n = { "<cmd>lua vim.diagnostic.goto_next()<cr>", 'Next Diagnostic' },
N = { "vim.diagnostic.goto_prev", 'Previous Diagnostic' }, N = { "<cmd>lua vim.diagnostic.goto_prev()<cr>", 'Previous Diagnostic' },
j = { "vim.diagnostic.setloclist", 'Diagnostic List' }, j = { "<cmd>lua vim.diagnostic.setloclist()<cr>", 'Diagnostic List' },
--- Dynamic to each buffer potential TODO? --- Dynamic to each buffer potential TODO?
D = { "vim.lsp.buf.declaration", 'Declaration' }, D = { "<cmd>lua vim.lsp.buf.declaration()<cr>", 'Declaration' },
d = { "vim.lsp.buf.definition", 'Definition' }, d = { "<cmd>lua vim.lsp.buf.definition()<cr>", 'Definition' },
k = { "vim.lsp.buf.hover", 'Hover' }, k = { "<cmd>lua vim.lsp.buf.hover()<cr>", 'Hover' },
i = { "vim.lsp.buf.implementation", 'Implementation' }, i = { "<cmd>lua vim.lsp.buf.implementation()<cr>", 'Implementation' },
t = { "vim.lsp.buf.type_definition", 'Type Definition' }, t = { "<cmd>lua vim.lsp.buf.type_definition()<cr>", 'Type Definition' },
R = { "vim.lsp.buf.rename", 'Rename' }, R = { "<cmd>lua vim.lsp.buf.rename()<cr>", 'Rename' },
a = { "vim.lsp.buf.code_action", 'Code Action' }, a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", 'Code Action' },
r = { "vim.lsp.buf.references", 'References' }, r = { "<cmd>lua vim.lsp.buf.references()<cr>", 'References' },
f = { "<cmd>lua vim.g.formatfix()<CR>", 'Format' }, f = { function() vim.lsp.buf.format { async = true } end, 'Format' },
}, },
f = { f = {
name = '+find (telescope)', name = '+find (telescope)',
f = {"<cmd>Telescope find_files<CR>",'Find'}, f = { "<cmd>Telescope find_files<CR>", 'Find' },
o = {"<cmd>Telescope oldfiles<CR>",'Old Files'}, o = { "<cmd>Telescope oldfiles<CR>", 'Old Files' },
g = {"<cmd>Telescope live_grep<CR>",'Grep'}, g = { "<cmd>Telescope live_grep<CR>", 'Grep' },
h = {"<cmd>Telescope help_tags<CR>",'Help Tags'}, h = { "<cmd>Telescope help_tags<CR>", 'Help Tags' },
}, },
g = { g = {
name = '+git', name = '+git',
@ -39,7 +35,7 @@ local keymap = {
} }
} }
whichkey.config { whichkey.setup {
hide_statusline = false, hide_statusline = false,
default_keymap_settings = { default_keymap_settings = {
silent = true, silent = true,
@ -48,4 +44,4 @@ whichkey.config {
default_mode = 'n', default_mode = 'n',
} }
whichkey.register_keymap('leader', keymap) whichkey.register(keymap, { prefix = '<leader>' })

View file

@ -18,20 +18,26 @@ local plugins = {
'nvim-tree/nvim-web-devicons', 'nvim-tree/nvim-web-devicons',
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
{'windwp/nvim-autopairs', {
'windwp/nvim-autopairs',
event = "InsertEnter", event = "InsertEnter",
opts = {} -- this is equalent to setup({}) function opts = {} -- this is equalent to setup({}) function
}, },
'akinsho/toggleterm.nvim', 'akinsho/toggleterm.nvim',
{ {
'AckslD/nvim-whichkey-setup.lua', "folke/which-key.nvim",
dependencies = {'liuchengxu/vim-which-key'}, event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
}, },
"lukas-reineke/indent-blankline.nvim",
-- fzf -- fzf
{ {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
branch = "0.1.x", branch = "0.1.x",
dependencies = {{'nvim-lua/plenary.nvim'}} dependencies = { { 'nvim-lua/plenary.nvim' } }
}, },
-- Lsp -- Lsp
{ {