Compare commits

...

11 commits

6 changed files with 123 additions and 12 deletions

View file

@ -9,14 +9,10 @@ alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ ' PS1='[\u@\h \W]\$ '
# Execute tmux in Alacritty # Execute tmux in Alacritty
if [ "$TERM" == "alacritty" ]; then if [[ "$TERM" == "alacritty" || "$TERM_PROGRAM" == "WezTerm" ]]; then
exec tmux exec tmux
fi fi
# Set TERM to screen-256color inside tmux
# (Needs tmux.conf changes)
[[ $TMUX != "" ]] && export TERM="screen-256color"
# SSH without checking or adding host keys to known_hosts # SSH without checking or adding host keys to known_hosts
# Useful for cloud server rescue environment & installation # Useful for cloud server rescue environment & installation
alias sshtmp="ssh -o 'UserKnownHostsFile /dev/null' -o 'StrictHostKeyChecking no'" alias sshtmp="ssh -o 'UserKnownHostsFile /dev/null' -o 'StrictHostKeyChecking no'"
@ -24,10 +20,12 @@ alias moshtmp="mosh --ssh=\"ssh -o 'UserKnownHostsFile /dev/null' -o 'StrictHost
# SSH with automatic "screen" # SSH with automatic "screen"
function sshscr() { function sshscr() {
[ -z "$1" ] && return
ssh -t $@ screen -RR -d ssh -t $@ screen -RR -d
} }
function moshscr() { function moshscr() {
[ -z "$1" ] && return
mosh $@ -- screen -RR -d mosh $@ -- screen -RR -d
} }
@ -45,5 +43,48 @@ function sshunlock() {
set +o pipefail set +o pipefail
} }
# Show a menu of all known Tailscale nodes for the user to select from
function tsselect() {
local items=()
local hostnames=()
while read -r line; do
local name=$(echo "$line" | awk '{ print $2 }')
local ip=$(echo "$line" | awk '{ print $1 }')
items+=("$name ($ip)")
hostnames+=("$name")
done <<< $(tailscale status --self=false | sort -k 2)
_COLUMNS=$COLUMNS
# Force options to display in one column
COLUMNS=80
select item in "${items[@]}" Cancel; do
if [ $REPLY -eq ${#items[@]} ]; then
echo ""
fi
echo ${hostnames[$((REPLY - 1))]}
break;
done
COLUMNS=$_COLUMNS
}
# SSH shorthands, same as before but for tailscale nodes
function moshscrts() {
moshscr $(tsselect)
}
function sshscrts() {
sshscr $(tsselect)
}
function _ssh() {
[ -z "$1" ] && return
ssh $@
}
function sshts() {
_ssh $(tsselect)
}
# Add local to path # Add local to path
export PATH="$PATH:~/.local/bin" export PATH="$PATH:~/.local/bin"

View file

@ -31,6 +31,10 @@ set autoindent
" Syntax highlighting " Syntax highlighting
set syntax=on set syntax=on
" LaTeX
let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
let g:special_filetype_pattern = 'neo-tree\|toggleterm\|minimap' let g:special_filetype_pattern = 'neo-tree\|toggleterm\|minimap'
" Show line numbers on non-toolbar buffers " Show line numbers on non-toolbar buffers
@ -55,3 +59,10 @@ function _G.set_terminal_keymaps()
end end
EOF EOF
autocmd TermOpen term://* lua set_terminal_keymaps() autocmd TermOpen term://* lua set_terminal_keymaps()
" Spell checking
autocmd FileType tex,markdown setlocal spell spelllang=en_us
" Editor integration
let $GIT_EDITOR = 'nvr -cc split --remote-wait --servername ' . v:servername
autocmd FileType gitcommit,gitrebase,gitconfig set bufhidden=delete

View file

@ -1,6 +1,6 @@
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use) return require('packer').startup({function(use)
-- Packer can manage itself -- Packer can manage itself
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
@ -66,6 +66,9 @@ return require('packer').startup(function(use)
position = "left", position = "left",
width = 36, width = 36,
}, },
filesystem = {
use_libuv_file_watcher = true,
},
}) })
require("neo-tree.sources.manager").show("filesystem") require("neo-tree.sources.manager").show("filesystem")
end, end,
@ -125,4 +128,52 @@ return require('packer').startup(function(use)
end, end,
}) end, }) end,
} }
end)
-- Session Manager
use {
"olimorris/persisted.nvim",
config = function()
require("persisted").setup({
autoload = true,
before_save = function()
require('neo-tree.sources.manager').close('filesystem')
for _, term in pairs(require("toggleterm.terminal").get_all()) do
term:close()
end
end,
after_save = function()
require('neo-tree.sources.manager').show('filesystem')
end,
before_source = function()
require('neo-tree.sources.manager').close('filesystem')
end,
after_source = function()
require('neo-tree.sources.manager').show('filesystem')
-- Reload LSP
vim.lsp.stop_client(vim.lsp.get_active_clients())
end,
})
end,
}
-- Mini.nvim tools
use {
"echasnovski/mini.nvim",
config = function()
-- Trailing space highlighter
require("mini.trailspace").setup({
only_in_normal_buffers = true,
})
end,
}
-- LaTeX plugin
use "lervag/vimtex"
end,
config = {
display = {
open_fn = require('packer.util').float,
},
-- Let's reload manually
auto_reload_compiled = false,
}})

View file

@ -14,7 +14,7 @@ set $down j
set $up k set $up k
set $right l set $right l
# Your preferred terminal emulator # Your preferred terminal emulator
set $term alacritty set $term wezterm
# Your preferred application launcher # Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened # Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on. # on the original workspace that the command was run on.
@ -224,7 +224,7 @@ include /home/peter/.config/sway/local.d/*
output "*" bg $wallpaper fill output "*" bg $wallpaper fill
bindsym Ctrl+Mod1+l exec swaylock -i $wallpaper --clock --fade-in 1 --indicator --indicator-thickness 6 --ring-color ebdbb2 --inside-color 00000055 --key-hl-color 4d4d4d --line-uses-ring --separator-color 00000000 --text-color ebdbb2 --timestr "%H:%M" bindsym Ctrl+Mod1+l exec swaylock -i $wallpaper --indicator-thickness 6 --ring-color ebdbb2 --inside-color 00000055 --key-hl-color 4d4d4d --line-uses-ring --separator-color 00000000 --text-color ebdbb2
bindsym $mod+x exec bemenu-run | xargs swaymsg exec -- bindsym $mod+x exec bemenu-run | xargs swaymsg exec --
bindsym Print exec grimshot --notify save area bindsym Print exec grimshot --notify save area

View file

@ -1,5 +1,6 @@
# Pretend to be screen-256color # Force 256color terminal (with true color capabilities)
set-option -g default-terminal "screen-256color" set-option -g default-terminal "tmux-256color"
set -as terminal-features ",xterm-256color:RGB"
# Allow mouse input (to switch window / panes) # Allow mouse input (to switch window / panes)
set -g mouse on set -g mouse on

View file

@ -0,0 +1,7 @@
local wezterm = require("wezterm")
return {
color_scheme = "Gruvbox Dark",
font = wezterm.font("FiraCode Nerd Font Mono"),
font_size = 10.5,
enable_tab_bar = false, -- I use tmux
}