Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions nvim/.config/nvim/lua/toga/core/keybindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,11 @@ vim.api.nvim_set_keymap(
":MarkdownPreviewToggle<CR>",
{ noremap = true, silent = true, desc = "Toggle markdown preview" }
)

-- SwaggerPreview settings
vim.api.nvim_set_keymap(
"n",
"<Leader>sw",
":SwaggerPreviewToggle<CR>",
{ noremap = true, silent = true, desc = "Toggle Swagger preview" }
)
77 changes: 41 additions & 36 deletions nvim/.config/nvim/lua/toga/plugins/formatting.lua
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")

conform.setup({
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
svelte = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
liquid = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
},
})

vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 1000,
})
end, { desc = "Format file or range (in visual mode)" })
end,
conform.setup({
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
svelte = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
liquid = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
},
format_on_save = function(bufnr)
-- Disable formatting for Go files since go.nvim handles it
if vim.bo[bufnr].filetype == "go" then
return
end
return {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
}
end,
})
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 1000,
})
end, { desc = "Format file or range (in visual mode)" })
end,
}
26 changes: 26 additions & 0 deletions nvim/.config/nvim/lua/toga/plugins/go.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
return {
"ray-x/go.nvim",
dependencies = { -- optional packages
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
opts = {
-- lsp_keymaps = false,
-- other options
},
config = function(lp, opts)
require("go").setup(opts)
local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require("go.format").goimports()
end,
group = format_sync_grp,
})
end,
event = { "CmdlineEnter" },
ft = { "go", "gomod" },
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
}
6 changes: 6 additions & 0 deletions nvim/.config/nvim/lua/toga/plugins/swagger.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
return {
"vinnymeller/swagger-preview.nvim",
cmd = { "SwaggerPreview", "SwaggerPreviewStop", "SwaggerPreviewToggle" },
build = "npm i",
config = true,
}
3 changes: 3 additions & 0 deletions nvim/.config/nvim/lua/toga/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ return {
"c",
"rust",
"go",
"gomod",
"gowork",
"gosum",
},
incremental_selection = {
enable = true,
Expand Down
18 changes: 18 additions & 0 deletions scripts/.local/bin/tmux-dev-session.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
tmux kill-session -t coder 2>/dev/null

tmux new-session -s coder \; \
split-window -v -p 15 \; \
select-pane -t 2 \; \
split-window -h -p 67 \; \
split-window -h -p 50 \; \
select-pane -t 1 \; \
send-keys 'nvim .' Enter

# tmux new-session -s coder \; \
# split-window -v -p 90 \; \
# select-pane -t 1 \; \
# split-window -h -p 67 \; \
# split-window -h -p 50 \; \
# select-pane -t 4 \; \
# send-keys 'nvim .' Enter
20 changes: 20 additions & 0 deletions tmux/.config/tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel

# tmux-nvim-navigator
vim_pattern='(\\S+\\/)?g?\.?(view|l?n?vim?x?|fzf)(diff)?(-wrapped)?$'
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +${vim_pattern}'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"

bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l

bind H split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"

Expand Down
6 changes: 6 additions & 0 deletions wezterm/.config/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ config.keys = {
mods = "CMD|SHIFT",
action = wezterm.action.ReloadConfiguration,
},
-- CTRL+K to send string 'clear\n'
{
key = "k",
mods = "CTRL",
action = wezterm.action.SendString("clear\n"),
},
}

return config
9 changes: 9 additions & 0 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ alias t=talosctl
# kubernetes
alias k=kubectl

# Tmux
alias dev="tmux-dev-session.sh"

# Java stuff
DEV_TOOLS="/home/$USER/JavaInstall"
JAVA_HOME="$DEV_TOOLS/JDK/jdk-11.0.13+8"
Expand All @@ -118,3 +121,9 @@ export PYENV_ROOT="$HOME/.pyenv"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
# The following lines have been added by Docker Desktop to enable Docker CLI completions.
fpath=(/Users/toga/.docker/completions $fpath)
autoload -Uz compinit
compinit
# End of Docker CLI completions