Move everything under this repo instead of having separate ones
This commit is contained in:
parent
b4a65767fa
commit
f2b8400204
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
tmux/plugins/*
|
||||
!tmux/plugins/tpm
|
||||
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
[submodule "zsh/zsh-completions"]
|
||||
path = zsh/zsh-completions
|
||||
url = https://github.com/zsh-users/zsh-completions
|
||||
[submodule "zsh/zsh-history-substring-search"]
|
||||
path = zsh/zsh-history-substring-search
|
||||
url = https://github.com/zsh-users/zsh-history-substring-search
|
||||
[submodule "tmux/plugins/tpm"]
|
||||
path = tmux/plugins/tpm
|
||||
url = https://github.com/tmux-plugins/tpm
|
||||
@ -3,7 +3,6 @@
|
||||
email = ben@kree.gr
|
||||
signingkey = 1F33DAF2F49E4046
|
||||
[core]
|
||||
excludesfile = ~/.gitignore.global
|
||||
editor = nvim
|
||||
compression = 0
|
||||
packedGitLimit = 512m
|
||||
79
nvim/README.md
Normal file
79
nvim/README.md
Normal file
@ -0,0 +1,79 @@
|
||||
# kreeger's nvim configs
|
||||
|
||||
This repo contains my NeoVim configs, which I clone right to `~/.config/nvim`.
|
||||
Here's how things are structured.
|
||||
|
||||
## Explained
|
||||
|
||||
### Top-level (no plugins involved yet)
|
||||
|
||||
- `init.lua` is the thin start point: it sets the `leader` to my spacebar,
|
||||
disables `netrw`, and then `require()`'s 4 other configs, which have to live in
|
||||
the `lua` directory for the `require` statement to work like it does.
|
||||
- `lua/config/lazy_init.lua` loads [Lazy][lazy], my plugin manager of choice
|
||||
- `lua/config/settings.lua` includes my basic global Vim settings that would
|
||||
normally be in my `vimrc` files; stuff like line numbers, clipboard use, etc.
|
||||
- `lua/config/keymaps.lua` includes any keymappings related to global Vim
|
||||
behaviors, like quitting, diagnostics, focus moving, etc.
|
||||
- `lua/config/autocmds.lua` includes any auto-commands, which is pretty sparse
|
||||
at the moment, but does crucially have a fix to automatically ensure ".tf" files
|
||||
are read as `terraform` files (so that `terraform-ls` can start working right
|
||||
away)
|
||||
|
||||
I also have a `ftplugin` folder for any local-buffer settings that need to be
|
||||
run anytime a specific filetype is open (really basic things like tab-size
|
||||
settings).
|
||||
|
||||
### `lua/config/lazy/*.lua`: plugin town
|
||||
|
||||
This directory gets picked up by `lua/config/lazy_init.lua`, and loads a series
|
||||
of plugins in file order based on an ordering scheme I found in a YouTube video
|
||||
that now eludes me. But in a nutshell:
|
||||
|
||||
- `10-git.lua`: uses `gitsigns.nvim` for gutter markings and `lazygit.nvim` for
|
||||
an in-NeoVim experience leveraging [lazygit][lgit], my favorite git TUI
|
||||
- `20-which-key.lua`: anytime I strike a key in normal mode that's the beginning
|
||||
of a key sequence (my leader, or `g`, or `ctrl-w`), this opens a pane at the
|
||||
bottom of my editor to show me which keys are available next in the sequence and
|
||||
what they do. It's [`which-key.nvim`][whic] and it's amazing.
|
||||
- `30-fuzzyfinder.lua`: installs and configures `telescope.nvim`, which is a
|
||||
fuzzy-finder UI that lets me open files in a buffer quickly, or grep through my
|
||||
project, or do any number of things that use fuzzily-matched text as input.
|
||||
This powers a few additional plugins that come right after it:
|
||||
- `31-tree.lua`: installs `nvim-tree.lua` to give me a nice file explorer
|
||||
sidebar.
|
||||
- `32-terminal.lua`: installs `toggleterm.nvim` to give me in-nvim terminal
|
||||
windows, for when I don't want to use tmux or iTerm2 to manage a separate
|
||||
tab for me.
|
||||
- `40-lsp.lua`: the first of NeoVim's language-awareness powers. Installs
|
||||
`lazydev.nvim` (I'll be real honest, this only works with `lua` files and I
|
||||
don't know how necessary it is) and then the big one: `nvim-lspconfig`, which
|
||||
handles providing configuration files to a number of LSPs, all of which get
|
||||
installed using `mason.nvim` (a package manager for LSPs, if you will) and
|
||||
`mason-lspconfig`. There's a lot of stuff in this file that was pulled from...
|
||||
somebody else's repo? and a YouTube video? Honestly it's the file I've combed
|
||||
through the absolute least.
|
||||
- `41-autoformat.lua`: installs `confirm.nvim` for running formatters that get
|
||||
installed either as part of an LSP, or just the installed formatter itself
|
||||
(again, all installed and handled through `mason.nvim`). Format on save, and
|
||||
format on a key chord (leader-f, I think).
|
||||
- `42-autocomplete.lua`: installs and configures `blink.cmp` for showing
|
||||
completions (those completions all come from LSPs).
|
||||
- `50-colorscheme.lua`: [Catppuccin][catp], baby.
|
||||
- `60-comments.lua`: supercharge my comments by... giving me TODO highlights. I
|
||||
plan to expand on this more in the future, probably.
|
||||
- `80-mini.lua`: installs [`mini.nvim`][mini], a grab bag of tons of smaller Lua modules
|
||||
improving the NeoVim experience. I've barely scratched the surface on this
|
||||
one.
|
||||
- `99-treesitter.lua`: installs and configures `nvim-treesitter` which gives
|
||||
nvim the rest of its syntax-highlighting superpowers. Intentionally installed
|
||||
last for a specific reason I no longer recall.
|
||||
|
||||
And that's it, mostly. This is ever evolving and changing, so stay tuned for
|
||||
future updates.
|
||||
|
||||
[lazy]: https://github.com/folke/lazy.nvim
|
||||
[lgit]: https://github.com/jesseduffield/lazygit
|
||||
[whic]: https://github.com/folke/which-key.nvim
|
||||
[catp]: https://catppuccin.com
|
||||
[mini]: https://github.com/echasnovski/mini.nvim
|
||||
36
nvim/after/syntax/proguard.vim
Normal file
36
nvim/after/syntax/proguard.vim
Normal file
@ -0,0 +1,36 @@
|
||||
" Vim syntax file
|
||||
" Language: ProGuard configuration
|
||||
" Maintainer: David Reiss <dreiss@fb.com>
|
||||
" Version: 2
|
||||
|
||||
" Quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn region proguardComment start=/#/ end=/$/
|
||||
syn match proguardDirective "-keep[a-z,]*\>"
|
||||
syn match proguardDirective "-\(optimizations\|dontwarn\|assumenosideeffects\)\>"
|
||||
syn match proguardDirective "-\(dontshrink\|dontoptimize\|dontobfuscate\)\>"
|
||||
syn match proguardWildcard "\*"
|
||||
syn match proguardMembers "<\(fields\|methods\)>"
|
||||
|
||||
syn keyword javaType boolean char byte short int long float double
|
||||
syn keyword javaType void
|
||||
syn keyword javaStorageClass static transient final
|
||||
syn keyword javaScopeDecl public protected private abstract
|
||||
syn keyword javaClassDecl class enum
|
||||
syn keyword javaClassDecl extends implements interface
|
||||
syn match javaClassDecl "@interface\>"
|
||||
syn match javaAnnotation "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>"
|
||||
|
||||
hi def link proguardComment Comment
|
||||
hi def link proguardDirective Statement
|
||||
hi def link proguardWildcard Special
|
||||
hi def link proguardMembers Identifier
|
||||
hi def link javaStorageClass StorageClass
|
||||
hi def link javaScopeDecl javaStorageClass
|
||||
hi def link javaClassDecl javaStorageClass
|
||||
hi def link javaAnnotation PreProc
|
||||
|
||||
let b:current_syntax = "proguard"
|
||||
2
nvim/ftplugin/javascript.lua
Normal file
2
nvim/ftplugin/javascript.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
3
nvim/ftplugin/json.lua
Normal file
3
nvim/ftplugin/json.lua
Normal file
@ -0,0 +1,3 @@
|
||||
vim.bo.shiftwidth = 4
|
||||
vim.bo.expandtab = true
|
||||
vim.bo.filetype = "jsonc"
|
||||
4
nvim/ftplugin/lua.lua
Normal file
4
nvim/ftplugin/lua.lua
Normal file
@ -0,0 +1,4 @@
|
||||
vim.bo.tabstop = 4
|
||||
vim.bo.shiftwidth = 4
|
||||
vim.bo.softtabstop = 0
|
||||
vim.bo.expandtab = false
|
||||
1
nvim/ftplugin/markdown.lua
Normal file
1
nvim/ftplugin/markdown.lua
Normal file
@ -0,0 +1 @@
|
||||
vim.opt.textwidth = 80
|
||||
2
nvim/ftplugin/python.lua
Normal file
2
nvim/ftplugin/python.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.bo.shiftwidth = 4
|
||||
vim.bo.expandtab = true
|
||||
2
nvim/ftplugin/ruby.lua
Normal file
2
nvim/ftplugin/ruby.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
2
nvim/ftplugin/rust.lua
Normal file
2
nvim/ftplugin/rust.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.bo.shiftwidth = 4
|
||||
vim.bo.expandtab = true
|
||||
2
nvim/ftplugin/swift.lua
Normal file
2
nvim/ftplugin/swift.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.bo.shiftwidth = 4
|
||||
vim.bo.expandtab = true
|
||||
2
nvim/ftplugin/terraform.lua
Normal file
2
nvim/ftplugin/terraform.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
2
nvim/ftplugin/yaml.lua
Normal file
2
nvim/ftplugin/yaml.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
2
nvim/ftplugin/zsh.lua
Normal file
2
nvim/ftplugin/zsh.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.bo.shiftwidth = 4
|
||||
vim.bo.expandtab = true
|
||||
9
nvim/init.lua
Normal file
9
nvim/init.lua
Normal file
@ -0,0 +1,9 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
require("config.lazy_init")
|
||||
require("config.settings")
|
||||
require("config.keymaps")
|
||||
require("config.autocmds")
|
||||
27
nvim/lazy-lock.json
Normal file
27
nvim/lazy-lock.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
|
||||
"catppuccin": { "branch": "main", "commit": "a0c769bc7cd04bbbf258b3d5f01e2bdce744108d" },
|
||||
"conform.nvim": { "branch": "master", "commit": "b529dd4897c85c3188cc787084089a9d55843093" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "c2682b0d9732bf52cbc34862056f143e71dc4a6d" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" },
|
||||
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||
"mini.nvim": { "branch": "main", "commit": "5a10dfb3ab49b3ee2425bc2c215b5067ccce1c79" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "8adb3b5938f6074a1bcc36d3c3916f497d2e8ec4" },
|
||||
"nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "1c733e8c1957dc67f47580fe9c458a13b5612d5b" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
23
nvim/lua/config/autocmds.lua
Normal file
23
nvim/lua/config/autocmds.lua
Normal file
@ -0,0 +1,23 @@
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
desc = "Highlight when yanking (copying) text",
|
||||
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.hl.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||
desc = "Enforce Terraform filetype",
|
||||
pattern = { "*.tf" },
|
||||
callback = function()
|
||||
vim.opt.filetype = "terraform"
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||
desc = "Enforce ProGuard filetype",
|
||||
pattern = { "*.pro" },
|
||||
callback = function()
|
||||
vim.opt.filetype = "proguard"
|
||||
end,
|
||||
})
|
||||
11
nvim/lua/config/keymaps.lua
Normal file
11
nvim/lua/config/keymaps.lua
Normal file
@ -0,0 +1,11 @@
|
||||
-- [[ Basic Keymaps ]]
|
||||
|
||||
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
||||
vim.keymap.set("n", "<leader>f", vim.diagnostic.setloclist, { desc = "Open diagnostic quick[f]ix list" })
|
||||
vim.keymap.set("n", "<leader>q", "<cmd>q<CR>")
|
||||
vim.keymap.set("n", "<leader>Q", "<cmd>qa<CR>")
|
||||
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
||||
28
nvim/lua/config/lazy/10-git.lua
Normal file
28
nvim/lua/config/lazy/10-git.lua
Normal file
@ -0,0 +1,28 @@
|
||||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = false,
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>gs", "<cmd>LazyGit<cr>", desc = "LazyGit" },
|
||||
},
|
||||
},
|
||||
}
|
||||
47
nvim/lua/config/lazy/20-which-key.lua
Normal file
47
nvim/lua/config/lazy/20-which-key.lua
Normal file
@ -0,0 +1,47 @@
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VimEnter",
|
||||
opts = {
|
||||
delay = 0,
|
||||
icons = {
|
||||
mappings = vim.g.have_nerd_font,
|
||||
keys = vim.g.have_nerd_font and {} or {
|
||||
Up = "<Up> ",
|
||||
Down = "<Down> ",
|
||||
Left = "<Left> ",
|
||||
Right = "<Right> ",
|
||||
C = "<C-…> ",
|
||||
M = "<M-…> ",
|
||||
D = "<D-…> ",
|
||||
S = "<S-…> ",
|
||||
CR = "<CR> ",
|
||||
Esc = "<Esc> ",
|
||||
ScrollWheelDown = "<ScrollWheelDown> ",
|
||||
ScrollWheelUp = "<ScrollWheelUp> ",
|
||||
NL = "<NL> ",
|
||||
BS = "<BS> ",
|
||||
Space = "<Space> ",
|
||||
Tab = "<Tab> ",
|
||||
F1 = "<F1>",
|
||||
F2 = "<F2>",
|
||||
F3 = "<F3>",
|
||||
F4 = "<F4>",
|
||||
F5 = "<F5>",
|
||||
F6 = "<F6>",
|
||||
F7 = "<F7>",
|
||||
F8 = "<F8>",
|
||||
F9 = "<F9>",
|
||||
F10 = "<F10>",
|
||||
F11 = "<F11>",
|
||||
F12 = "<F12>",
|
||||
},
|
||||
},
|
||||
|
||||
-- Document existing key chains
|
||||
spec = {
|
||||
{ "<leader>s", group = "[S]earch" },
|
||||
{ "<leader>e", group = "[E]xplorer/Tree" },
|
||||
{ "<leader>t", group = "[T]oggle" },
|
||||
},
|
||||
},
|
||||
}
|
||||
66
nvim/lua/config/lazy/30-fuzzyfinder.lua
Normal file
66
nvim/lua/config/lazy/30-fuzzyfinder.lua
Normal file
@ -0,0 +1,66 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
cond = function()
|
||||
return vim.fn.executable("make") == 1
|
||||
end,
|
||||
},
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
enabled = vim.g.have_nerd_font,
|
||||
},
|
||||
"rcarriga/nvim-notify",
|
||||
"kdheepak/lazygit.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
pcall(require("telescope").load_extension, "notify")
|
||||
pcall(require("telescope").load_extension, "lazygit")
|
||||
|
||||
-- Define these keys here since they require access to runtime values
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
|
||||
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
|
||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
|
||||
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
|
||||
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||
|
||||
vim.keymap.set("n", "<leader>s/", function()
|
||||
builtin.live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end, { desc = "[S]earch [/] in Open Files" })
|
||||
|
||||
vim.keymap.set("n", "<leader>sn", function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end, { desc = "[S]earch [N]eovim files" })
|
||||
end,
|
||||
}
|
||||
17
nvim/lua/config/lazy/31-tree.lua
Normal file
17
nvim/lua/config/lazy/31-tree.lua
Normal file
@ -0,0 +1,17 @@
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
lazy = false,
|
||||
config = true,
|
||||
opts = {
|
||||
filters = {
|
||||
custom = { "^.git$" },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>et", "<cmd>NvimTreeToggle<CR>", desc = "[T]oggle Explorer" },
|
||||
{ "<leader>ee", "<cmd>NvimTreeFocus<CR>", desc = "Open [E]xplorer" },
|
||||
},
|
||||
}
|
||||
14
nvim/lua/config/lazy/32-terminal.lua
Normal file
14
nvim/lua/config/lazy/32-terminal.lua
Normal file
@ -0,0 +1,14 @@
|
||||
return {
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
config = true,
|
||||
cmd = "ToggleTerm",
|
||||
opts = {
|
||||
open_mapping = [["<leader>tt"]],
|
||||
direction = "horizontal",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>tt", "<cmd>ToggleTerm dir=git_dir<CR>", desc = "ToggleTerm: Toggle [t]erminal" },
|
||||
},
|
||||
},
|
||||
}
|
||||
197
nvim/lua/config/lazy/40-lsp.lua
Normal file
197
nvim/lua/config/lazy/40-lsp.lua
Normal file
@ -0,0 +1,197 @@
|
||||
return {
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
opts = {
|
||||
library = {
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
"saghen/blink.cmp",
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or "n"
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
end
|
||||
-- Rename the variable under your cursor.
|
||||
map("grn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
|
||||
-- Find references for the word under your cursor.
|
||||
map("grr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
map("gri", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
map("grd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
map("gO", require("telescope.builtin").lsp_document_symbols, "Open Document Symbols")
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
map("gW", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Open Workspace Symbols")
|
||||
-- Jump to the type of the word under your cursor.
|
||||
map("grt", require("telescope.builtin").lsp_type_definitions, "[G]oto [T]ype Definition")
|
||||
|
||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
||||
---@param client vim.lsp.Client
|
||||
---@param method vim.lsp.protocol.Method
|
||||
---@param bufnr? integer some lsp support methods only in specific files
|
||||
---@return boolean
|
||||
local function client_supports_method(client, method, bufnr)
|
||||
if vim.fn.has("nvim-0.11") == 1 then
|
||||
return client:supports_method(method, bufnr)
|
||||
else
|
||||
return client.supports_method(method, { bufnr = bufnr })
|
||||
end
|
||||
end
|
||||
|
||||
-- The following two autocommands are used to highlight references of the
|
||||
-- word under your cursor when your cursor rests there for a little while.
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if
|
||||
client
|
||||
and client_supports_method(
|
||||
client,
|
||||
vim.lsp.protocol.Methods.textDocument_documentHighlight,
|
||||
event.buf
|
||||
)
|
||||
then
|
||||
local highlight_augroup =
|
||||
vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
|
||||
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspDetach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- The following code creates a keymap to toggle inlay hints in your
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if
|
||||
client
|
||||
and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf)
|
||||
then
|
||||
map("<leader>th", function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
|
||||
end, "[T]oggle Inlay [H]ints")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Diagnostic Config
|
||||
-- See :help vim.diagnostic.Opts
|
||||
vim.diagnostic.config({
|
||||
severity_sort = true,
|
||||
float = { border = "rounded", source = "if_many" },
|
||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
signs = vim.g.have_nerd_font and {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
},
|
||||
} or {},
|
||||
virtual_text = {
|
||||
source = "if_many",
|
||||
spacing = 2,
|
||||
format = function(diagnostic)
|
||||
local diagnostic_message = {
|
||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||
}
|
||||
return diagnostic_message[diagnostic.severity]
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
local servers = {
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
--
|
||||
-- To check the current status of installed tools and/or manually install
|
||||
-- other tools, you can run
|
||||
-- :Mason
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
-- LSPs
|
||||
"json-lsp",
|
||||
"lua_ls",
|
||||
"ruby_lsp",
|
||||
"rubocop",
|
||||
"rust_analyzer",
|
||||
"terraformls",
|
||||
-- Formatters
|
||||
"fixjson",
|
||||
"goimports",
|
||||
"hclfmt",
|
||||
"prettierd",
|
||||
"shellharden",
|
||||
"stylua",
|
||||
"yamlfix",
|
||||
--- Linters
|
||||
"swiftlint",
|
||||
})
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||
automatic_enable = true,
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
49
nvim/lua/config/lazy/41-autoformat.lua
Normal file
49
nvim/lua/config/lazy/41-autoformat.lua
Normal file
@ -0,0 +1,49 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_format = "fallback" })
|
||||
end,
|
||||
mode = "",
|
||||
desc = "[F]ormat buffer",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
else
|
||||
return {
|
||||
timeout_ms = 2500,
|
||||
lsp_format = "fallback",
|
||||
}
|
||||
end
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
go = { "goimports", "gofmt" },
|
||||
hcl = { "terragrunt_hclfmt" },
|
||||
javascript = { "prettierd" },
|
||||
json = { "fixjson" },
|
||||
lua = { "stylua" },
|
||||
markdown = { "prettierd" },
|
||||
ruby = { "rubocop" },
|
||||
rust = { "rustfmt" },
|
||||
sh = { "shellharden" },
|
||||
swift = { "swiftlint" },
|
||||
terraform = { "terraform_fmt" },
|
||||
xml = { "xmllint" },
|
||||
yaml = { "yamlfix" },
|
||||
},
|
||||
formatters = {
|
||||
yamlfix = {
|
||||
prepend_args = { "-c", ".yamlfix.toml" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
38
nvim/lua/config/lazy/42-autocomplete.lua
Normal file
38
nvim/lua/config/lazy/42-autocomplete.lua
Normal file
@ -0,0 +1,38 @@
|
||||
return {
|
||||
"saghen/blink.cmp",
|
||||
event = "VimEnter",
|
||||
version = "1.*",
|
||||
dependencies = {
|
||||
"folke/lazydev.nvim",
|
||||
},
|
||||
--- @module 'blink.cmp'
|
||||
--- @type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
-- See `:help ins-completion`
|
||||
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
||||
-- <c-space>: Open menu or open docs if already open
|
||||
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
|
||||
-- <c-e>: Hide menu
|
||||
-- <c-k>: Toggle signature help
|
||||
preset = "super-tab",
|
||||
},
|
||||
|
||||
appearance = { nerd_font_variant = "mono" },
|
||||
|
||||
completion = {
|
||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = { "lsp", "path", "lazydev" },
|
||||
providers = {
|
||||
lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
|
||||
},
|
||||
},
|
||||
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
|
||||
signature = { enabled = true },
|
||||
},
|
||||
}
|
||||
43
nvim/lua/config/lazy/50-colorscheme.lua
Normal file
43
nvim/lua/config/lazy/50-colorscheme.lua
Normal file
@ -0,0 +1,43 @@
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
flavour = "auto",
|
||||
background = {
|
||||
light = "latte",
|
||||
dark = "mocha",
|
||||
},
|
||||
color_overrides = {
|
||||
mocha = {
|
||||
base = "#101018",
|
||||
},
|
||||
},
|
||||
integrations = {
|
||||
blink_cmp = true,
|
||||
diffview = true,
|
||||
mason = true,
|
||||
gitsigns = true,
|
||||
nvimtree = true,
|
||||
telescope = {
|
||||
enabled = true,
|
||||
},
|
||||
treesitter = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
inlay_hints = {
|
||||
background = true,
|
||||
},
|
||||
},
|
||||
which_key = true,
|
||||
notify = true,
|
||||
mini = {
|
||||
enabled = true,
|
||||
indentscope_color = "",
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
}
|
||||
6
nvim/lua/config/lazy/60-comments.lua
Normal file
6
nvim/lua/config/lazy/60-comments.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = { signs = false },
|
||||
}
|
||||
25
nvim/lua/config/lazy/80-mini.lua
Normal file
25
nvim/lua/config/lazy/80-mini.lua
Normal file
@ -0,0 +1,25 @@
|
||||
return {
|
||||
"echasnovski/mini.nvim",
|
||||
config = function()
|
||||
-- Examples:
|
||||
-- - va) - [V]isually select [A]round [)]paren
|
||||
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
||||
-- - ci' - [C]hange [I]nside [']quote
|
||||
require("mini.ai").setup({ n_lines = 500 })
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
--
|
||||
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
||||
-- - sd' - [S]urround [D]elete [']quotes
|
||||
-- - sr)' - [S]urround [R]eplace [)] [']
|
||||
require("mini.surround").setup()
|
||||
|
||||
local statusline = require("mini.statusline")
|
||||
statusline.setup({ use_icons = vim.g.have_nerd_font })
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return "%2l:%-2v"
|
||||
end
|
||||
end,
|
||||
}
|
||||
52
nvim/lua/config/lazy/99-treesitter.lua
Normal file
52
nvim/lua/config/lazy/99-treesitter.lua
Normal file
@ -0,0 +1,52 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
build = ":TSUpdate",
|
||||
main = "nvim-treesitter.configs",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"diff",
|
||||
"html",
|
||||
"jsonc",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"query",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { "ruby" },
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
disable = { "ruby" },
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = { query = "@function.outer", desc = "Select around function" },
|
||||
["if"] = { query = "@function.inner", desc = "Select inside of function" },
|
||||
["ac"] = { query = "@class.outer", desc = "Select around class" },
|
||||
["ic"] = { query = "@class.inner", desc = "Select inside class" },
|
||||
["as"] = { query = "@scope", query_group = "locals", desc = "Select around scope" },
|
||||
},
|
||||
selection_modes = {
|
||||
["@parameter.outer"] = "v",
|
||||
["@function.outer"] = "v",
|
||||
["@class.outer"] = "<c-v>",
|
||||
},
|
||||
include_surrounding_whitespace = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
14
nvim/lua/config/lazy_init.lua
Normal file
14
nvim/lua/config/lazy_init.lua
Normal file
@ -0,0 +1,14 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
error("Error cloning lazy.nvim:\n" .. out)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = "config.lazy",
|
||||
change_detection = { notify = false },
|
||||
})
|
||||
29
nvim/lua/config/settings.lua
Normal file
29
nvim/lua/config/settings.lua
Normal file
@ -0,0 +1,29 @@
|
||||
vim.g.have_nerd_font = true
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.mouse = "a"
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.opt.showmode = false
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
end)
|
||||
|
||||
vim.opt.breakindent = true
|
||||
vim.opt.undofile = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.updatetime = 250
|
||||
vim.opt.timeoutlen = 300
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { tab = "» ", trail = "○", nbsp = "␣", lead = "•" }
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.opt.inccommand = "split"
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.scrolloff = 5
|
||||
vim.opt.confirm = true
|
||||
vim.opt.virtualedit = "block"
|
||||
53
setup.sh
53
setup.sh
@ -2,53 +2,20 @@
|
||||
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
XDG_CONFIG_HOME=$HOME/.config
|
||||
|
||||
# Make sure $HOME/.config exists. It should, if we've been cloned there!
|
||||
if [[ ! -d "$HOME/.config" ]]; then
|
||||
mkdir -p "$HOME"/.config
|
||||
fi
|
||||
|
||||
# Clone ZSH configs.
|
||||
if [[ ! -d "$HOME/.config/zsh" ]]; then
|
||||
git clone --recurse-submodules https://git.kree.gr/kreeger/zshrc.git "$HOME"/.config/zsh
|
||||
# Make sure $HOME/.config exists.
|
||||
if [[ ! -d $XDG_CONFIG_HOME ]]; then
|
||||
mkdir -p "$XDG_CONFIG_HOME"
|
||||
fi
|
||||
|
||||
if [[ ! -a "$HOME/.zshrc" ]]; then
|
||||
ln -sfv "$HOME"/.config/zsh/zshrc "$HOME"/.zshrc
|
||||
ln -sfv "$SCRIPTPATH/zsh/zshrc" "$HOME"/.zshrc
|
||||
fi
|
||||
|
||||
# Clone nvim configs.
|
||||
if [[ ! -d "$HOME/.config/nvim" ]]; then
|
||||
git clone --recurse-submodules https://git.kree.gr/kreeger/nvimrc.git "$HOME"/.config/nvim
|
||||
fi
|
||||
|
||||
# Clone tmux configs.
|
||||
if [[ ! -d "$HOME/.config/tmux" ]]; then
|
||||
git clone --recurse-submodules https://git.kree.gr/kreeger/tmuxrc.git "$HOME"/.config/tmux
|
||||
fi
|
||||
|
||||
# Clone lazygit config.
|
||||
if [[ ! -a "$HOME/.config/lazygit/config.yml" ]]; then
|
||||
mkdir -p "$HOME/.config/lazygit"
|
||||
ln -sfv "$SCRIPTPATH/lazygit.yaml" "$HOME/.config/lazygit/config.yml"
|
||||
fi
|
||||
|
||||
# Link k9s config.
|
||||
if [[ ! -d "$HOME/.config/k9s" ]]; then
|
||||
ln -sfv "$SCRIPTPATH/k9s" "$HOME/.config/k9s"
|
||||
fi
|
||||
|
||||
# Link starship config.
|
||||
if [[ ! -a "$HOME/.config/starship/starship.toml" ]]; then
|
||||
mkdir -p "$HOME/.config/starship"
|
||||
ln -sfv "$SCRIPTPATH/starship.toml" "$HOME/.config/starship/starship.toml"
|
||||
fi
|
||||
|
||||
# Link dotfiles.
|
||||
declare -a dotfiles=("gemrc" "gitconfig" "gitignore.global")
|
||||
for file in "${dotfiles[@]}"
|
||||
do
|
||||
if [[ ! -a "$HOME/.$file" ]]; then
|
||||
ln -sfv "$SCRIPTPATH/$file" "$HOME/.$file"
|
||||
fi
|
||||
# Symlink directories to $XDG_CONFIG_HOME.
|
||||
directories=("gem" "git" "k9s" "lazygit" "nvim" "starship" "tmux")
|
||||
for directory in "${directories[@]}"; do
|
||||
if [[ -d "$XDG_CONFIG_HOME/$directory" ]]; then continue; fi
|
||||
ln -sfv "$SCRIPTPATH/$directory" "$XDG_CONFIG_HOME/$directory"
|
||||
done
|
||||
|
||||
1
tmux/plugins/tpm
Submodule
1
tmux/plugins/tpm
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946
|
||||
40
tmux/tmux.conf
Normal file
40
tmux/tmux.conf
Normal file
@ -0,0 +1,40 @@
|
||||
# Change leader to Ctrl-a
|
||||
set -g prefix ^A
|
||||
|
||||
# Enable mouse support
|
||||
set -g mouse on
|
||||
|
||||
# Ensure set-clipboard is on
|
||||
set -g set-clipboard on
|
||||
|
||||
# Number windows starting with 1, renumber them as they reorder
|
||||
set -g base-index 1
|
||||
set -g renumber-windows on
|
||||
|
||||
# Move status bar to the top
|
||||
set -g status-position top
|
||||
|
||||
# Catppuccin options
|
||||
set -g @catppuccin_window_status_style 'rounded'
|
||||
|
||||
# Fetch tmux plugin manager and plugins
|
||||
set -g @plugin 'catppuccin/tmux'
|
||||
run ~/.config/tmux/plugins/catppuccin/tmux/catppuccin.tmux
|
||||
|
||||
# Beautify the status line
|
||||
set -g status-left-length 100
|
||||
set -g status-left "#{E:@catppuccin_status_session}"
|
||||
|
||||
set -g status-right-length 100
|
||||
set -g status-right "#{E:@catppuccin_status_application}"
|
||||
set -agF status-right "#{E:@catppuccin_status_cpu}"
|
||||
set -agF status-right "#{@catppuccin_status_gitmux}"
|
||||
|
||||
# Then boot up TPM
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'tmux-plugins/tmux-yank'
|
||||
set -g @plugin 'tmux-plugins/tmux-cpu'
|
||||
set -g @plugin 'tmux-pluginx/tmux-battery'
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
run '~/.config/tmux/plugins/tpm/tpm'
|
||||
|
||||
6
zsh/README.md
Normal file
6
zsh/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# kreeger's zsh config
|
||||
|
||||
The files and submodules contained within are my zsh configuration "from
|
||||
scratch" (with some submodule-based plugins thrown in for good measure). I
|
||||
clone this to `$HOME/.config/zsh` or let [my dotfiles
|
||||
repo](https://git.kree.gr/kreeger/dotfiles) clone it for me.
|
||||
44
zsh/aliases.zsh
Normal file
44
zsh/aliases.zsh
Normal file
@ -0,0 +1,44 @@
|
||||
# dev aliases
|
||||
alias resource="source ~/.zshrc"
|
||||
alias mkdir="mkdir -p"
|
||||
|
||||
# git aliases
|
||||
alias gco="git checkout"
|
||||
alias gcl="git clone"
|
||||
alias gc="git commit -v -S"
|
||||
alias gs="git status"
|
||||
alias ga="git add"
|
||||
alias gd="git diff"
|
||||
alias gll="git pull"
|
||||
alias grc="git rebase --continue"
|
||||
|
||||
# docker aliases
|
||||
alias dc="docker compose"
|
||||
alias dcb="docker compose build"
|
||||
alias dcbp="docker compose build --pull"
|
||||
alias dcr="docker compose run --rm"
|
||||
alias dcu="docker compose up"
|
||||
|
||||
# terraform aliases
|
||||
alias tf="terraform"
|
||||
|
||||
# Wireguard CLI aliases
|
||||
alias vpnup="sudo wg-quick up wg0"
|
||||
alias vpndown="sudo wg-quick down wg0"
|
||||
|
||||
# Kubernetes aliases
|
||||
alias k="kubectl"
|
||||
|
||||
# Ansible aliases
|
||||
alias apb="ansible-playbook"
|
||||
alias av="ansible-vault"
|
||||
|
||||
# tool aliases
|
||||
if [[ -x "$(command -v nvim)" ]]; then
|
||||
alias vim="nvim"
|
||||
fi
|
||||
|
||||
if [[ -x "$(command -v highlight)" ]]; then
|
||||
alias ccat='highlight -O ansi --force'
|
||||
alias clat='highlight -lO ansi --force'
|
||||
fi
|
||||
7
zsh/cache/dotenv-allowed.list
vendored
Normal file
7
zsh/cache/dotenv-allowed.list
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/Users/bkreeger/src/kreeger/funnies-api
|
||||
/Users/bkreeger/src/kreeger/putty
|
||||
/Users/bkreeger/src/kreeger/terraform
|
||||
/Users/bkreeger/src/kreeger/synesthesia-core
|
||||
/Users/bkreeger/src/kreeger/bluelink
|
||||
/Users/bkreeger/src/kreeger/putty-legacy
|
||||
/Users/bkreeger/src/kreeger/passport
|
||||
0
zsh/cache/dotenv-disallowed.list
vendored
Normal file
0
zsh/cache/dotenv-disallowed.list
vendored
Normal file
68
zsh/dotenv.zsh
Normal file
68
zsh/dotenv.zsh
Normal file
@ -0,0 +1,68 @@
|
||||
## dotenv.zsh
|
||||
## Sustainably sourced from https://github.com/ohmyzsh/ohmyzsh/blob/0520c2e30934a6e01b27988dca5bbbe3511d6868/plugins/dotenv/dotenv.plugin.zsh
|
||||
|
||||
## Settings
|
||||
|
||||
# Filename of the dotenv file to look for
|
||||
: ${ZSH_DOTENV_FILE:=.env}
|
||||
|
||||
# Path to the file containing allowed paths
|
||||
: ${ZSH_CACHE_DIR:="${HOME}/.zsh/cache"}
|
||||
: ${ZSH_DOTENV_ALLOWED_LIST:="${ZSH_CACHE_DIR}/dotenv-allowed.list"}
|
||||
: ${ZSH_DOTENV_DISALLOWED_LIST:="${ZSH_CACHE_DIR}/dotenv-disallowed.list"}
|
||||
|
||||
|
||||
## Functions
|
||||
|
||||
source_env() {
|
||||
if [[ ! -f "$ZSH_DOTENV_FILE" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then
|
||||
local confirmation dirpath="${PWD:A}"
|
||||
|
||||
# make sure there is an allowlist
|
||||
touch "$ZSH_DOTENV_ALLOWED_LIST"
|
||||
touch "$ZSH_DOTENV_DISALLOWED_LIST"
|
||||
|
||||
# early return if disallowed
|
||||
if command grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
# check if current directory's .env file is allowed or ask for confirmation
|
||||
if ! command grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
|
||||
# get cursor column and print new line before prompt if not at line beginning
|
||||
local column
|
||||
echo -ne "\e[6n" > /dev/tty
|
||||
read -t 1 -s -d R column < /dev/tty
|
||||
column="${column##*\[*;}"
|
||||
[[ $column -eq 1 ]] || echo
|
||||
|
||||
# print same-line prompt and output newline character if necessary
|
||||
echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Allow it? ([Y]es/[n]o/[a]lways/n[e]ver) "
|
||||
read -k 1 confirmation
|
||||
[[ "$confirmation" = $'\n' ]] || echo
|
||||
|
||||
# check input
|
||||
case "$confirmation" in
|
||||
[nN]) return ;;
|
||||
[aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
|
||||
[eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;;
|
||||
*) ;; # interpret anything else as a yes
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
# test .env syntax
|
||||
zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
|
||||
|
||||
setopt localoptions allexport
|
||||
source $ZSH_DOTENV_FILE
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd source_env
|
||||
|
||||
source_env
|
||||
93
zsh/functions.zsh
Normal file
93
zsh/functions.zsh
Normal file
@ -0,0 +1,93 @@
|
||||
# git functions
|
||||
function git-branch-name() {
|
||||
git rev-parse --abbrev-ref HEAD
|
||||
}
|
||||
function git-current-remote() {
|
||||
git config branch.$(git-branch-name).remote
|
||||
}
|
||||
function grevs() {
|
||||
git rev-list --count $1..
|
||||
}
|
||||
function gri() {
|
||||
REVISION_COUNT=$(grevs $1)
|
||||
git rebase -iS HEAD~$REVISION_COUNT
|
||||
}
|
||||
function gp() {
|
||||
if [[ $(git-current-remote | head -c1 | wc -c) -ne 0 ]]; then
|
||||
git push $(git-current-remote) $(git-branch-name)
|
||||
else
|
||||
git push --set-upstream origin $(git-branch-name)
|
||||
fi
|
||||
}
|
||||
function gll() {
|
||||
REMOTE=${1:-$(git-current-remote)}
|
||||
git pull $REMOTE $(git-branch-name)
|
||||
}
|
||||
function gfp() {
|
||||
git push -f origin $(git-branch-name)
|
||||
}
|
||||
function gfu() {
|
||||
BRANCH=$(git-branch-name)
|
||||
git fetch upstream $BRANCH && git merge upstream/$BRANCH
|
||||
}
|
||||
function gtg=() {
|
||||
git tag -s $1 && gp && gp --tags
|
||||
}
|
||||
function git-prune-branches() {
|
||||
REMOTE=$1
|
||||
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep $REMOTE) | awk '{print $1}' | xargs git branch -d
|
||||
}
|
||||
|
||||
# kubernetes functions
|
||||
function k8s_ns_stuck() {
|
||||
NAMESPACE=$1
|
||||
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n $NAMESPACE
|
||||
}
|
||||
function k8s_ns_nuke() {
|
||||
NAMESPACE=$1
|
||||
kubectl get namespace "$NAMESPACE" -o json \
|
||||
| tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \
|
||||
| kubectl replace --raw /api/v1/namespaces/$NAMESPACE/finalize -f -
|
||||
}
|
||||
|
||||
# other functions
|
||||
function random_string() {
|
||||
head /dev/urandom | LC_ALL=C tr -dc 'A-Za-z0-9!#$%&()*+,-./:;<=>?@[\]^_`{|}~' | head -c $1
|
||||
}
|
||||
|
||||
# devcontainer aliases
|
||||
function devcup() {
|
||||
devcontainer up --workspace-folder .
|
||||
}
|
||||
function devcexec() {
|
||||
devcontainer exec --workspace-folder . $1
|
||||
}
|
||||
function devcshell() {
|
||||
devcexec /usr/bin/zsh
|
||||
}
|
||||
|
||||
# Dotfile update command(s)
|
||||
function update_dotfiles() {
|
||||
# Update zsh
|
||||
echo "Fetching latest ZSH."
|
||||
cd $HOME/.config/zsh
|
||||
git pull origin main > /dev/null 2>&1
|
||||
|
||||
# Update NeoVim
|
||||
echo "Fetching latest NeoVim."
|
||||
cd $HOME/.config/nvim
|
||||
git pull origin main > /dev/null 2>&1
|
||||
nvim --headless "+Lazy! install" +qa > /dev/null 2>&1
|
||||
nvim --headless "+Lazy! clean" +qa > /dev/null 2>&1
|
||||
|
||||
# Update tmux
|
||||
echo "Fetching latest tmux."
|
||||
cd $HOME/.config/tmux
|
||||
git pull origin main > /dev/null 2>&1
|
||||
|
||||
# Update my dotfiles
|
||||
echo "Fetching latest dotfiles."
|
||||
cd $HOME/.config/dotfiles
|
||||
git pull origin main > /dev/null 2>&1
|
||||
sh $HOME/.config/dotfiles/setup.sh > /dev/null 2>&1
|
||||
}
|
||||
7
zsh/license.md
Normal file
7
zsh/license.md
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright 2019 Ben Kreeger.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
1
zsh/linux.zsh
Normal file
1
zsh/linux.zsh
Normal file
@ -0,0 +1 @@
|
||||
alias ll="ls -Flah --color=always"
|
||||
7
zsh/mac.zsh
Normal file
7
zsh/mac.zsh
Normal file
@ -0,0 +1,7 @@
|
||||
alias ll="ls -FlaGh --color=always"
|
||||
alias rsyncdir="rsync -az --progress"
|
||||
|
||||
# Need to check what happens if this is not installed
|
||||
CERT_PATH=$(python -m certifi)
|
||||
export SSL_CERT_FILE=${CERT_PATH}
|
||||
export REQUESTS_CA_BUNDLE=${CERT_PATH}
|
||||
0
zsh/private.zsh.example
Normal file
0
zsh/private.zsh.example
Normal file
1
zsh/zsh-completions
Submodule
1
zsh/zsh-completions
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e07f6fb780725e9c0f50a7666700cf91ded30222
|
||||
1
zsh/zsh-history-substring-search
Submodule
1
zsh/zsh-history-substring-search
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 87ce96b1862928d84b1afe7c173316614b30e301
|
||||
121
zsh/zshrc
Normal file
121
zsh/zshrc
Normal file
@ -0,0 +1,121 @@
|
||||
# autoload and kickoff
|
||||
autoload -Uz colors vcs_info compinit
|
||||
compinit
|
||||
colors
|
||||
|
||||
# Make sure moving by whole word can stop at directories
|
||||
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
|
||||
ZSH_CACHE_DIR="$HOME/.cache/zsh"
|
||||
|
||||
# history support, time reporting, auto-cd
|
||||
HISTFILE=~/.zhistory
|
||||
HISTSIZE=5000
|
||||
SAVEHIST=5000
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt EXTENDED_HISTORY
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
setopt HIST_IGNORE_SPACE
|
||||
setopt AUTO_CD
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
SCRIPTPATH=$HOME/.config/dotfiles/zsh
|
||||
|
||||
# history substring search
|
||||
if [[ -a "$SCRIPTPATH/zsh-history-substring-search/zsh-history-substring-search.zsh" ]]; then
|
||||
source "$SCRIPTPATH/zsh-history-substring-search/zsh-history-substring-search.zsh"
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
fi
|
||||
|
||||
# extra autocompletions
|
||||
if [[ -a "$SCRIPTPATH/zsh-completions/zsh-completions.plugin.zsh" ]]; then
|
||||
fpath=($SCRIPTPATH/zsh-completions/src $fpath)
|
||||
fi
|
||||
|
||||
# google cloud sdk
|
||||
if [[ -a "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc" ]]; then
|
||||
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
|
||||
fi
|
||||
|
||||
if [[ -a "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" ]]; then
|
||||
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
|
||||
fi
|
||||
|
||||
# rust additions
|
||||
if [[ -a "$HOME/.cargo/bin" ]]; then
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
fi
|
||||
|
||||
# krew additions
|
||||
if [[ -a "$HOME/.krew" ]]; then
|
||||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
||||
fi
|
||||
|
||||
# pythonpath additions
|
||||
if [[ -a "$HOME/src/oreilly/tools/chassis" ]]; then
|
||||
export PYTHONPATH="${PYTHONPATH}:$HOME/src/oreilly/tools/chassis"
|
||||
fi
|
||||
|
||||
# Android SDK additions
|
||||
if [[ -a "$HOME/Library/Android/sdk/platform-tools" ]]; then
|
||||
export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH"
|
||||
fi
|
||||
|
||||
if [[ -a "$HOME/Library/Android/sdk/emulator" ]]; then
|
||||
export PATH="$HOME/Library/Android/sdk/emulator:$PATH"
|
||||
fi
|
||||
|
||||
# Local bin additions
|
||||
if [[ -d "$HOME/bin" ]]; then
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# homebrew
|
||||
if [[ -a "/opt/homebrew/bin/brew" ]]; then
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
fi
|
||||
|
||||
# starship
|
||||
if [[ -x "$(command -v starship)" ]]; then
|
||||
export STARSHIP_CONFIG="$HOME/.config/starship/starship.toml"
|
||||
eval "$(starship init zsh)"
|
||||
fi
|
||||
|
||||
# asdf
|
||||
if [[ -d "$HOME/.asdf/shims" ]]; then
|
||||
export PATH="$HOME/.asdf/shims:$PATH"
|
||||
fi
|
||||
if [[ -d "$HOME/.asdf/completions" ]]; then
|
||||
fpath=($HOME/.asdf/completions $fpath)
|
||||
fi
|
||||
|
||||
# plugins
|
||||
mkdir -p "$ZSH_CACHE_DIR"
|
||||
source "$SCRIPTPATH/dotenv.zsh"
|
||||
|
||||
# env
|
||||
export EDITOR=nvim
|
||||
export GOPATH=~/src/golang
|
||||
export GOBIN=$GOPATH/bin
|
||||
export PATH=~/bin:$GOBIN:$PATH
|
||||
export XDG_CONFIG_HOME=$HOME/.config
|
||||
if [[ -d "/opt/homebrew/share/google-cloud-sdk/bin" ]]; then
|
||||
export PATH=/opt/homebrew/share/google-cloud-sdk/bin:$PATH
|
||||
fi
|
||||
|
||||
# other files
|
||||
source "$SCRIPTPATH/functions.zsh"
|
||||
source "$SCRIPTPATH/aliases.zsh"
|
||||
|
||||
# private aliases
|
||||
if [[ -a "$SCRIPTPATH/private.zsh" ]]; then
|
||||
source $SCRIPTPATH/private.zsh
|
||||
fi
|
||||
|
||||
# What OS are we running?
|
||||
if [[ $(uname) == "Darwin" ]]; then
|
||||
source $SCRIPTPATH/mac.zsh
|
||||
else
|
||||
# Assume *nix of some kind
|
||||
source $SCRIPTPATH/linux.zsh
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user