Add TPM for tmux plugin management + plugins

This commit is contained in:
Evie Litherland-Smith 2023-02-09 15:47:44 +00:00
parent 6eacf0124c
commit 3be9aa5a10
10 changed files with 349 additions and 502 deletions

9
.gitignore vendored
View file

@ -2,9 +2,6 @@
*.swp
.python-version
.DS_Store
# For Packer plugins
plugin
# For lazygit state file
state.yml
# For pynvim environment
venv
config/nvim/plugin
config/lazygit/state.yml
config/tmux/plugins

View file

@ -1,10 +1,10 @@
LOCAL_BIN := $(HOME)/.local/bin
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
FONT_DIR := $(HOME)/.local/share/fonts
ZSH_DIR := $(if $(ZSH), $(ZSH), $(HOME)/.oh-my-zsh)
ZSH_CUSTOM_DIR := $(if $(ZSH_CUSTOM), $(ZSH_CUSTOM), $(ZSH_DIR)/custom)
SSH_DIR := $(HOME)/.ssh
ZSH_CUSTOM_DIR := $(if $(ZSH_CUSTOM), $(ZSH_CUSTOM), $(ZSH_DIR)/custom)
HOME_ITEMS := $(wildcard home/*)
HOME_TARGETS := $(HOME_ITEMS:home/%=$(HOME)/.%)
CONFIG_ITEMS := $(wildcard config/*)
@ -18,8 +18,10 @@ PACKER_REPO := https://github.com/wbthomason/packer.nvim
PACKER_DIR := $(HOME)/.local/share/nvim/site/pack/packer/start/packer.nvim
POWERLEVEL_REPO := https://github.com/romkatv/powerlevel10k.git
POWERLEVEL_DIR := $(ZSH_CUSTOM_DIR)/themes/powerlevel10k
TPM_REPO := https://github.com/tmux-plugins/tpm
TPM_DIR := $(HOME)/.tmux/plugins/tpm
.PHONY := install clean home packages config zsh ssh nvim
.PHONY: install clean home packages config zsh ssh nvim
install: home packages config zsh ssh nvim
@ -35,7 +37,7 @@ home: $(HOME_TARGETS)
packages:
pacman -T - < pkglist.txt || sudo pacman --needed -S - < pkglist.txt
config: $(CONFIG_TARGETS)
config: $(CONFIG_TARGETS) $(TPM_DIR)
zsh: $(ZSH_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS)
@ -53,11 +55,14 @@ $(HOME_TARGETS) $(CONFIG_TARGETS) $(ZSH_TARGETS) $(SSH_TARGETS):
$(PACKER_DIR):
git clone --depth 1 $(PACKER_REPO) $@
$(ZSH_DIR):
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$(POWERLEVEL_DIR): $(ZSH_DIR)
git clone --depth 1 $(POWERLEVEL_REPO) $@
$(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(SSH_DIR) $(HOME)/.ssh/sockets:
$(TPM_DIR):
git clone --depth 1 $(TPM_REPO) $@
$(ZSH_DIR):
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$(CONFIG_DIR) $(FONT_DIR) $(SSH_DIR) $(HOME)/.ssh/sockets:
mkdir -p $@

View file

@ -1,5 +1,5 @@
require('toggleterm').setup {
direction = 'float',
direction = 'horizontal',
open_mapping = [[\t]],
size = function (term)
if term.direction == "horizontal" then
@ -10,14 +10,13 @@ require('toggleterm').setup {
end,
hide_numbers = true, -- hide the number column in toggleterm buffers
persist_size = false,
float_opts = {
border = 'curved',
},
winbar = {
enabled = false,
name_formatter = function(term) -- term: Terminal
return term.name
end
},
}
function _G.set_terminal_keymaps()
local opts = { buffer = 0 }
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
end
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')

View file

@ -1,39 +1,32 @@
local function map(mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
end
local function nmap(shortcut, command)
map('n', shortcut, command)
end
vim.g.mapleader = ' '
vim.keymap.set('i', 'jk', '<esc>')
-- Toggleterm
vim.keymap.set('n', '<leader>th', '<cmd>ToggleTerm direction=horizontal<cr>')
vim.keymap.set('n', '<leader>tv', '<cmd>ToggleTerm direction=vertical<cr>')
vim.keymap.set('n', '<leader>tf', '<cmd>ToggleTerm direction=float<cr>')
vim.keymap.set('n', '<leader>tt', '<cmd>ToggleTerm direction=tab<cr>')
-- Aerial
nmap('<leader>aa', '<cmd>AerialToggle<cr>')
vim.keymap.set('n', '<leader>aa', '<cmd>AerialToggle<cr>')
-- Telescope
nmap('<leader>;', '<cmd>Telescope builtin<cr>')
nmap('<leader>ff', '<cmd>Telescope find_files<cr>')
nmap('<leader>fg', '<cmd>Telescope live_grep<cr>')
nmap('<leader>fp', '<cmd>Telescope projects<cr>')
nmap('<leader>fa', '<cmd>Telescope aerial<cr>')
nmap('<leader>fl', '<cmd>Telescope lsp_document_symbols<cr>')
nmap('<leader>fe', '<cmd>Telescope diagnostics<cr>')
nmap('<leader>fs', '<cmd>Telescope treesitter<cr>')
nmap('<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>')
vim.keymap.set('n', '<leader>;', '<cmd>Telescope builtin<cr>')
vim.keymap.set('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
vim.keymap.set('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
vim.keymap.set('n', '<leader>fp', '<cmd>Telescope projects<cr>')
vim.keymap.set('n', '<leader>fa', '<cmd>Telescope aerial<cr>')
vim.keymap.set('n', '<leader>fl', '<cmd>Telescope lsp_document_symbols<cr>')
vim.keymap.set('n', '<leader>fe', '<cmd>Telescope diagnostics<cr>')
vim.keymap.set('n', '<leader>fs', '<cmd>Telescope treesitter<cr>')
vim.keymap.set('n', '<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>')
-- Nvim-tree
nmap('<leader>n', '<cmd>NvimTreeToggle<cr>')
vim.keymap.set('n', '<leader>n', '<cmd>NvimTreeToggle<cr>')
-- Trouble
nmap('<leader>xx', '<cmd>TroubleToggle<cr>')
nmap('<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>')
nmap('<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>')
nmap('<leader>xq', '<cmd>TroubleToggle quickfix<cr>')
nmap('<leader>xl', '<cmd>TroubleToggle loclist<cr>')
-- Navigator
vim.keymap.set({'n', 't'}, '<A-h>', '<CMD>NavigatorLeft<CR>')
vim.keymap.set({'n', 't'}, '<A-l>', '<CMD>NavigatorRight<CR>')
vim.keymap.set({'n', 't'}, '<A-k>', '<CMD>NavigatorUp<CR>')
vim.keymap.set({'n', 't'}, '<A-j>', '<CMD>NavigatorDown<CR>')
vim.keymap.set({'n', 't'}, '<A-p>', '<CMD>NavigatorPrevious<CR>')
vim.keymap.set('n', '<leader>xx', '<cmd>TroubleToggle<cr>')
vim.keymap.set('n', '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>')
vim.keymap.set('n', '<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>')
vim.keymap.set('n', '<leader>xq', '<cmd>TroubleToggle quickfix<cr>')
vim.keymap.set('n', '<leader>xl', '<cmd>TroubleToggle loclist<cr>')

View file

@ -155,12 +155,7 @@ require('packer').startup {
}
end
}
use {
'numToStr/Navigator.nvim',
config = function()
require('Navigator').setup()
end
}
use 'sunaku/tmux-navigate'
end,
config = {
display = {

View file

@ -1,8 +1,18 @@
#!/usr/bin/env bash
# Set color enabled
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",*256col*,*kitty,alacritty:Tc"
set -g base-index 1
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'ofirgall/tmux-window-name'
set -g @plugin 'noscript/tmux-mighty-scroll'
set -g @plugin 'jabirali/tmux-tilish'
set -g @plugin 'sunaku/tmux-navigate'
# Plugin options.
set -g @tilish-navigate 'on'
set -g @tilish-dmenu 'on'
# Nightfox colors for Tmux
# Style: nightfox
@ -26,3 +36,6 @@ setw -g window-status-separator ""
setw -g window-status-style "NONE,fg=#71839b,bg=#131a24"
setw -g window-status-format "#[fg=#131a24,bg=#131a24,nobold,nounderscore,noitalics]#[default] #I  #W #F #[fg=#131a24,bg=#131a24,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#131a24,bg=#aeafb0,nobold,nounderscore,noitalics]#[fg=#131a24,bg=#aeafb0,bold] #I  #W #F #[fg=#aeafb0,bg=#131a24,nobold,nounderscore,noitalics]"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

View file

@ -1,47 +1,6 @@
local wezterm = require('wezterm')
local act = wezterm.action
local function isViProcess(pane)
-- get_foreground_process_name On Linux, macOS and Windows,
-- the process can be queried to determine this path. Other operating systems
-- (notably, FreeBSD and other unix systems) are not currently supported
return pane:get_foreground_process_name():find('n?vim') ~= nil
-- return pane:get_title():find("n?vim") ~= nil
end
local function conditionalActivatePane(window, pane, pane_direction, vim_direction)
if isViProcess(pane) then
window:perform_action(
-- This should match the keybinds you set in Neovim.
act.SendKey({ key = vim_direction, mods = 'ALT' }),
pane
)
else
window:perform_action(act.ActivatePaneDirection(pane_direction), pane)
end
end
wezterm.on('ActivatePaneDirection-right', function(window, pane)
conditionalActivatePane(window, pane, 'Right', 'l')
end)
wezterm.on('ActivatePaneDirection-left', function(window, pane)
conditionalActivatePane(window, pane, 'Left', 'h')
end)
wezterm.on('ActivatePaneDirection-up', function(window, pane)
conditionalActivatePane(window, pane, 'Up', 'k')
end)
wezterm.on('ActivatePaneDirection-down', function(window, pane)
conditionalActivatePane(window, pane, 'Down', 'j')
end)
return {
disable_default_key_bindings = true,
window_background_opacity = 0.95,
color_scheme = "nightfox",
hide_tab_bar_if_only_one_tab = true,
keys = {
{ key = 'h', mods = 'ALT', action = act.EmitEvent('ActivatePaneDirection-left') },
{ key = 'j', mods = 'ALT', action = act.EmitEvent('ActivatePaneDirection-down') },
{ key = 'k', mods = 'ALT', action = act.EmitEvent('ActivatePaneDirection-up') },
{ key = 'l', mods = 'ALT', action = act.EmitEvent('ActivatePaneDirection-right') },
},
}

File diff suppressed because it is too large Load diff

5
ohmyzsh/hooks.zsh Normal file
View file

@ -0,0 +1,5 @@
tmux-window-name() {
($TMUX_PLUGIN_MANAGER_PATH/tmux-window-name/scripts/rename_session_windows.py &)
}
add-zsh-hook chpwd tmux-window-name

View file

@ -1,17 +1,19 @@
zsh
wezterm
fzf
neovim
lazygit
ripgrep
lua-language-server
tree-sitter
neovim
pyenv
python
python-pip
python-virtualenv
python-black
python-isort
python-poetry
python-libtmux
python-pip
python-pipx
python-poetry
python-pre-commit
python-pynvim
pyenv
python-virtualenv
ripgrep
tree-sitter
wezterm
zsh