summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-08-21 22:13:02 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-08-21 22:13:02 -0600
commit013d70b8fc655e8f7cc010c451d8f2be658aaa11 (patch)
treec6dd5c3de1fe7b36d4cfe1cae2c9d54dd0ddb335
parent0d785cd9f3a7903c84846cee64e3c46ebb56ff64 (diff)
add split navigation kb
-rw-r--r--lua/config/keymap.lua10
-rw-r--r--lua/config/set.lua15
-rw-r--r--lua/plugins/lsp.lua4
3 files changed, 27 insertions, 2 deletions
diff --git a/lua/config/keymap.lua b/lua/config/keymap.lua
index 2280d15..6d99cfa 100644
--- a/lua/config/keymap.lua
+++ b/lua/config/keymap.lua
@@ -10,3 +10,13 @@ vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous dia
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
+
+-- Split navigation
+vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'Split: Move left' })
+vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'Split: Move down' })
+vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'Split: Move up' })
+vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'Split: Move right' })
+vim.keymap.set('n', '<C-left>', '<CMD>vertical resize -5<CR>', { desc = 'Split: Resize left', noremap = true })
+vim.keymap.set('n', '<C-down>', '<CMD>resize +5<CR>', { desc = 'Split: Resize down', noremap = true })
+vim.keymap.set('n', '<C-up>', '<CMD>resize -5<CR>', { desc = 'Split: Resize up', noremap = true })
+vim.keymap.set('n', '<C-right>', '<CMD>vertical resize +5<CR>', { desc = 'Split: Resize right', noremap = true })
diff --git a/lua/config/set.lua b/lua/config/set.lua
index 1f4d774..3793a22 100644
--- a/lua/config/set.lua
+++ b/lua/config/set.lua
@@ -38,6 +38,21 @@ vim.opt.foldexpr='nvim_treesitter#foldexpr()'
-- Disable folding at startup.
vim.nofoldenable=true
+-- 4 spaces for tab indentation
+-- not needed, using https://EditorConfig.org instead for 'tpope/vim-sleuth'
+-- vim.api.nvim_create_autocmd({'FileType', 'BufEnter', 'BufNewFile', 'BufRead'}, {
+-- pattern = { '*.py' },
+-- callback = function()
+-- vim.cmd[[filetype plugin indent on]]
+-- -- show existing tab with 4 spaces width
+-- vim.tabstop=4
+-- -- when indenting with '>', use 4 spaces width
+-- vim.shiftwidth=4
+-- -- on pressing tab, insert 4 spaces
+-- vim.expandtab=true
+-- end
+-- })
+
-- Highlight on yank
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua
index fdb0bda..2945003 100644
--- a/lua/plugins/lsp.lua
+++ b/lua/plugins/lsp.lua
@@ -51,8 +51,8 @@ return {
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
- nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
- nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
+ nmap('<leader>k', vim.lsp.buf.hover, 'Hover Documentation')
+ nmap('<leader>K', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')