Skip to content

Commit 1444396

Browse files
authored
Adding tmux support
1 parent af21c78 commit 1444396

File tree

2 files changed

+62
-8
lines changed

2 files changed

+62
-8
lines changed

init.lua

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ vim.opt.rtp:prepend(lazypath)
2626
-- NOTE: Here is where you install your plugins.
2727
require('lazy').setup({
2828
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
29+
{
30+
'christoomey/vim-tmux-navigator',
31+
cmd = {
32+
'TmuxNavigateLeft',
33+
'TmuxNavigateDown',
34+
'TmuxNavigateUp',
35+
'TmuxNavigateRight',
36+
'TmuxNavigatePrevious',
37+
'TmuxNavigatorProcessList',
38+
},
39+
},
2940
{
3041
'pmizio/typescript-tools.nvim',
3142
dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
@@ -502,14 +513,10 @@ require('lazy').setup({
502513
},
503514
},
504515
},
505-
pylsp = {
506-
plugins = {
507-
ruff = {
508-
enabled = true,
509-
formatEnabled = true,
510-
},
511-
autopep8 = { enabled = false },
512-
},
516+
pyright = {},
517+
ruff = {
518+
enabled = true,
519+
formatEnabled = true,
513520
},
514521
cmake = {},
515522
lua_ls = {

keymap.lua

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
-- [[ Basic Keymaps ]]
2+
-- See `:help vim.keymap.set()`
3+
4+
-- Set highlight on search, but clear on pressing <Esc> in normal mode
5+
6+
vim.keymap.set('n', '<leader>mt', '<cmd>NvimTreeFocus<CR>')
7+
vim.keymap.set('n', '<C-o>', '<cmd>ClangdSwitchSourceHeader<CR>', { desc = 'Swith to source/header file' })
8+
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
9+
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
10+
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
11+
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
12+
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
13+
vim.keymap.set('n', '<leader>z', require('telescope').extensions.zoxide.list, { desc = '[Z]oxide to different dir' })
14+
vim.keymap.set('n', '<leader>jl', require('telescope.builtin').jumplist, { desc = '[J]ump [L]ist' })
15+
vim.keymap.set('n', '<leader>ft', function()
16+
vim.g.disable_format = not vim.g.disable_autoformat
17+
end, { desc = 'Auto[F]ormat [T]oggle ' })
18+
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
19+
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
20+
-- is not what someone will guess without a bit more experience.
21+
--
22+
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
23+
-- or just use <C-\><C-n> to exit terminal mode
24+
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
25+
26+
-- TIP: Disable arrow keys in normal mode
27+
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
28+
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
29+
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
30+
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
31+
32+
-- Keybinds to make split navigation easier.
33+
-- Use CTRL+<hjkl> to switch between windows
34+
--
35+
-- See `:help wincmd` for a list of all window commands
36+
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
37+
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
38+
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
39+
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
40+
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
41+
42+
-- Tmux jump between tmux and nvim with nvim keybindings
43+
vim.keymap.set('n', '<c-h>', '<cmd>TmuxNavigateLeft<cr>', { desc = 'Move to left pane in tumx' })
44+
vim.keymap.set('n', '<c-j>', '<cmd>TmuxNavigateDown<cr>', { desc = 'Move to down pane in tumx' })
45+
vim.keymap.set('n', '<c-k>', '<cmd>TmuxNavigateUp<cr>', { desc = 'Move to up pane in tumx' })
46+
vim.keymap.set('n', '<c-l>', '<cmd>TmuxNavigateRight<cr>', { desc = 'Move to right pane in tumx' })
47+
vim.keymap.set('n', '<c-\\>', '<cmd>TmuxNavigatePrevious<cr>', { desc = 'Move to last pane in tumx' })

0 commit comments

Comments
 (0)