50 Commits

Author SHA1 Message Date
ee7854eafc feat: Playing around with lazy-nvim and reworking my nvim config 2024-12-19 22:40:55 -05:00
ef961fcfa8 feat: Initial lazy nvim 2024-12-19 17:59:15 -05:00
6d44edc94d feat: Trying blink.cmp for completions, luasnips not playing nicely yet. 2024-12-19 17:20:06 -05:00
381d272da1 feat: Updates nvim scroll-off setting 2024-12-19 11:24:34 -05:00
38e77e8fcd feat: Trying blink.cmp for completions. 2024-12-19 11:20:54 -05:00
2a5c2cdc58 feat: Updates wezterm fps 2024-12-19 11:02:03 -05:00
0949f9e9fa feat: Adds local completions to zsh fpath 2024-12-17 14:21:49 -05:00
2c7bd9123f feat: Adds go to references to lsp config 2024-12-17 08:28:41 -05:00
f325d61131 feat: Updates tmux-sessionator to also open yazi in a 3rd window. 2024-12-15 19:24:48 -05:00
ae13738a4d feat: Updates tmux-sessionator to also create session properly when tmux isn't running. 2024-12-15 19:16:40 -05:00
6c84428179 feat: Updates nvim, fidget and removes neo-dev. 2024-12-15 18:52:28 -05:00
d27f2ad490 feat: LSP updates 2024-12-11 18:07:18 -05:00
ea7033bea8 feat: Adds yazi configuration to show hidden files and symlinks. 2024-12-09 12:27:09 -05:00
a835414bd1 feat: adds yazi config 2024-12-04 07:56:45 -05:00
82341d87df feat: Updates tmux-sessionator to accept a directory option and updates tns function to use that option. 2024-12-03 08:56:56 -05:00
9e48ba0a77 feat: Updates tmux-sessionator how it spawns the editor window so it doesn't kill the pane on exit. 2024-12-03 08:21:00 -05:00
3518ba059f feat: adds swift aliases. 2024-12-02 15:52:31 -05:00
c8e869c853 feat: Updates to zshrc and ansible config. 2024-12-02 08:19:59 -05:00
b1633707c2 feat: Updates to zsh env 2024-11-27 14:42:03 -05:00
5f45954d98 feat: Renames vault-gopass to vault-gopass-client 2024-11-27 10:03:41 -05:00
4fb2b70004 fix: Fixes ansible config and environment variables to utilize the vault-gopass-client file 2024-11-27 10:02:12 -05:00
a86116056f feat: Edits ansible config to use the vault-gopass script 2024-11-27 08:54:38 -05:00
f43cd2c543 feat: Finishes vault-gopass script 2024-11-27 08:47:45 -05:00
48d0e16f6a feat: Begins vault-gopass script 2024-11-27 07:53:26 -05:00
27d66acb6e feat: Adds tks alias to kill tmux session. 2024-11-26 18:16:44 -05:00
af77a986e2 feat: Adds moving to next and previous tmux windows using Alt-h or Alt-l 2024-11-25 09:16:07 -05:00
1dd7460ac4 feat: Adds <c-v> key binding to oil.nvim, also new spelling words 2024-11-24 21:29:15 -05:00
3badd6a046 fix: Fixes filetype plugins for nvim. 2024-11-23 15:26:33 -05:00
0a9e065b4d fix: Fixes some keymap collisions in nvim 2024-11-23 08:26:26 -05:00
8ac60b4196 feat: Adds note about keeping nvim settings at top of init.lua 2024-11-22 12:43:29 -05:00
7f26013d1c feat: Remove colliding keymaps between trouble.nvim and todo-comments.nvim, needs attention in the future 2024-11-22 12:08:11 -05:00
42cef6e0c4 feat: Adds more todo keymaps. 2024-11-22 12:02:10 -05:00
241c43767c feat: Update nvim-cmp and nvim spell 2024-11-22 09:06:16 -05:00
4b39a3eb95 feat: Adds highlight when yank in nvim config. 2024-11-21 22:40:48 -05:00
1e427911ac feat: Updates nvim-cmp 2024-11-21 21:21:28 -05:00
0c15983dae fix: tmux config 2024-11-21 19:45:14 -05:00
68d3f5a183 feat: Removes toggle terminal keymap that conflicts with trouble 2024-11-20 22:50:00 -05:00
d9ea8d80c6 fix: Fix merge conflicts 2024-11-20 22:07:02 -05:00
eed9c143ea feat: Updates zsh tns (tmux new session) function 2024-11-20 08:18:35 -05:00
d06648864e feat: Updates zsh config 2024-11-20 08:07:12 -05:00
9bb33cfaee feat: cleans up tmux config and updates to tmux-sessionator 2024-11-19 09:16:32 -05:00
917ac3ff2a feat: Updates to tmux config 2024-11-18 22:55:15 -05:00
23bd867430 feat: nvim config updates 2024-11-18 17:16:17 -05:00
2e3c750979 feat: Updates to nvim config and snippets 2024-11-18 08:33:38 -05:00
eff01f42fd feat: Working on snippets for nvim 2024-11-17 14:52:30 -05:00
8a17c5ad80 feat: Adds oil.nvim and removes neo-tree 2024-11-17 09:00:59 -05:00
d8891e40fc feat: More nvim plugins and changes, better xcodebuild experience. 2024-11-16 23:43:40 -05:00
f6f45a8c58 feat: Updates plugins for nvim 2024-11-16 11:38:43 -05:00
3b75e6e918 feat: Adds xcodebuild nvim plugin 2024-11-16 01:56:14 -05:00
2813d5b56d feat: Adds xcodebuild nvim plugin 2024-11-16 01:47:09 -05:00
74 changed files with 3127 additions and 1253 deletions

View File

@@ -161,7 +161,7 @@ home=~/.config/ansible
;bin_ansible_callbacks=False
# (tmppath) Temporary directory for Ansible to use on the controller.
local_tmp=~/.local/ansible/tmp
local_tmp=~/.local/share/ansible/tmp
# (list) List of logger names to filter out of the log file
;log_filter=
@@ -261,10 +261,10 @@ roles_path={{ ANSIBLE_HOME ~ "~/.local/ansible/roles:/roles:/usr/share/ansible/r
;vars_plugins={{ ANSIBLE_HOME ~ "/plugins/vars:/usr/share/ansible/plugins/vars" }}
# (string) The vault_id to use for encrypting by default. If multiple vault_ids are provided, this specifies which to use for encryption. The --encrypt-vault-id cli option overrides the configured value.
;vault_encrypt_identity=
vault_encrypt_identity=michael
# (string) The label to use for the default vault id label in cases where a vault id label is not provided
;vault_identity=default
vault_identity=michael
# (list) A list of vault-ids to use by default. Equivalent to multiple --vault-id args. Vault-ids are tried in order.
;vault_identity_list=
@@ -274,7 +274,7 @@ roles_path={{ ANSIBLE_HOME ~ "~/.local/ansible/roles:/roles:/usr/share/ansible/r
# (path) The vault password file to use. Equivalent to --vault-password-file or --vault-id
# If executable, it will be run and the resulting stdout will be used as the password.
vault_password_file=~/.local/ansible/.vaultpwd
vault_password_file=~/.local/share/scripts/vault-gopass-client
# (integer) Sets the default verbosity, equivalent to the number of ``-v`` passed in the command line.
;verbosity=0
@@ -982,4 +982,3 @@ cache_dir=~/.cache/ansible
# Setting this option to V(inventory) will only run the vars plugin after parsing inventory.
# If this option is omitted, the global C(RUN_VARS_PLUGINS) configuration is used to determine when to execute the vars plugin.
;stage=

8
nvim/lazynvim/.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
tt.*
.tests
doc/tags
debug
.repro
foo.*
*.log
data

View File

@@ -0,0 +1,15 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
}
}

201
nvim/lazynvim/LICENSE Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

4
nvim/lazynvim/README.md Normal file
View File

@@ -0,0 +1,4 @@
# 💤 LazyVim
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.

View File

@@ -0,0 +1,20 @@
-- Markdown specific key maps.
--
local todos = require("todo-comments")
local keywords = { "WARN", "WARNING", "IMPORTANT" }
-- Show all the warnings in the quick fix list.
vim.keymap.set(
"n",
"<leader>tw",
"<CMD>Trouble todo toggle filter = {tag = {WARN, IMPORTANT}}<CR>",
{ desc = "[T]odo [W]arnings" }
)
vim.keymap.set("n", "]w", function()
todos.jump_next({ keywords = keywords })
end, { desc = "Next [W]arning" })
vim.keymap.set("n", "[w", function()
todos.jump_prev({ keywords = keywords })
end, { desc = "Previous [W]arning" })

View File

@@ -0,0 +1,2 @@
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2

2
nvim/lazynvim/init.lua Normal file
View File

@@ -0,0 +1,2 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

View File

@@ -0,0 +1,14 @@
{
"extras": [
"lazyvim.plugins.extras.coding.luasnip",
"lazyvim.plugins.extras.editor.harpoon2",
"lazyvim.plugins.extras.formatting.prettier",
"lazyvim.plugins.extras.lang.ansible",
"lazyvim.plugins.extras.lang.clangd",
"lazyvim.plugins.extras.lang.docker"
],
"news": {
"NEWS.md": "10960"
},
"version": 7
}

View File

@@ -0,0 +1,50 @@
local defaultGroupOptions = { clear = true }
local markdownGroup = vim.api.nvim_create_augroup("MyMarkdownGroup", defaultGroupOptions)
local spellGroup = vim.api.nvim_create_augroup("SpellGroup", defaultGroupOptions)
local createCmd = vim.api.nvim_create_autocmd
-- Spell check
createCmd("BufEnter", {
pattern = { "*.md", "*.markdown", "*.txt", "*.tex" },
group = spellGroup,
callback = function(_)
vim.cmd.setlocal("textwidth=80")
vim.cmd.setlocal("spell spelllang=en_us")
end,
})
-- Markdown
createCmd("BufWritePost", {
pattern = { "*.md", "*.markdown" },
group = markdownGroup,
callback = function(_)
local cursor = vim.fn.getpos(".")
vim.cmd("FormatWrite")
vim.fn.setpos(".", cursor)
end,
})
-- Go
createCmd("BufWritePre", {
pattern = "*.go",
callback = function()
require("go.format").goimport()
end,
group = vim.api.nvim_create_augroup("GoFormat", defaultGroupOptions),
})
vim.api.nvim_exec2(
[[
autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile shada=""
]],
{}
)
-- Highlight when yanking.
createCmd("TextYankPost", {
desc = "Highlight when yanking text.",
group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})

View File

@@ -0,0 +1,46 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
local keymap = vim.keymap.set
local default_options = { noremap = true, silent = true }
local wk = require("which-key")
local wk_add = function(mode, keymaps)
wk.add(keymaps, { mode = mode, silent = true })
end
keymap("i", "jk", "<ESC>", default_options)
--------------------------------------------------------------------------------
-- Normal Mode
--------------------------------------------------------------------------------
wk_add("n", {
{ "<Left>", ":vertical resize +1<CR>", desc = "Resize Pane Left" },
{ "<Right>", ":vertical resize -1<CR>", desc = "Resize Pane Right" },
{ "<Up>", "resize -1<CR>", desc = "Resize Pane Up" },
{ "<Down>", "resize +1<CR>", desc = "Resize Pane Down" },
{ "<leader>n", "<CMD>:noh<CR>", desc = "[N]o highlighting" },
{ "<leader>s", "<CMD>:set spell!<CR>", desc = "[S]pell check toggle" },
{ "<C-s>", "<CMD>:write<CR>", desc = "[S]ave" },
{ "J", ":move .+1<CR>==", desc = "Move line down" },
{ "K", ":move .-2<CR>==", desc = "Move line up" },
{ "<leader>z", "<CMD>:ZenMode<CR>", desc = "[Z]en Mode" },
})
--------------------------------------------------------------------------------
-- Visual Mode
--------------------------------------------------------------------------------
vim.keymap.set("v", "K", ":move '<-2<CR>gv=gv", { desc = "Move selected block up.", silent = true, noremap = true })
vim.keymap.set("v", "J", ":move '>+1<CR>gv=gv", { desc = "Move selected block up.", silent = true, noremap = true })
-- Toggle term key maps, that get attached when terminal is opened.
function _G.set_terminal_keymaps()
local opts = { buffer = 0 }
keymap("t", "<esc>", [[<C-\><C-n>]], opts)
end
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")

View File

@@ -0,0 +1,53 @@
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
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View File

@@ -0,0 +1,72 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
--
local o = vim.opt
local wo = vim.wo
local fn = vim.fn
vim.cmd.set("inccommand=split")
o.filetype = "on"
o.updatetime = 500 -- faster completion
o.timeoutlen = 800 -- time to wait for a mapped sequence to complete (in milliseconds)
o.ttimeoutlen = 300 -- Time in milliseconds to wait for a key code sequence to complete
o.backup = false -- creates a backup file
o.swapfile = false -- enable/disable swap file creation
o.dir = fn.stdpath("data") .. "/swp" -- swap file directory
o.undofile = false -- enable/disable undo file creation
o.undodir = fn.stdpath("data") .. "/undodir" -- set undo directory
o.history = 500 -- Use the 'history' option to set the number of lines from command mode that are remembered.
o.hidden = true -- required to keep multiple buffers and open multiple buffers
o.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
o.fileencoding = "utf-8" -- the encoding written to a file
o.conceallevel = 0 -- so that `` is visible in markdown files
o.number = true -- set numbered lines
o.relativenumber = true -- set relative numbered lines
o.cmdheight = 1 -- space for displaying messages/commands
o.showmode = false -- we don't need to see things like -- INSERT -- anymore
o.showtabline = 2 -- always show tabs
o.laststatus = 2 -- The value of this option influences when the last window will have a status line (2 always)
o.smartcase = true -- smart case
o.smartindent = true -- make indenting smarter again
o.splitbelow = true -- force all horizontal splits to go below current window
o.splitright = true -- force all vertical splits to go to the right of current window
o.autoindent = true -- turn on auto indent.
o.expandtab = true -- convert tabs to spaces
o.smarttab = true -- turn on smart tab
o.shiftwidth = 2 -- the number of spaces inserted for each indentation
o.tabstop = 2 -- how many columns a tab counts for
o.termguicolors = true -- set term gui colors (most terminals support this)
o.cursorline = true -- highlight the current line
o.scrolloff = 20 -- Minimal number of screen lines to keep above and below the cursor
o.sidescrolloff = 5 -- The minimal number of columns to scroll horizontally
o.hlsearch = false -- highlight all matches on previous search pattern
o.ignorecase = true -- ignore case in search patterns
o.foldenable = false -- disable folding; enable with zi
o.foldmethod = "expr"
o.foldexpr = "nvim_treesitter#foldexpr()"
vim.cmd.set("nolist") -- don't show listchars.
-- o.listchars = "eol:¬,tab:>·,trail:~,extends:>,precedes:<"
o.listchars = "eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣"
o.shortmess = o.shortmess + "c" -- prevent "pattern not found" messages
wo.colorcolumn = "99999"
o.wildmode = "full"
o.lazyredraw = false -- do not redraw screen while running macros
o.grepprg = "rg --hidden --vimgrep --smart-case --"
o.completeopt = { "menu", "menuone", "noselect", "noinsert" } -- A comma separated list of options for Insert mode completion
o.wildignorecase = true -- When set case is ignored when completing file names and directories
o.wildignore = [[
.git,.hg,.svn
*.aux,*.out,*.toc
*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
*.mp3,*.oga,*.ogg,*.wav,*.flac
*.eot,*.otf,*.ttf,*.woff
*.doc,*.pdf,*.cbr,*.cbz
*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
*.swp,.lock,.DS_Store,._*
*/tmp/*,*.so,*.swp,*.zip,**/node_modules/**,**/target/**,**.terraform/**"
]]
o.viminfo = "" -- disable viminfo from copying information from current session, for security.
vim.g.snacks_animate = false

View File

@@ -0,0 +1,9 @@
return {
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{
"LazyVim/LazyVim",
opts = {
colorscheme = "catppuccin",
},
},
}

View File

@@ -0,0 +1,3 @@
return {
{ "nvim-neo-tree/neo-tree.nvim", enabled = false },
}

View File

@@ -0,0 +1,23 @@
return {
"j-hui/fidget.nvim",
event = "VeryLazy",
config = function()
local fidget = require("fidget")
fidget.setup({
notification = {
window = {
normal_hl = "String", -- Base highlight group in the notification window
winblend = 0, -- Background color opacity in the notification window
border = "rounded", -- Border around the notification window
zindex = 45, -- Stacking priority of the notification window
max_width = 0, -- Maximum width of the notification window
max_height = 0, -- Maximum height of the notification window
x_padding = 1, -- Padding from right edge of window boundary
y_padding = 1, -- Padding from bottom edge of window boundary
align = "bottom", -- How to align the notification window
relative = "editor", -- What the notification window position is relative to
},
},
})
end,
}

View File

@@ -0,0 +1,23 @@
return {
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
lua = { "stulua" },
markdown = {
"prettier",
prepend_args = {
"--print-width",
"100",
"--prose-wrap",
"always",
"--parser",
"markdown",
},
},
swift = { "swiftformat" },
-- ["*"] = {
-- require("formatter.filetypes.any").remove_trailing_whitespace,
-- },
},
},
}

View File

@@ -0,0 +1,78 @@
return {
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
opts = {
settings = {
save_on_toggle = true,
sync_on_ui_close = true,
},
},
keys = {
{
"<C-e>",
function()
require("harpoon").ui:toggle_quick_menu(require("harpoon"):list())
end,
desc = "Open Harpoon window.",
},
{
"<leader>a",
function()
require("harpoon"):list():add()
end,
desc = "[A]dd to the harpoon list.",
},
{
"<A-y>",
function()
require("harpoon"):list():select(1)
end,
desc = "Select first harpoon buffer.",
},
{
"<A-u>",
function()
require("harpoon"):list():select(2)
end,
desc = "Select second harpoon buffer.",
},
{
"<A-i>",
function()
require("harpoon"):list():select(3)
end,
desc = "Select third harpoon buffer.",
},
{
"<A-o>",
function()
require("harpoon"):list():select(4)
end,
desc = "Select fourth harpoon buffer.",
},
{
"<C-[>",
function()
require("harpoon"):list():prev()
end,
desc = "Previous harpoon buffer.",
},
{
"<C-]>",
function()
require("harpoon"):list():next()
end,
desc = "Next harpoon buffer.",
},
-- Extensions
require("harpoon"):extend({
UI_CREATE = function(cx)
vim.keymap.set("n", "<C-v>", function()
require("harpoon").ui:select_menu_item({ vsplit = true })
end, { buffer = cx.buffer, desc = "Open in [V]split" })
end,
}),
},
},
}

View File

@@ -0,0 +1,32 @@
-- Plugins that don't require much configuration are in here.
--
return {
{ import = "lazyvim.plugins.extras.lang.ansible" },
{ import = "lazyvim.plugins.extras.lang.cmake" },
{ import = "lazyvim.plugins.extras.lang.docker" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.markdown" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
{ import = "lazyvim.plugins.extras.coding.luasnip" },
{
import = "lazyvim.plugins.extras.editor.mini-files",
opts = {
options = {
use_as_default_explorer = true,
},
},
},
{
"folke/snacks.nvim",
opts = {
indent = { enabled = false },
},
},
{
import = "lazyvim.plugins.extras.coding.blink",
keymap = {
preset = "enter",
["<C-y>"] = { "select_and_accept" },
},
},
}

View File

@@ -0,0 +1,147 @@
return {
{
"williamboman/mason.nvim",
dependencies = {
"neovim/nvim-lspconfig",
},
opts = {
ensure_installed = {
"clangd",
"marksman",
"shfmt",
},
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"cmake",
"dockerfile",
"editorconfig",
"ini",
"json",
"jq",
"latex",
"make",
"swift",
},
},
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
opts = {
servers = {
bashls = {},
clangd = {},
dockerls = {},
gopls = {},
jsonls = {},
lua_ls = {},
marksman = {},
sourcekit = {},
yamlls = {},
},
setup = {
clangd = function(_, opts)
opts.capabilities.offsetEncoding = { "utf-16" }
end,
sourcekit = function(_, opts)
opts.cmd = {
vim.trim(vim.fn.system("xcrun -f sourcekit-lsp")) or nil
}
end
},
},
},
}
-- return {
-- "neovim/nvim-lspconfig",
-- event = { "BufReadPre", "BufNewFile" },
-- dependencies = {
-- "hrsh7th/cmp-nvim-lsp",
-- { "antosha417/nvim-lsp-file-operations", config = true },
-- "williamboman/mason.nvim",
-- "williamboman/mason-lspconfig.nvim",
-- {
-- "folke/lazydev.nvim",
-- ft = "lua",
-- opts = {
-- library = {
-- { path = "${3rd}/luv/library", words = { "vim%.uv" } },
-- },
-- },
-- },
-- },
-- config = function()
-- require("mason").setup()
-- require("mason-lspconfig").setup({
-- opts = {
-- ensure_installed = lsp_servers,
-- },
-- })
-- local lspconfig = require("lspconfig")
-- local cmp_nvim_lsp = require("cmp_nvim_lsp")
-- local capabilities = cmp_nvim_lsp.default_capabilities()
-- local opts = { noremap = true, silent = true }
-- local on_attach = function(_, bufnr)
-- opts.buffer = bufnr
--
-- opts.desc = "Show line diagnostics"
-- vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
--
-- opts.desc = "Show diagnostics in Telescope"
-- vim.keymap.set("n", "<leader><leader>d", "<CMD>Telescope diagnostics bufnr=0<CR>", opts)
--
-- opts.desc = "Show documentation for what is under cursor"
-- vim.keymap.set("n", "<C-k>", vim.lsp.buf.hover, opts)
--
-- opts.desc = "[G]oto [D]efinition"
-- vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions trim_text=true<cr>", opts)
--
-- opts.desc = "[G]oto [D]eclaration"
-- vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
--
-- opts.desc = "LSP [C]ode [A]ction"
-- vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
--
-- --opts.desc = "[R]e-[N]ame"
-- --vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
--
-- opts.desc = "[R]eload or start LSP"
-- vim.keymap.set("n", "<leader>rl", ":LspRestart | :LspStart<CR>", opts)
--
-- opts.desc = "Goto previous diagnostic"
-- vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
--
-- opts.desc = "Goto next diagnostic"
-- vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
-- end
--
-- for _, lsp in ipairs(lsp_servers) do
-- lspconfig[lsp].setup({
-- capabilities = capabilities,
-- on_attach = on_attach,
-- on_init = function(client)
-- -- HACK: to fix some issues with LSP
-- -- more details: https://github.com/neovim/neovim/issues/19237#issuecomment-2237037154
-- client.offset_encoding = "utf-8"
-- end,
-- cmd = lsp == "sourcekit" and { vim.trim(vim.fn.system("xcrun -f sourcekit-lsp")) } or nil,
-- })
-- end
--
-- -- nice icons
-- local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " }
-- for type, icon in pairs(signs) do
-- local hl = "DiagnosticSign" .. type
-- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
-- end
--
-- -- For some reason I was having trouble getting this to work inside the on-attach, so it's here.
-- vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "[R]e-[N]ame" })
-- end,
-- }

View File

@@ -0,0 +1,39 @@
return {
{
"L3MON4D3/LuaSnip",
opts = function()
LazyVim.cmp.actions.snippet_forward = function()
if require("luasnip").jumpable(1) then
require("luasnip").jump(1)
return true
end
end
LazyVim.cmp.actions.snippet_stop = function()
if require("luasnip").expand_or_jumpable() then -- or just jumpable(1) is fine?
require("luasnip").unlink_current()
return true
end
end
end,
keys = {
{
"<C-k>",
mode = { "i", "s" },
function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end
},
{
"<C-j>",
mode = { "i", "s" },
function()
if ls.jumpable(-1) then
ls.jump(-1)
end
end
},
},
},
}

View File

@@ -0,0 +1,36 @@
return {
"stevearc/oil.nvim",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
columns = { "icon" },
keymaps = {
["<C-h>"] = false,
["<M-h>"] = "actions.select_split",
["<C-v>"] = {
"actions.select",
opts = { vertical = true },
desc = "Open the entry in a vertical split",
},
view_options = {
is_hidden_file = function(name, _) -- second arg is bufnr, but not currently used.
-- Don't show .DS_Store in output.
local is_ds_store = name ~= ".DS_Store"
return not is_ds_store
end,
},
}
},
keys = {
-- Show the parent directory in current window.
{ "-", "<CMD>Oil<CR>", desc = "Open parent directory." },
-- Open parent directory in floating window.
{
"<space>-",
function() require("oil").toggle_float() end,
desc = "Open parent directory in floating window."
},
},
}

View File

@@ -0,0 +1,10 @@
return {
{
import = "lazyvim.plugins.extras.editor.telescope",
opts = {
ensure_installed = {
"swift",
},
},
},
}

View File

@@ -0,0 +1,14 @@
return {
"folke/todo-comments.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"folke/trouble.nvim",
},
keys = {
{ "<leader>xt", false },
{ "<leader>xT", false },
{ "<leader>tq", "<CMD>Trouble todo toggle<CR>", desc = "[T]odo [Q]uick fix list." },
{ "<leader><leader>t", "<CMD>TodoTelescope<CR>", desc = "[T]odo telescope list." },
{ "<leader>tl", "<CMD>TodoLocList<CR>", desc = "[T]odo [L]ocation list." },
},
}

View File

@@ -0,0 +1,73 @@
local progress_handle
return {
"wojciech-kulik/xcodebuild.nvim",
event = "VeryLazy",
dependencies = {
"nvim-telescope/telescope.nvim",
"MunifTanjim/nui.nvim",
},
opts = {
show_build_progress_bar = false,
logs = {
auto_open_on_success_tests = false,
auto_open_on_failed_tests = false,
auto_open_on_success_build = false,
auto_open_on_failed_build = false,
auto_focus = false,
auto_close_on_app_launch = true,
only_summary = true,
notify = function(message, severity)
local fidget = require("fidget")
if progress_handle then
progress_handle.message = message
if not message:find("Loading") then
progress_handle:finish()
progress_handle = nil
if vim.trim(message) ~= "" then
fidget.notify(message, severity)
end
end
else
fidget.notify(message, severity)
end
end,
notify_progress = function(message)
local progress = require("fidget.progress")
if progress_handle then
progress_handle.title = ""
progress_handle.message = message
else
progress_handle = progress.handle.create({
message = message,
lsp_client = { name = "xcodebuild.nvim" },
})
end
end,
},
code_coverage = {
enabled = true,
},
},
keys = {
{ "<leader>X", "<cmd>XcodebuildPicker<cr>", desc = "Show Xcodebuild Actions" },
{ "<leader>xf", "<cmd>XcodebuildProjectManager<cr>", desc = "Show Project Manager Actions" },
{ "<leader>xb", "<cmd>XcodebuildBuild<cr>", desc = "Build Project" },
{ "<leader>xB", "<cmd>XcodebuildBuildForTesting<cr>", desc = "Build For Testing" },
{ "<leader>xr", "<cmd>XcodebuildBuildRun<cr>", desc = "Build & Run Project" },
{ "<leader>xt", "<cmd>XcodebuildTest<cr>", desc = "Run Tests" },
{ "<leader>xt", "<cmd>XcodebuildTestSelected<cr>", desc = "Run Selected Tests" },
{ "<leader>xT", "<cmd>XcodebuildTestClass<cr>", desc = "Run This Test Class" },
{ "<leader>xl", "<cmd>XcodebuildToggleLogs<cr>", desc = "Toggle Xcodebuild Logs" },
{ "<leader>xc", "<cmd>XcodebuildToggleCodeCoverage<cr>", desc = "Toggle Code Coverage" },
{ "<leader>xC", "<cmd>XcodebuildShowCodeCoverageReport<cr>", desc = "Show Code Coverage Report" },
{ "<leader>xe", "<cmd>XcodebuildTestExplorerToggle<cr>", desc = "Toggle Test Explorer" },
{ "<leader>xs", "<cmd>XcodebuildFailingSnapshots<cr>", desc = "Show Failing Snapshots" },
{ "<leader>xd", "<cmd>XcodebuildSelectDevice<cr>", desc = "Select Device" },
{ "<leader>xp", "<cmd>XcodebuildSelectTestPlan<cr>", desc = "Select Test Plan" },
{ "<leader>xq", "<cmd>Telescope quickfix<cr", desc = "Show QuickFix List" },
{ "<leader>xx", "<cmd>XcodebuildQuickfixLine<cr>", desc = "Quickfix Line" },
{ "<leader>xa", "<cmd>XcodebuildCodeActions<cr>", desc = "Show Code Actions" },
},
}

View File

@@ -1,4 +1,5 @@
local ls = require('luasnip')
-- Setup snippets here.
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local ms = ls.multi_snippet
@@ -7,3 +8,10 @@ local f = ls.function_node
local c = ls.choice_node
local t = ls.text_node
ls.add_snippets("lua", {
s("hello", {
t('print("hello '),
i(1),
t(' world")'),
}),
})

View File

@@ -0,0 +1,34 @@
-- Setup snippets here.
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local ms = ls.multi_snippet
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local t = ls.text_node
ls.add_snippets("lua", {
-- Setup a new snippet file.
s("sf", {
t({
"-- Setup snippets.",
'local ls = require("luasnip")',
"local s = ls.snippet",
"local sn = ls.snippet_node",
"local ms = ls.multi_snippet",
"local i = ls.insert_node",
"local f = ls.function_node",
"local c = ls.choice_node",
"local t = ls.text_node",
"-- Add snippets",
}),
t('ls.add_snippets("'),
i(1, "<file-type>"),
t({
'", {',
"\t-- Define snippets here.",
"})",
}),
}),
})

View File

@@ -0,0 +1,131 @@
-- Setup snippets.
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local ms = ls.multi_snippet
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local t = ls.text_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
-- Add snippets
ls.add_snippets("swift", {
-- Add a dependency snippet.
s({ trig = "@d", desc = "Add a dependency." }, fmt("@Dependency(\\.{}) var {}", { i(1), rep(1) })),
-- Add a dependency client.
s(
{
trig = "@dc",
desc = "Add a dependency client.",
},
fmt(
[[
public extension DependencyValues {{
var {}: {} {{
get {{ self[{}.self] }}
set {{ self[{}.self] = newValue }}
}}
}}
@DependencyClient
public struct {} {{
// Insert interface here.
{}
}}
extension {}: TestDependencyKey {{
public static let testValue: {} = Self()
}}
]],
{
i(1, "<name>"),
i(2, "<Dependency>"),
rep(2),
rep(2),
rep(2),
i(0),
rep(2),
rep(2),
}
)
),
s(
{ trig = "str", desc = "Add a struct" },
fmt(
[[
struct {}: {} {{
{}
}}
]],
{ i(1, "<Name>"), i(2, "<Protocols>"), i(0) }
)
),
-- Decorate a type or function with an @_spi(...)
s({ trig = "@_s", desc = "Add spi modifier." }, fmt("@_spi({})", { i(1, "name") })),
-- Add an @_spi(...) import ...
s(
{ trig = "@_si", desc = "Import with spi." },
fmt(
[[
@_spi({}) import {}
{}
]],
{ i(1, "name"), i(2, "module"), i(0) }
)
),
-- Document a function
-- TODO: add dynamic number of prameters.
s(
{ trig = "docf", desc = "Document a function." },
fmt(
[[
/// {}
///
/// - Parameters:
/// - {}: {}
]],
{ i(1, "A short description."), i(2, "<param>"), i(3, "Describe the parameter.") }
)
),
-- Add a parameter to a documentation string.
s(
{ trig = "param", desc = "Add a parameter to documentation" },
fmt(
[[
/// - {}: {}
]],
{ i(1, "<param>"), i(2, "<description>") }
)
),
-- Add a withDependencies
s(
{ trig = "wd", desc = "withDependencies" },
fmt(
[[
withDependencies {{
$0.{} = {}
}} operation: {{
@Dependency(\.{}) var {}
{}
}}
]],
{
i(1, "<dependency>"),
i(2, "<override>"),
rep(1),
rep(1),
i(0),
}
)
),
})

View File

@@ -0,0 +1,16 @@
MeasureQuick
Housh
sealtite
Subcool
OEM
NEC
AHJ
CFM
Hydronic
subpar
quo
IAQ
wc
HVAC
dehumidification
ansible

Binary file not shown.

View File

@@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120

View File

@@ -0,0 +1,20 @@
-- Markdown specific key maps.
--
local todos = require("todo-comments")
local keywords = { "WARN", "WARNING", "IMPORTANT" }
-- Show all the warnings in the quick fix list.
vim.keymap.set(
"n",
"<leader>tw",
"<CMD>Trouble todo toggle filter = {tag = {WARN, IMPORTANT}}<CR>",
{ desc = "[T]odo [W]arnings" }
)
vim.keymap.set("n", "]w", function()
todos.jump_next({ keywords = keywords })
end, { desc = "Next [W]arning" })
vim.keymap.set("n", "[w", function()
todos.jump_prev({ keywords = keywords })
end, { desc = "Previous [W]arning" })

View File

@@ -0,0 +1,2 @@
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2

View File

@@ -2,19 +2,21 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Auto commands
require('user.autocmd')
-- Plugins
require('user.plugins')
-- Key maps
require('user.keymaps')
-- Theme (must stay after plugins are loaded)
require('user.theme')
-- NOTE: Keep settings at the top, otherwise some options don't work well.
-- mainly have had trouble with not using the settings in an `.editorconfig`
-- file for projects.
-- Common settings
require('user.settings')
require("user.settings")
vim.o.shiftwidth = 2
-- Auto commands
require("user.autocmd")
-- Plugins
require("user.plugins")
-- Key maps
require("user.keymaps")
-- Theme (must stay after plugins are loaded)
require("user.theme")

View File

@@ -1,85 +1,50 @@
local defaultGroupOptions = { clear = true }
local markdownGroup = vim.api.nvim_create_augroup("MyMarkdownGroup", defaultGroupOptions)
local spellGroup = vim.api.nvim_create_augroup('SpellGroup', defaultGroupOptions)
local spellGroup = vim.api.nvim_create_augroup("SpellGroup", defaultGroupOptions)
local createCmd = vim.api.nvim_create_autocmd
local swiftGroup = vim.api.nvim_create_augroup('swift_lsp', { clear = true })
-- Remove all trailing whitespace on save
vim.api.nvim_exec([[
augroup TrimWhiteSpace
au!
autocmd BufWritePre * :%s/\s\+$//e
augroup END
]], false)
-- Prevent new line to also start with a comment
vim.api.nvim_exec([[
augroup NewLineComment
au!
au FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
augroup END
]], false)
-- Spell check
createCmd(
"BufEnter",
{
pattern = { '*.md', '*.markdown', '*.txt', '*.tex' },
createCmd("BufEnter", {
pattern = { "*.md", "*.markdown", "*.txt", "*.tex" },
group = spellGroup,
callback = function(_)
vim.cmd.setlocal('textwidth=80')
vim.cmd.setlocal('spell spelllang=en_us')
vim.cmd.setlocal("textwidth=80")
vim.cmd.setlocal("spell spelllang=en_us")
end,
}
)
})
-- Markdown
createCmd(
"BufWritePost",
{
createCmd("BufWritePost", {
pattern = { "*.md", "*.markdown" },
group = markdownGroup,
callback = function(_)
local cursor = vim.fn.getpos('.')
local cursor = vim.fn.getpos(".")
vim.cmd("FormatWrite")
vim.fn.setpos('.', cursor)
vim.fn.setpos(".", cursor)
end,
}
)
})
-- Go
createCmd(
"BufWritePre",
{
createCmd("BufWritePre", {
pattern = "*.go",
callback = function()
require('go.format').goimport()
require("go.format").goimport()
end,
group = vim.api.nvim_create_augroup("GoFormat", defaultGroupOptions)
}
group = vim.api.nvim_create_augroup("GoFormat", defaultGroupOptions),
})
vim.api.nvim_exec2(
[[
autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile shada=""
]],
{}
)
vim.api.nvim_exec([[
autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile shada=""
]], false)
-- Swift
-- createCmd(
-- "FileType",
-- {
-- pattern = { 'swift' },
-- callback = function()
-- local root_dir = vim.fs.dirname(vim.fs.find({
-- "Package.swift",
-- ".git",
-- }, { upward = true })[1])
-- local client = vim.lsp.start({
-- name = "sourcekit-lsp",
-- cmd = { "sourcekit-lsp" },
-- root_dir = root_dir
-- })
-- vim.lsp.buf_attach_client(0, client)
-- end,
-- group = swiftGroup
-- }
-- )
-- Highlight when yanking.
createCmd("TextYankPost", {
desc = "Highlight when yanking text.",
group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})

View File

@@ -3,26 +3,19 @@ vim.g.maplocalleader = " "
local keymap = vim.keymap.set
local default_options = { noremap = true, silent = true }
local telescope = require('telescope.builtin')
local wk = require("which-key")
local wk_add = function(mode, keymaps)
wk.add(keymaps, { mode = mode, silent = true })
end
local find_files = function(dir)
return function()
telescope.find_files({ cwd = dir, hidden = true, no_ignore = true })
end
end
--------------------------------------------------------------------------------
-- Insert Mode
--------------------------------------------------------------------------------
-- easier escape key mapping
keymap('i', 'jk', '<ESC>', default_options)
keymap("i", "jk", "<ESC>", default_options)
wk_add("i", {
{ "<C-s>", "<ESC>:write<CR>a", desc = "[S]ave" }
{ "<C-s>", "<ESC>:write<CR>a", desc = "[S]ave" },
})
--------------------------------------------------------------------------------
@@ -36,85 +29,24 @@ wk_add("n", {
{ "<leader>n", "<CMD>:noh<CR>", desc = "[N]o highlighting" },
{ "<leader>s", "<CMD>:set spell!<CR>", desc = "[S]pell check toggle" },
{ "<C-n>", "<CMD>:Neotree toggle<CR>", desc = "Toggle Neotree" },
{ "<C-s>", "<CMD>:write<CR>", desc = "[S]ave" },
{ "J", ":move .+1<CR>==", desc = "Move line down" },
{ "K", ":move .-2<CR>==", desc = "Move line up" },
-- Git
{ "<leader>gg", ":LazyGit<CR>", desc = "Open [G]it" },
{ "<leader>gf", ":Telescope git_files<CR>", desc = "Find [G]it [F]ile" },
{ "<leader>t", ":ToggleTerm<CR>", desc = "Open [T]erminal" },
-- Telescope keymaps
{ "<leader>ff", telescope.find_files, desc = "[F]ind [F]iles" },
{ "<leader>fg", telescope.live_grep, desc = "[F]ind [G]rep" },
{ "<leader>fb", telescope.buffers, desc = "[F]ind [B]uffers" },
{ "<leader>fh", telescope.help_tags, desc = "[F]ind [H]elp" },
{ "<leader>fd", find_files('$DOTFILES'), desc = "[F]ind [D]otfiles" },
{ "<leader>fn", find_files('$DOTFILES/nvim/m-housh'), desc = "[F]ind [N]vim file" },
{ "<leader>fs", find_files('$DOTFILES/scripts/scripts'), desc = "[F]ind [S]cript" },
{ "<leader>fz", find_files('$DOTFILES/zsh/config'), desc = "[F]ind [Z]sh config file" },
{ "<leader>z", "<CMD>:ZenMode<CR>", desc = "[Z]en Mode" },
})
--------------------------------------------------------------------------------
-- Visual Mode
--------------------------------------------------------------------------------
-- wk_add("v", {
-- { "p", "\"_dP", desc = "[P]aste" },
-- })
-- wk_add("v", {
-- { "K", ":move '<-2<CR>", desc = "Move selected block up" },
-- { "J", ":move '>+1<CR>", desc = "Move selected block down" },
-- })
vim.keymap.set(
"v", "K",
":move '<-2<CR>gv=gv",
{ desc = "Move selected block up.", silent = true, noremap = true }
)
vim.keymap.set(
"v", "J",
":move '>+1<CR>gv=gv",
{ desc = "Move selected block up.", silent = true, noremap = true }
)
vim.keymap.set("v", "K", ":move '<-2<CR>gv=gv", { desc = "Move selected block up.", silent = true, noremap = true })
vim.keymap.set("v", "J", ":move '>+1<CR>gv=gv", { desc = "Move selected block up.", silent = true, noremap = true })
-- Toggle term key maps, that get attached when terminal is opened.
function _G.set_terminal_keymaps()
local opts = { buffer = 0 }
keymap('t', '<esc>', [[<C-\><C-n>]], opts)
keymap("t", "<esc>", [[<C-\><C-n>]], opts)
end
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
-- LuaSnip Keymaps
--local ls = require('luasnip')
-- <c-k> to expand snippets.
-- This will expand the snippet or jump to the next item within the snippet.
-- vim.keymap.set({ "i", "s" }, "<c-k>", function()
-- if ls.expand_or_jumpable() then
-- ls.expand_or_jump()
-- end
-- end, { silent = true })
-- <c-j>
-- This will jump backwards in the snippet.
-- vim.keymap.set({ "i", "s" }, "<c-j>", function()
-- if ls.jumpable(-1) then
-- ls.jump(-1)
-- end
-- end, { silent = true })
-- <c-l>
-- This is for selecting withing a list of options.
-- vim.keymap.set("i", "<c-l>", function()
-- if ls.choice_active() then
-- ls.change_choice(1)
-- end
-- end, { silent = true })
-- Reload the snippets.
--vim.keymap.set("n", "<leader><leader>s", "<cmd>source ~/.config/m-housh/lua/snippets/init.lua<cr>")
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")

View File

@@ -0,0 +1,58 @@
return {
{
"saghen/blink.cmp",
enabeld = false,
dependencies = {
"rafamadriz/friendly-snippets",
--"L3MON4D3/LuaSnip",
},
version = "v0.*",
opts = {
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = "mono",
},
signature = { enabled = true },
keymap = {
preset = "default",
["<CR>"] = { "accept", "fallback" },
["<C-space>"] = {
function(cmp)
cmp.show({ providers = { "snippets" } })
end,
},
--["<C-k>"] = { "select_prev", "fallback" },
--["<C-j>"] = { "select_next", "fallback" },
["<C-n>"] = {
function(cmp)
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_and_accept()
end
end,
"snippet_forward",
"fallback",
},
},
-- snippets = {
-- expand = function(snippet)
-- require("luasnip").lsp_expand(snippet)
-- end,
-- active = function(filter)
-- if filter and filter.direction then
-- return require("luasnip").jumpable(filter.direction)
-- end
-- return require("luasnip").in_snippet()
-- end,
-- jump = function(direction)
-- require("luasnip").jump(direction)
-- end,
-- },
sources = {
default = { "lsp", "path", "snippets", "buffer" },
},
},
opts_extend = { "sources.default" },
},
}

View File

@@ -1,157 +1,91 @@
return {
"hrsh7th/nvim-cmp",
enabled = true,
event = "VeryLazy",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-vsnip",
"hrsh7th/vim-vsnip",
'saadparwaiz1/cmp_luasnip',
"f3fora/cmp-spell",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-emoji",
--"L3MON4D3/LuaSnip",
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
"hrsh7th/cmp-buffer", -- source for text in buffer
"hrsh7th/cmp-path", -- source for file system paths
"L3MON4D3/LuaSnip", -- snippet engine
"saadparwaiz1/cmp_luasnip", -- for autocompletion
"rafamadriz/friendly-snippets", -- useful snippets
"onsails/lspkind.nvim", -- vs-code like pictograms
},
event = { 'BufReadPre', 'BufNewFile' },
config = function()
-- Setup nvim-cmp.
local cmp = require "cmp"
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
--local luasnip = require('luasnip')
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
col, col):match("%s") == nil
end
-- TODO: This is implemented in LuaSnip config, does it need to be here?
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true),
mode, true)
end
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
require("luasnip.loaders.from_vscode").lazy_load()
require('lspconfig').sourcekit.setup {
capabilities = capabilities
}
lspkind.init({
symbol_map = {
Text = "",
Method = "󰡱",
Function = "󰡱",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = ""
}
})
-- Configure nvim-cmp.
--require('luasnip.loaders.from_vscode').lazy_load()
--luasnip.config.setup {}
cmp.setup({
formatting = {
format = lspkind.cmp_format {
with_text = false,
maxwidth = 50,
menu = {
buffer = "BUF",
nvim_lsp = "LSP",
path = "PATH",
vsnip = "SNIP",
calc = "CALC",
spell = "SPELL",
emoji = "EMOJI"
}
}
completion = {
completeopt = "menu,menuone,preview",
},
experimental = {native_menu = false, ghost_text = false},
snippet = {
snippet = { -- configure how nvim-cmp interacts with snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
--luasnip.lsp_expand(args.body)
--require('luasnip').lsp_expand(args.body)
end
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true
},
-- Accept ([y]es) the completions.
['<C-y'] = cmp.mapping.confirm { select = true },
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_next_item()
-- -- elseif luasnip.expandable() then
-- -- luasnip.expand()
-- -- elseif luasnip.expand_or_jumpable() then
-- -- luasnip.expand_or_jump()
-- elseif has_words_before() then
-- cmp.complete()
-- else
-- fallback()
-- end
-- end, {"i", "s"}),
["<S-Tab>"] = cmp.mapping(function()
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-Space>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}), -- select completion, this makes it so it doesn't auto complete when suggesting.
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
-- elseif vim.fn["vsnip#jumpable"](-1) == 1 then
-- feedkey("<Plug>(vsnip-jump-prev)", "")
if luasnip.expandable() then
luasnip.expand()
else
cmp.mapping.confirm({ select = false })
fallback()
end
end, {"i", "s"})
},
sources = {
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
-- TODO:
-- The next two mappings are also implemented in the LuaSnip configuration,
-- as <C-j> and <C-k> do they actually need to be here??
["<C-b>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<C-f>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
}),
-- sources for autocompletion
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{name = "buffer", keyword_length = 5},
{name = 'luasnip', option = { show_autosnippets = true } },
{name = "calc"},
{name = "emoji"},
{name = "spell"},
{name = "path"}
}
{ name = "luasnip" }, -- snippets
{ name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths
}),
-- configure lspkind for vs-code like pictograms in completion menu
formatting = {
format = lspkind.cmp_format({
maxwidth = 50,
ellipsis_char = "...",
}),
},
})
-- Use buffer source for `/`.
cmp.setup.cmdline("/", {sources = {{name = "buffer"}}})
-- Use cmdline & path source for ':'.
cmp.setup.cmdline(":", {
sources = cmp.config.sources({{name = "path"}}, {{name = "cmdline"}})
})
end
end,
}

View File

@@ -0,0 +1,23 @@
return {
"j-hui/fidget.nvim",
event = "VeryLazy",
config = function()
local fidget = require("fidget")
fidget.setup({
notification = {
window = {
normal_hl = "String", -- Base highlight group in the notification window
winblend = 0, -- Background color opacity in the notification window
border = "rounded", -- Border around the notification window
zindex = 45, -- Stacking priority of the notification window
max_width = 0, -- Maximum width of the notification window
max_height = 0, -- Maximum height of the notification window
x_padding = 1, -- Padding from right edge of window boundary
y_padding = 1, -- Padding from bottom edge of window boundary
align = "bottom", -- How to align the notification window
relative = "editor", -- What the notification window position is relative to
},
},
})
end,
}

View File

@@ -1,10 +1,26 @@
return {
"mhartington/formatter.nvim",
event = { 'BufReadPre', 'BufNewFile' },
event = { "BufReadPre", "BufNewFile" },
config = function()
local util = require("formatter.util")
require("formatter").setup({
filetype = {
lua = {
require("formatter.filetypes.lua").stylua,
function()
return {
exe = "stylua",
args = {
"--search-parent-directories",
"--stdin-filepath",
util.escape_path(util.get_current_buffer_file_path()),
"--",
"-",
},
stdin = true,
}
end,
},
markdown = function()
return {
exe = "prettier",
@@ -12,11 +28,11 @@ return {
"--stdin-filepath",
util.escape_path(util.get_current_buffer_file_path()),
"--print-width",
"80",
"100",
"--prose-wrap",
"always",
"--parser",
"markdown"
"markdown",
},
stdin = true,
try_node_modules = true,
@@ -29,19 +45,17 @@ return {
end,
["*"] = {
-- formatter for any / all file types.
require("formatter.filetypes.any").remove_trailing_whitespace
}
}
require("formatter.filetypes.any").remove_trailing_whitespace,
},
},
})
-- Keymaps
local wk = require('which-key')
local wk = require("which-key")
wk.add({
{ "<space>f", ":Format", desc = "[F]ormat" },
{ "<space>F", ":FormateWrite", desc = "[F]ormat write" }
},
{ mode = 'n', silent = true }
)
{ "<space>F", ":FormateWrite", desc = "[F]ormat write" },
}, { mode = "n", silent = true })
local augroup = vim.api.nvim_create_augroup
local autocmd = vim.api.nvim_create_autocmd
@@ -49,7 +63,7 @@ return {
augroup("__formatter__", { clear = true })
autocmd("BufWritePost", {
group = "__formatter__",
command = ":FormatWrite"
command = ":FormatWrite",
})
end
end,
}

View File

@@ -1,5 +1,6 @@
return {
"ray-x/go.nvim",
enabled = false,
lazy = true,
dependencies = { -- optional packages
"ray-x/guihua.lua",

View File

@@ -1,11 +1,12 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim"
"nvim-lua/plenary.nvim",
},
config = function()
local harpoon = require('harpoon')
local harpoon = require("harpoon")
harpoon:setup({
settings = {
save_on_toggle = true,
@@ -13,82 +14,73 @@ return {
key = function()
return vim.loop.cwd()
end,
}
},
})
local conf = require('telescope.config').values
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require('telescope.pickers').new({}, {
prompt_title = 'Harpoon',
finder = require('telescope.finders').new_table({
require("telescope.pickers")
.new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
}):find()
})
:find()
end
-- Keymaps
vim.keymap.set("n", "<C-e>",
function() toggle_telescope(harpoon:list()) end,
{ desc = "Open Harpoon window" }
)
vim.keymap.set("n", "<C-e>", function()
toggle_telescope(harpoon:list())
end, { desc = "Open Harpoon window" })
vim.keymap.set("n", "<leader>a",
function() harpoon:list():add() end,
{ desc = "[A]dd to harpoon list." }
)
vim.keymap.set("n", "<C-e>",
function() harpoon.ui:toggle_quick_menu(harpoon:list()) end,
{ desc = "Toggle quick menu." }
)
vim.keymap.set("n", "<leader>a", function()
harpoon:list():add()
end, { desc = "[A]dd to harpoon list." })
vim.keymap.set("n", "<C-e>", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = "Toggle quick menu." })
-- Buffer key maps. Currently keeping all buffer movements
-- isolated to top left row of keys on keyboard and all begin
-- with the <Control> key.
-- Select buffer numbers.
vim.keymap.set("n", "<C-S-Y>",
function() harpoon:list():select(1) end,
{ desc = "Select first harpoon buffer." }
)
vim.keymap.set("n", "<C-S-U>",
function() harpoon:list():select(2) end,
{ desc = "Select second harpoon buffer." }
)
vim.keymap.set("n", "<C-S-I>",
function() harpoon:list():select(3) end,
{ desc = "Select third harpoon buffer." }
)
vim.keymap.set("n", "<C-S-O>",
function() harpoon:list():select(3) end,
{ desc = "Select third harpoon buffer." }
)
vim.keymap.set("n", "<A-y>", function()
harpoon:list():select(1)
end, { desc = "Select first harpoon buffer." })
vim.keymap.set("n", "<A-u>", function()
harpoon:list():select(2)
end, { desc = "Select second harpoon buffer." })
vim.keymap.set("n", "<A-i>", function()
harpoon:list():select(3)
end, { desc = "Select third harpoon buffer." })
vim.keymap.set("n", "<A-o>", function()
harpoon:list():select(4)
end, { desc = "Select fourth harpoon buffer." })
-- Toggle previous and next buffers.
vim.keymap.set("n", "<C-[>",
function() harpoon:list():prev() end,
{ desc = "[P]revious harpoon buffer." }
)
vim.keymap.set("n", "<C-]>",
function() harpoon:list():next() end,
{ desc = "[N]ext harpoon buffer." }
)
vim.keymap.set("n", "<C-[>", function()
harpoon:list():prev()
end, { desc = "[P]revious harpoon buffer." })
vim.keymap.set("n", "<C-]>", function()
harpoon:list():next()
end, { desc = "[N]ext harpoon buffer." })
-- Extensions
harpoon:extend({
UI_CREATE = function(cx)
vim.keymap.set("n", "<C-v>",
function() harpoon.ui:select_menu_item({ vsplit = true }) end,
{ buffer = cx.buffer, desc = "Open in [V]split" }
)
end
vim.keymap.set("n", "<C-v>", function()
harpoon.ui:select_menu_item({ vsplit = true })
end, { buffer = cx.buffer, desc = "Open in [V]split" })
end,
})
end
end,
}

View File

@@ -1,31 +1,2 @@
-- This file contains plugin's that don't require much configuration.
return {
-- {
-- "L3MON4D3/LuaSnip",
-- version = "2.*",
-- build = "make install_jsregexp",
-- event = { 'BufReadPre', 'BufNewFile' },
-- config = function()
-- local luasnip = require('luasnip')
-- local types = require('luasnip.util.types')
-- luasnip.config.set_config {
-- history = true,
-- updateevents = "TextChanged,TextChangedI",
-- enable_autosnippets = true,
-- ext_opts = {
-- [types.choiceNode] = {
-- active = {
-- virt_text = { { "<-", "Error" } },
-- },
-- },
-- },
-- }
-- end
-- },
{
"hrsh7th/vim-vsnip",
config = function()
vim.g.vsnip_snippet_dir = os.getenv('HOME') .. '/.config/m-housh/lua/snippets/'
end
},
}
return {}

View File

@@ -1,10 +1,11 @@
return {
"kdheepak/lazygit.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim"
},
config = function()
require("telescope").load_extension("lazygit")
end,
}
return {}
-- return {
-- "kdheepak/lazygit.nvim",
-- dependencies = {
-- "nvim-telescope/telescope.nvim",
-- "nvim-lua/plenary.nvim"
-- },
-- config = function()
-- require("telescope").load_extension("lazygit")
-- end,
-- }

View File

@@ -1,319 +1,105 @@
return {
{
"williamboman/nvim-lsp-installer",
config = function()
require("nvim-lsp-installer").setup({})
end
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
"onsails/lspkind-nvim",
"famiu/bufdelete.nvim",
"ray-x/lsp_signature.nvim",
"neovim/nvim-lspconfig",
"folke/neodev.nvim",
"mhartington/formatter.nvim",
"ray-x/go.nvim",
},
opts = {
ensure_installed = {
-- The language servers to setup.
local lsp_servers = {
"bashls",
"clangd",
"dockerls",
"gopls",
"jsonls",
"jedi_language_server",
"lua_ls",
"marksman",
"terraformls",
"ts_ls",
"texlab",
"sourcekit",
"yamlls",
}
}
},
{
return {
"neovim/nvim-lspconfig",
event = { "BufReadPost", "BufNewFile" },
cmd = { "LspInfo", "LspInstall", "LspUninstall", "LspStart", "LspStop", "LspRestart" },
event = { "BufReadPre", "BufNewFile" },
dependencies = {
-- "hrsh7th/cmp-nvim-lsp",
"saghen/blink.cmp",
{ "antosha417/nvim-lsp-file-operations", config = true },
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
{
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
},
config = function()
require('neodev').setup()
require("mason").setup()
require("mason-lspconfig").setup()
local lspconfig = require('lspconfig')
lspconfig.bashls.setup {}
lspconfig.clangd.setup {}
lspconfig.dockerls.setup {}
lspconfig.gopls.setup {}
lspconfig.jsonls.setup {}
lspconfig.lua_ls.setup {}
lspconfig.marksman.setup {}
lspconfig.yamlls.setup {}
lspconfig.sourcekit.setup({
capabilities = {
workspace = {
didChangeWatchedFiles = {
dynamicRegistration = true,
},
},
require("mason-lspconfig").setup({
opts = {
ensure_installed = lsp_servers,
},
})
local lspconfig = require("lspconfig")
--local cmp_nvim_lsp = require("cmp_nvim_lsp")
--local capabilities = cmp_nvim_lsp.default_capabilities()
local capabilities = require("blink.cmp").get_lsp_capabilities()
local opts = { noremap = true, silent = true }
local on_attach = function(_, bufnr)
opts.buffer = bufnr
vim.api.nvim_create_autocmd('LspAttach', {
desc = 'LSP Actions',
callback = function(args)
-- Configure keybindings once we've attached.
local wk = require('which-key')
opts.desc = "Show line diagnostics"
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
wk.add({
{ "<C-k>", vim.lsp.buf.hover, desc = "LSP hover info" },
{ "gd", vim.lsp.buf.definition, desc = "[G]oto [D]efinition" },
{ "gD", vim.lsp.buf.declaration, desc = "[G]oto [D]eclaration" },
{ "gi", vim.lsp.buf.implementation, desc = "[G]oto [I]mplementation" },
{ "gr", vim.lsp.buf.references, desc = "List [R]eferences" },
{"gs", vim.lsp.buf.signature_help, desc = "[S]ignature help" },
{ "<space>rn", vim.lsp.buf.rename, desc = "[R]e[N]ame" },
{ "[d", vim.diagnostic.goto_prev, desc = "Go to previous diagnostic" },
{ "]d", vim.diagnostic.goto_prev, desc = "Go to next diagnostic" },
}, {
mode = 'n',
silent = true
})
opts.desc = "Show diagnostics in Telescope"
vim.keymap.set("n", "<leader><leader>d", "<CMD>Telescope diagnostics bufnr=0<CR>", opts)
opts.desc = "Show documentation for what is under cursor"
vim.keymap.set("n", "<C-k>", vim.lsp.buf.hover, opts)
opts.desc = "[G]oto [D]efinition"
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions trim_text=true<cr>", opts)
opts.desc = "[G]oto [D]eclaration"
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
opts.desc = "[G]oto [R]eferences"
vim.keymap.set("n", "gr", "<CMD>Telescope lsp_references<CR>", opts)
opts.desc = "LSP [C]ode [A]ction"
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
--opts.desc = "[R]e-[N]ame"
--vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
opts.desc = "[R]eload or start LSP"
vim.keymap.set("n", "<leader>rl", ":LspRestart | :LspStart<CR>", opts)
opts.desc = "Goto previous diagnostic"
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
opts.desc = "Goto next diagnostic"
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
end
for _, lsp in ipairs(lsp_servers) do
lspconfig[lsp].setup({
capabilities = capabilities,
on_attach = on_attach,
on_init = function(client)
-- HACK: to fix some issues with LSP
-- more details: https://github.com/neovim/neovim/issues/19237#issuecomment-2237037154
client.offset_encoding = "utf-8"
end,
cmd = lsp == "sourcekit" and { vim.trim(vim.fn.system("xcrun -f sourcekit-lsp")) } or nil,
})
end
-- nice icons
local signs = { Error = "", Warn = "", Hint = "󰠠 ", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
-- For some reason I was having trouble getting this to work inside the on-attach, so it's here.
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "[R]e-[N]ame" })
end,
}
}
-- return {
-- {
-- "williamboman/nvim-lsp-installer",
-- config = function()
-- require("nvim-lsp-installer").setup({})
-- end
-- },
-- {
-- "williamboman/mason-lspconfig.nvim",
-- dependencies = {
-- "williamboman/mason.nvim",
-- "onsails/lspkind-nvim",
-- "famiu/bufdelete.nvim",
-- "ray-x/lsp_signature.nvim",
-- "neovim/nvim-lspconfig",
-- "folke/neodev.nvim",
-- "mhartington/formatter.nvim",
-- "ray-x/go.nvim",
-- },
-- opts = {
-- ensure_installed = {
-- "bashls",
-- "clangd",
-- "dockerls",
-- "gopls",
-- "jsonls",
-- "jedi_language_server",
-- "lua_ls",
-- "marksman",
-- "terraformls",
-- "ts_ls",
-- "texlab",
-- "yamlls",
-- }
-- }
-- },
-- {
-- "neovim/nvim-lspconfig",
-- dependencies = {
-- "hrsh7th/cmp-nvim-lsp",
-- },
-- config = function()
-- require('neodev').setup()
-- require("mason").setup()
-- require("mason-lspconfig").setup()
-- local nvim_lsp = require("lspconfig")
-- local telescope_builtin = require('telescope.builtin')
--
-- vim.api.nvim_create_autocmd('LspAttach', {
-- group = vim.api.nvim_create_augroup('my-lsp-attach', { clear = true }),
-- callback = function(event)
-- -- Helper function to create a keymap.
-- local map = function(keys, func, desc)
-- vim.keymap.set('n', keys, func, { buffer = true, desc = 'LSP: ' .. desc })
-- end
--
-- -- Mappings.
-- -- See `:help vim.lsp.*` for documentation on any of the below functions
--
-- map('[d', '<CMD>lua vim.lsp.diagnostic.goto_prev()<CR>', 'Goto previous')
-- map(']d', '<CMD>lua vim.lsp.diagnostic.goto_next()<CR>', 'Goto next')
-- map('<space>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
-- map('<space>rn', vim.lsp.buf.rename, '[R]e[n]ame')
-- map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- map('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
-- map('gi', telescope_builtin.lsp_implementations, '[G]oto, [I]mplementation')
-- map('gr', telescope_builtin.lsp_references, '[G]oto [R]eferences')
-- map('gt', telescope_builtin.lsp_type_definitions, '[T]ype Definitions')
-- map('K', vim.lsp.buf.hover, 'Hover Documentation')
--
-- -- -- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-- -- buf_set_keymap("n", "<space>wa",
-- -- "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
-- -- buf_set_keymap("n", "<space>wr",
-- -- "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
-- -- buf_set_keymap("n", "<space>wl",
-- -- "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
-- -- opts)
-- -- buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
-- -- buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
-- vim.api.nvim_buf_set_option(event.buf, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- end,
-- })
--
-- -- Use a loop to conveniently call 'setup' on multiple servers and
-- -- map buffer local keybindings when the language server attaches
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
-- capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
--
-- local servers = {
-- "bashls",
-- "clangd",
-- "dockerls",
-- "gopls",
-- "jsonls",
-- "jedi_language_server",
-- "lua_ls",
-- "marksman",
-- "sourcekit",
-- "terraformls",
-- "ts_ls",
-- "texlab",
-- "yamlls",
-- }
--
-- for _, lsp in ipairs(servers) do
-- nvim_lsp[lsp].setup {
-- capabilities = capabilities,
-- settings = {
-- gopls = {
-- experimentalPostfixCompletions = true,
-- analyses = {
-- unusedparams = true,
-- shadow = true
-- },
-- staticcheck = true
-- },
-- lua_ls = {
-- Lua = {
-- completion = {
-- callSnippet = "Replace"
-- },
-- workspace = { checkThirdParty = false },
-- telemetry = { enable = false },
-- }
-- },
-- json = {
-- format = {enabled = false},
-- schemas = {
-- {
-- description = "ESLint config",
-- fileMatch = {".eslintrc.json", ".eslintrc"},
-- url = "http://json.schemastore.org/eslintrc"
-- }, {
-- description = "Package config",
-- fileMatch = {"package.json"},
-- url = "https://json.schemastore.org/package"
-- }, {
-- description = "Packer config",
-- fileMatch = {"packer.json"},
-- url = "https://json.schemastore.org/packer"
-- }, {
-- description = "Renovate config",
-- fileMatch = {
-- "renovate.json", "renovate.json5",
-- ".github/renovate.json", ".github/renovate.json5",
-- ".renovaterc", ".renovaterc.json"
-- },
-- url = "https://docs.renovatebot.com/renovate-schema"
-- }, {
-- description = "OpenApi config",
-- fileMatch = {"*api*.json"},
-- url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"
-- }
-- }
-- },
-- redhat = {telemetry = {enabled = false}},
-- texlab = {
-- auxDirectory = ".",
-- bibtexFormatter = "texlab",
-- build = {
-- args = {
-- "--keep-intermediates", "--keep-logs", "--synctex", "%f"
-- },
-- executable = "tectonic",
-- forwardSearchAfter = false,
-- onSave = false
-- },
-- chktex = {onEdit = false, onOpenAndSave = false},
-- diagnosticsDelay = 300,
-- formatterLineLength = 80,
-- forwardSearch = {args = {}},
-- latexFormatter = "latexindent",
-- latexindent = {modifyLineBreaks = false}
-- },
-- yaml = {
-- schemaStore = {
-- enable = true,
-- url = "https://www.schemastore.org/api/json/catalog.json"
-- },
-- schemas = {
-- kubernetes = "/*.yaml",
-- ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}",
-- ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
-- ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
-- ["http://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}",
-- ["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}",
-- ["http://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}",
-- ["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
-- ["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
-- ["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}",
-- ["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
-- ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}",
-- ["https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json"] = "*flow*.{yml,yaml}"
-- },
-- format = {enabled = false},
-- validate = false, -- TODO: conflicts between Kubernetes resources and kustomization.yaml
-- completion = true,
-- hover = true
-- }
-- },
-- flags = {debounce_text_changes = 150}
-- }
-- require"lsp_signature".setup({
-- bind = true, -- This is mandatory, otherwise border config won't get registered.
-- floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
-- doc_lines = 2, -- Set to 0 for not showing doc
-- hint_prefix = "🐼 ",
-- -- use_lspsaga = false, -- set to true if you want to use lspsaga popup
-- handler_opts = {
-- border = "shadow" -- double, single, shadow, none
-- }
-- })
-- end
--
-- -- Test source-kit
-- require('lspconfig').sourcekit.setup{
-- capabilities = {
-- workspace = {
-- didChangeWatchedFiles = {
-- dynamicRegistration = true
-- }
-- }
-- }
-- }
--
-- end
-- }
-- }

View File

@@ -1,119 +1,217 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local colors = {
red = '#ca1243',
grey = '#a0a1a7',
black = '#383a42',
white = '#f3f3f3',
light_green = '#83a598',
orange = '#fe8019',
green = '#8ec07c',
}
local lualine = require("lualine")
local empty = require('lualine.component'):extend()
function empty:draw(default_highlight)
self.status = ''
self.applied_separator = ''
self:apply_highlights(default_highlight)
self:apply_section_separators()
return self.status
local function xcodebuild_device()
if vim.g.xcodebuild_platform == "macOS" then
return " macOS"
end
-- Put proper separators and gaps between components in sections
local function process_sections(sections)
for name, section in pairs(sections) do
local left = name:sub(9, 10) < 'x'
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
end
for id, comp in ipairs(section) do
if type(comp) ~= 'table' then
comp = { comp }
section[id] = comp
end
comp.separator = left and { right = '' } or { left = '' }
end
end
return sections
if vim.g.xcodebuild_os then
return "" .. vim.g.xcodebuild_device_name .. " (" .. vim.g.xcodebuild_os .. ")"
end
local function search_result()
if vim.v.hlsearch == 0 then
return ''
end
local last_search = vim.fn.getreg '/'
if not last_search or last_search == '' then
return ''
end
local searchcount = vim.fn.searchcount { maxcount = 9999 }
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
return "" .. vim.g.xcodebuild_device_name
end
local function modified()
if vim.bo.modified then
return '+'
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
return '-'
end
return ''
end
require('lualine').setup {
lualine.setup({
options = {
theme = 'auto',
component_separators = '',
section_separators = { left = '', right = '' },
globalstatus = true,
theme = "auto",
symbols = {
alternate_file = "#",
directory = "",
readonly = "",
unnamed = "[No Name]",
newfile = "[New]",
},
disabled_buftypes = { "quickfix", "prompt" },
component_separators = "",
section_separators = { left = "", right = "" },
},
sections = {
lualine_a = {
-- { "mode" },
{ "filename" },
},
sections = process_sections {
lualine_a = { 'mode' },
lualine_b = {
'branch',
'diff',
{ "diagnostics" },
{ "diff" },
{
'diagnostics',
source = { 'nvim' },
sections = { 'error' },
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
},
{
'diagnostics',
source = { 'nvim' },
sections = { 'warn' },
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
},
{ 'filename', file_status = false, path = 1 },
{ modified, color = { bg = colors.red } },
{
'%w',
cond = function()
return vim.wo.previewwindow
end,
},
{
'%r',
cond = function()
return vim.bo.readonly
end,
},
{
'%q',
cond = function()
return vim.bo.buftype == 'quickfix'
end,
"searchcount",
maxcount = 999,
timeout = 500,
},
},
lualine_c = {},
lualine_x = {},
lualine_y = { search_result, 'filetype' },
lualine_z = { '%l:%c', '%p%%/%L' },
lualine_x = {
{ "' ' .. vim.g.xcodebuild_last_status", color = { fg = "#a6e3a1" } },
-- { "'󰙨 ' .. vim.g.xcodebuild_test_plan", color = { fg = "#a6e3a1", bg = "#161622" } },
{ xcodebuild_device, color = { fg = "#f9e2af", bg = "#161622" } },
},
lualine_y = {
{ "branch" },
},
lualine_z = {
{ "location" },
},
},
inactive_sections = {
lualine_c = { '%f %y %m' },
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = {},
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = {"nvim-tree"}
}
end
extensions = { "nvim-dap-ui", "quickfix", "trouble", "nvim-tree", "lazy", "mason" },
})
end,
}
-- return {
-- "nvim-lualine/lualine.nvim",
-- config = function()
-- local colors = {
-- red = '#ca1243',
-- grey = '#a0a1a7',
-- black = '#383a42',
-- white = '#f3f3f3',
-- light_green = '#83a598',
-- orange = '#fe8019',
-- green = '#8ec07c',
-- }
--
-- local empty = require('lualine.component'):extend()
-- function empty:draw(default_highlight)
-- self.status = ''
-- self.applied_separator = ''
-- self:apply_highlights(default_highlight)
-- self:apply_section_separators()
-- return self.status
-- end
--
-- -- Put proper separators and gaps between components in sections
-- local function process_sections(sections)
-- for name, section in pairs(sections) do
-- local left = name:sub(9, 10) < 'x'
-- for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
-- table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
-- end
-- for id, comp in ipairs(section) do
-- if type(comp) ~= 'table' then
-- comp = { comp }
-- section[id] = comp
-- end
-- comp.separator = left and { right = '' } or { left = '' }
-- end
-- end
-- return sections
-- end
--
-- local function search_result()
-- if vim.v.hlsearch == 0 then
-- return ''
-- end
-- local last_search = vim.fn.getreg '/'
-- if not last_search or last_search == '' then
-- return ''
-- end
-- local searchcount = vim.fn.searchcount { maxcount = 9999 }
-- return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
-- end
--
-- local function modified()
-- if vim.bo.modified then
-- return '+'
-- elseif vim.bo.modifiable == false or vim.bo.readonly == true then
-- return '-'
-- end
-- return ''
-- end
--
-- local function xcodebuild_device()
-- if vim.g.xcodebuild_platform == "macOS" then
-- return " macOS"
-- end
--
-- local deviceIcon = ""
-- if vim.g.xcodebuild_platform:match("watch") then
-- deviceIcon = "􀟤"
-- elseif vim.g.xcodebuild_platform:match("tv") then
-- deviceIcon = "􀡴 "
-- elseif vim.g.xcodebuild_platform:match("vision") then
-- deviceIcon = "􁎖 "
-- end
--
-- if vim.g.xcodebuild_os then
-- return deviceIcon .. " " .. vim.g.xcodebuild_device_name .. " (" .. vim.g.xcodebuild_os .. ")"
-- end
--
-- return deviceIcon .. " " .. vim.g.xcodebuild_device_name
-- end
--
--
-- require('lualine').setup {
-- options = {
-- theme = 'auto',
-- component_separators = '',
-- section_separators = { left = '', right = '' },
-- },
-- sections = process_sections {
-- lualine_a = { 'mode' },
-- lualine_b = {
-- 'branch',
-- 'diff',
-- {
-- 'diagnostics',
-- source = { 'nvim' },
-- sections = { 'error' },
-- diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
-- },
-- {
-- 'diagnostics',
-- source = { 'nvim' },
-- sections = { 'warn' },
-- diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
-- },
-- { 'filename', file_status = false, path = 1 },
-- { modified, color = { bg = colors.red } },
-- {
-- '%w',
-- cond = function()
-- return vim.wo.previewwindow
-- end,
-- },
-- {
-- '%r',
-- cond = function()
-- return vim.bo.readonly
-- end,
-- },
-- {
-- '%q',
-- cond = function()
-- return vim.bo.buftype == 'quickfix'
-- end,
-- },
-- },
-- lualine_c = {},
-- lualine_x = {
-- { "' ' .. vim.g.xcodebuild_last_status", color = { fg = "Gray" } },
-- { "'󰙨 ' .. vim.g.xcodebuild_test_plan", color = { fg = "#a6e3a1", bg = "#161622" } },
-- { xcodebuild_device, color = { fg = "#f9e2af", bg = "#161622" } },
-- },
-- lualine_y = { search_result, 'filetype' },
-- lualine_z = { '%l:%c', '%p%%/%L' },
-- },
-- inactive_sections = {
-- lualine_c = { '%f %y %m' },
-- lualine_x = {},
-- },
-- tabline = {},
-- extensions = {"nvim-tree"}
-- }
-- end
-- }

View File

@@ -0,0 +1,45 @@
return {
"L3MON4D3/LuaSnip",
version = "v2.*",
event = "VeryLazy",
config = function()
local ls = require("luasnip")
local types = require("luasnip.util.types")
ls.setup({
history = true,
enable_autosnippets = false,
updatevents = "TextChanged,TextChangedI",
extra_opts = {
[types.choiceNode] = {
active = {
virt_text = { { "choiceNode", "Comment" } },
},
},
},
})
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_lua").lazy_load({ paths = vim.fn.stdpath("config") .. "/snippets" })
-- Keymaps
local opts = { silent = true }
-- Use <Ctrl>k to expand snippets.
-- This will expand the current item or jump to the next item within the snippet.
vim.keymap.set({ "i", "s" }, "<C-k>", function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end, opts)
-- Use <Ctrl>j to jump backwards in a snippet.
-- This always moves to the previous item within a snippet.
vim.keymap.set({ "i", "s" }, "<C-j>", function()
if ls.jumpable(-1) then
ls.jump(-1)
end
end, opts)
-- Reload snippets.
vim.keymap.set("n", "<leader><leader>s", "<CMD>source ~/.config/m-housh/lua/user/plugin/luasnip.lua<CR>")
end,
}

View File

@@ -1,26 +0,0 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
opts = {
close_if_last_window = false,
enable_git_status = true,
enable_diagnostics = true,
filesystem = {
always_show = {
"plugins",
".zshrc",
".zshenv",
"*.env"
},
filtered_items = {
hide_dotfiles = false
},
use_libuv_file_watcher = true
},
}
}

View File

@@ -0,0 +1,71 @@
local function setupListeners()
local dap = require("dap")
local areSet = false
dap.listeners.after["event_initialized"]["me"] = function()
if not areSet then
areSet = true
vim.keymap.set("n", "<leader>dc", dap.continue, { desc = "Continue", noremap = true })
vim.keymap.set("n", "<leader>dC", dap.run_to_cursor, { desc = "Run To Cursor" })
vim.keymap.set("n", "<leader>ds", dap.step_over, { desc = "Step Over" })
vim.keymap.set("n", "<leader>di", dap.step_into, { desc = "Step Into" })
vim.keymap.set("n", "<leader>do", dap.step_out, { desc = "Step Out" })
vim.keymap.set({ "n", "v" }, "<Leader>dh", require("dap.ui.widgets").hover, { desc = "Hover" })
vim.keymap.set({ "n", "v" }, "<Leader>de", require("dapui").eval, { desc = "Eval" })
end
end
dap.listeners.after["event_terminated"]["me"] = function()
if areSet then
areSet = false
vim.keymap.del("n", "<leader>dc")
vim.keymap.del("n", "<leader>dC")
vim.keymap.del("n", "<leader>ds")
vim.keymap.del("n", "<leader>di")
vim.keymap.del("n", "<leader>do")
vim.keymap.del({ "n", "v" }, "<Leader>dh")
vim.keymap.del({ "n", "v" }, "<Leader>de")
end
end
end
return {
"mfussenegger/nvim-dap",
--event = "VeryLazy",
dependencies = {
"wojciech-kulik/xcodebuild.nvim",
},
config = function()
local xcodebuild = require("xcodebuild.integrations.dap")
-- TODO: make sure to set path to your codelldb
local codelldbPath = os.getenv("HOME") .. "/tools/codelldb-aarch64-darwin/extension/adapter/codelldb"
xcodebuild.setup(codelldbPath)
local define = vim.fn.sign_define
define("DapBreakpoint", { text = "", texthl = "DiagnosticError", linehl = "", numhl = "" })
define("DapBreakpointRejected", { text = "", texthl = "DiagnosticError", linehl = "", numhl = "" })
define("DapStopped", { text = "", texthl = "DiagnosticOk", linehl = "", numhl = "" })
define("DapLogPoint", { text = "", texthl = "DiagnosticInfo", linehl = "", numhl = "" })
define("DapLogPoint", { text = "", texthl = "DiagnosticInfo", linehl = "", numhl = "" })
setupListeners()
--when breakpoint is hit, it sets the focus to the buffer with the breakpoint
require("dap").defaults.fallback.switchbuf = "usetab,uselast"
--stylua: ignore start
vim.keymap.set("n", "<leader>dd", xcodebuild.build_and_debug, { desc = "Build & Debug" })
vim.keymap.set("n", "<leader>dr", xcodebuild.debug_without_build, { desc = "Debug Without Building" })
vim.keymap.set("n", "<leader>dt", xcodebuild.debug_tests, { desc = "Debug Tests" })
vim.keymap.set("n", "<leader>dT", xcodebuild.debug_class_tests, { desc = "Debug Class Tests" })
vim.keymap.set("n", "<leader>b", xcodebuild.toggle_breakpoint, { desc = "Toggle Breakpoint" })
vim.keymap.set("n", "<leader>B", xcodebuild.toggle_message_breakpoint, { desc = "Toggle Message Breakpoint" })
--stylua: ignore end
vim.keymap.set("n", "<leader>dx", function()
xcodebuild.terminate_session()
require("dap").listeners.after["event_terminated"]["me"]()
end, { desc = "Terminate debugger" })
end,
}

View File

@@ -0,0 +1,87 @@
return {
"rcarriga/nvim-dap-ui",
dependencies = {
"mfussenegger/nvim-dap",
"nvim-neotest/nvim-nio",
},
lazy = true,
config = function()
require("dapui").setup({
controls = {
element = "repl",
enabled = true,
icons = {
disconnect = "",
run_last = "",
terminate = "⏹︎",
pause = "⏸︎",
play = "",
step_into = "󰆹",
step_out = "󰆸",
step_over = "",
step_back = "",
},
},
floating = {
border = "single",
mappings = {
close = { "q", "<Esc>" },
},
},
icons = {
collapsed = "",
expanded = "",
current_frame = "",
},
layouts = {
{
elements = {
{ id = "stacks", size = 0.25 },
{ id = "scopes", size = 0.25 },
{ id = "breakpoints", size = 0.25 },
{ id = "watches", size = 0.25 },
},
position = "left",
size = 40,
},
{
elements = {
{ id = "repl", size = 0.4 },
{ id = "console", size = 0.6 },
},
position = "bottom",
size = 10,
},
},
})
local dap, dapui = require("dap"), require("dapui")
local group = vim.api.nvim_create_augroup("dapui_config", { clear = true })
-- hide ~ in DAPUI
vim.api.nvim_create_autocmd("BufWinEnter", {
group = group,
pattern = "DAP*",
callback = function()
vim.wo.fillchars = "eob: "
end,
})
vim.api.nvim_create_autocmd("BufWinEnter", {
group = group,
pattern = "\\[dap\\-repl\\]",
callback = function()
vim.wo.fillchars = "eob: "
end,
})
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
end,
}

View File

@@ -19,6 +19,6 @@ return {
vim.keymap.set("n", "<leader>ml", function()
require("lint").try_lint()
end, { desc = "Lint file" })
end, { desc = "[L]int file" })
end,
}

View File

@@ -0,0 +1,68 @@
return {
"stevearc/oil.nvim",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
columns = { "icon" },
keymaps = {
["<C-h>"] = false,
["<M-h>"] = "actions.select_split",
["<C-v>"] = {
"actions.select",
opts = { vertical = true },
desc = "Open the entry in a vertical split",
},
},
view_options = {
is_hidden_file = function(name, _) -- second arg is bufnr, but not currently used.
-- Don't show .DS_Store in output.
local is_ds_store = name ~= ".DS_Store"
return not is_ds_store
end,
},
},
keys = {
-- Show the parent directory in current window.
{ "-", "<CMD>Oil<CR>", desc = "Open directory." },
-- Open parent directory in floating window.
{
"<leader>-",
function()
require("oil").toggle_float()
end,
desc = "Open directory in float.",
},
},
-- config = function()
-- require("oil").setup({
-- columns = { "icon" },
-- keymaps = {
-- ["<C-h>"] = false,
-- ["<M-h>"] = "actions.select_split",
-- ["<C-v>"] = {
-- "actions.select",
-- opts = { vertical = true },
-- desc = "Open the entry in a vertical split",
-- },
-- },
-- view_options = {
-- is_hidden_file = function(name, _) -- second arg is bufnr, but not currently used.
-- -- Don't show .DS_Store in output.
-- local is_ds_store = name ~= ".DS_Store"
-- return not is_ds_store
-- end,
-- },
-- })
--
-- -- Show the parent directory in current window.
-- vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory." })
--
-- -- Open parent directory in floating window.
-- vim.keymap.set("n", "<space>-", require("oil").toggle_float)
--
-- -- Old habits die hard, map what used to toggle neo-tree to just open a float.
-- vim.keymap.set("n", "<C-n>", require("oil").toggle_float)
-- end,
}

View File

@@ -1,15 +1,16 @@
return {
'm-housh/swift.nvim',
"m-housh/swift.nvim",
dependencies = {
'akinsho/toggleterm.nvim'
"akinsho/toggleterm.nvim",
},
ft = { 'swift' },
ft = { "swift" },
config = function()
require('swift').setup()
require("swift").setup()
local default_options = { noremap = true, silent = true }
local actions = require('swift.actions')
vim.keymap.set('n', '<C-b>', actions.build, default_options)
vim.keymap.set('n', '<C-S-U>', actions.test, default_options)
end
local actions = require("swift.actions")
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.keymap.set("n", "<C-b>", actions.build, default_options)
vim.keymap.set("n", "<C-S-U>", actions.test, default_options)
end,
}

View File

@@ -1,37 +1,44 @@
return {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = {
'nvim-lua/plenary.nvim'
"nvim-lua/plenary.nvim",
},
lazy = true,
config = function()
local actions = require('telescope.actions')
local builtin = require('telescope.builtin')
local actions = require("telescope.actions")
local builtin = require("telescope.builtin")
require('telescope').setup({
require("telescope").setup({
ensure_installed = {
"swift",
},
defaults = {
file_ignore_patterns = { "node_modules", "%.jpg", "%.png", ".swiftpm" },
vimgrep_arguments = {
'rg',
'--follow',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--smart-case'
"rg",
"--follow",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
mappings = {
i = {
-- Close on first esc instead of gonig to normal mode
-- Close on first esc instead of going to normal mode
["<esc>"] = actions.close,
["<A-q>"] = actions.send_selected_to_qflist,
["<C-q>"] = actions.send_to_qflist,
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
n = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
["<A-q>"] = actions.send_selected_to_qflist,
@@ -52,24 +59,44 @@ return {
horizontal = { mirror = false },
vertical = { mirror = true },
},
file_sorter = require'telescope.sorters'.get_fuzzy_file,
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
file_sorter = require("telescope.sorters").get_fuzzy_file,
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
-- path_display = true, -- strange behaviour not showing the files in result window
winblend = 0,
border = {},
borderchars = { '', '', '', '', '', '', '', '' },
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
use_less = true,
set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
}
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
})
vim.keymap.set("n", "<C-A-j>", builtin.jumplist, { silent = true, noremap = true, desc = "Open [J]ump List."})
local map = function(keys, action, desc)
local opts = { silent = true, noremap = true, desc = desc }
vim.keymap.set("n", keys, action, opts)
end
local find_files = function(dir)
return function()
builtin.find_files({ cwd = dir, hidden = true, no_ignore = true })
end
end
vim.keymap.set("n", "<C-A-j>", builtin.jumplist, { silent = true, noremap = true, desc = "Open [J]ump List." })
map("<leader>ff", builtin.find_files, "[F]ind [F]iles")
map("<leader>fg", builtin.live_grep, "[F]ind [G]rep")
map("<leader>fb", builtin.buffers, "[F]ind [B]uffers")
map("<leader>fh", builtin.help_tags, "[F]ind [H]elp")
map("<leader>fd", find_files("$DOTFILES"), "[F]ind [D]otfiles")
map("<leader>fn", find_files("$DOTFILES/nvim/m-housh"), "[F]ind [N]vim file")
map("<leader>fs", find_files("$DOTFILES/scripts/scripts"), "[F]ind [S]cript")
map("<leader>fz", find_files("$DOTFILES/zsh/config"), "[F]ind [Z]sh config file")
map("<leader>gf", builtin.git_files, "Find [G]it [F]iles")
end,
}

View File

@@ -1,5 +1,29 @@
return {
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = { }
dependencies = {
"nvim-lua/plenary.nvim",
"folke/trouble.nvim",
},
opts = {},
config = function()
local todos = require("todo-comments")
todos.setup({
keywords = {
-- Adds the important keyword, I primarily use this in markdown
-- documents to be able to jump and color appropriately.
FIX = { alt = { "IMPORTANT" } },
},
})
vim.keymap.set("n", "<leader>tq", "<CMD>Trouble todo toggle<CR>", { desc = "[T]odo [Q]uick fix list." })
vim.keymap.set("n", "<leader><leader>t", "<CMD>TodoTelescope<CR>", { desc = "[T]odo telescope list." })
vim.keymap.set("n", "<leader>tl", "<CMD>TodoLocList<CR>", { desc = "[T]odo [L]ocation list." })
vim.keymap.set("n", "]t", function()
todos.jump_next()
end, { desc = "Next [T]odo" })
vim.keymap.set("n", "[t", function()
todos.jump_prev()
end, { desc = "Previous [T]odo" })
end,
}

View File

@@ -1,13 +1,13 @@
return {
"nvim-treesitter/nvim-treesitter",
dependencies = {
'nvim-telescope/telescope-fzf-native.nvim',
'nvim-treesitter/nvim-treesitter-textobjects',
"nvim-telescope/telescope-fzf-native.nvim",
"nvim-treesitter/nvim-treesitter-textobjects",
},
build = ':TSUpdate',
event = { 'BufReadPre', 'BufNewFile' },
build = ":TSUpdate",
event = { "BufReadPre", "BufNewFile" },
config = function()
require('nvim-treesitter.configs').setup {
require("nvim-treesitter.configs").setup({
ensure_installed = {
"bash",
"cmake",
@@ -28,12 +28,12 @@ return {
"swift",
"toml",
"xml",
"yaml"
"yaml",
}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ignore_install = {}, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
disable = {} -- list of language that will be disabled
disable = {}, -- list of language that will be disabled
},
incremental_selection = {
enable = true,
@@ -41,8 +41,8 @@ return {
init_selection = "<CR>",
scope_incremental = "<CR>",
node_incremental = "<TAB>",
node_decremental = "<S-TAB>"
}
node_decremental = "<S-TAB>",
},
},
indent = { enable = true },
autopairs = { { enable = true } },
@@ -65,14 +65,14 @@ return {
["ar"] = "@parameter.outer",
["a="] = "@assignment.outer",
["i="] = "@assignment.inner",
}
}
},
},
},
rainbow = {
enable = true,
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
max_file_lines = 2000 -- Do not enable for files with more than specified lines
}
}
end
max_file_lines = 2000, -- Do not enable for files with more than specified lines
},
})
end,
}

View File

@@ -0,0 +1,46 @@
return {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
event = { "BufReadPre", "BufNewFile" },
keys = {
{ "<leader>d", "<cmd>Trouble diagnostics toggle<cr>", { desc = "Trouble [D]iagnostics" } },
{ "<leader>dq", "<cmd>Trouble quickfix toggle<cr>", { desc = "Trouble [Q]uikfix." } },
{ "<leader>dl", "<cmd>Trouble loclist toggle<cr>", { desc = "Trouble [L]ocation list" } },
},
opts = {},
config = function()
require("trouble").setup({
auto_open = false,
auto_close = false,
auto_preview = true,
auto_jump = false,
mode = "quickfix",
severity = vim.diagnostic.severity.ERROR,
cycle_results = false,
})
vim.api.nvim_create_autocmd("User", {
pattern = { "XcodebuildBuildFinished", "XcodebuildTestsFinished" },
callback = function(event)
if event.data.cancelled then
return
end
if event.data.success then
require("trouble").close()
elseif not event.data.failedCount or event.data.failedCount > 0 then
if next(vim.fn.getqflist()) then
require("trouble").open("quickfix")
else
require("trouble").close()
end
require("trouble").refresh()
end
end,
})
-- Jump to diagnostic issues across the whole project.
vim.keymap.set("n", "<A-d>", "<cmd>silent cc | silent cn<cr>zz", { desc = "Jump to next issue" })
vim.keymap.set("n", "<A-s>", "<cmd>silent cc | silent cp<cr>zz", { desc = "Jump to previous issue" })
end,
}

View File

@@ -0,0 +1,81 @@
local progress_handle
return {
"wojciech-kulik/xcodebuild.nvim",
event = "VeryLazy",
--branch = "fix/issue-249",
dependencies = {
"nvim-telescope/telescope.nvim",
"MunifTanjim/nui.nvim",
},
config = function()
require("xcodebuild").setup({
show_build_progress_bar = false,
logs = {
auto_open_on_success_tests = false,
auto_open_on_failed_tests = false,
auto_open_on_success_build = false,
auto_open_on_failed_build = false,
auto_focus = false,
auto_close_on_app_launch = true,
only_summary = true,
notify = function(message, severity)
local fidget = require("fidget")
if progress_handle then
progress_handle.message = message
if not message:find("Loading") then
progress_handle:finish()
progress_handle = nil
if vim.trim(message) ~= "" then
fidget.notify(message, severity)
end
end
else
fidget.notify(message, severity)
end
end,
notify_progress = function(message)
local progress = require("fidget.progress")
if progress_handle then
progress_handle.title = ""
progress_handle.message = message
else
progress_handle = progress.handle.create({
message = message,
lsp_client = { name = "xcodebuild.nvim" },
})
end
end,
},
code_coverage = {
enabled = true,
},
})
-- stylua: ignore start
vim.keymap.set("n", "<leader>X", "<cmd>XcodebuildPicker<cr>", { desc = "Show Xcodebuild Actions" })
vim.keymap.set("n", "<leader>xf", "<cmd>XcodebuildProjectManager<cr>", { desc = "Show Project Manager Actions" })
vim.keymap.set("n", "<leader>xb", "<cmd>XcodebuildBuild<cr>", { desc = "Build Project" })
vim.keymap.set("n", "<leader>xB", "<cmd>XcodebuildBuildForTesting<cr>", { desc = "Build For Testing" })
vim.keymap.set("n", "<leader>xr", "<cmd>XcodebuildBuildRun<cr>", { desc = "Build & Run Project" })
vim.keymap.set("n", "<leader>xt", "<cmd>XcodebuildTest<cr>", { desc = "Run Tests" })
vim.keymap.set("v", "<leader>xt", "<cmd>XcodebuildTestSelected<cr>", { desc = "Run Selected Tests" })
vim.keymap.set("n", "<leader>xT", "<cmd>XcodebuildTestClass<cr>", { desc = "Run This Test Class" })
vim.keymap.set("n", "<leader>xl", "<cmd>XcodebuildToggleLogs<cr>", { desc = "Toggle Xcodebuild Logs" })
vim.keymap.set("n", "<leader>xc", "<cmd>XcodebuildToggleCodeCoverage<cr>", { desc = "Toggle Code Coverage" })
vim.keymap.set("n", "<leader>xC", "<cmd>XcodebuildShowCodeCoverageReport<cr>", { desc = "Show Code Coverage Report" })
vim.keymap.set("n", "<leader>xe", "<cmd>XcodebuildTestExplorerToggle<cr>", { desc = "Toggle Test Explorer" })
vim.keymap.set("n", "<leader>xs", "<cmd>XcodebuildFailingSnapshots<cr>", { desc = "Show Failing Snapshots" })
vim.keymap.set("n", "<leader>xd", "<cmd>XcodebuildSelectDevice<cr>", { desc = "Select Device" })
vim.keymap.set("n", "<leader>xp", "<cmd>XcodebuildSelectTestPlan<cr>", { desc = "Select Test Plan" })
vim.keymap.set("n", "<leader>xq", "<cmd>Telescope quickfix<cr>", { desc = "Show QuickFix List" })
vim.keymap.set("n", "<leader>xx", "<cmd>XcodebuildQuickfixLine<cr>", { desc = "Quickfix Line" })
vim.keymap.set("n", "<leader>xa", "<cmd>XcodebuildCodeActions<cr>", { desc = "Show Code Actions" })
end,
}

View File

@@ -14,63 +14,34 @@ vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
dev = {
path = '~/LocalProjects/plugins',
fallback = true
path = "~/LocalProjects/plugins",
fallback = true,
},
-- Theme --
{ import = 'user.plugin.theme' },
-- Completions --
{ import = 'user.plugin.cmp' },
-- Git --
{ import = 'user.plugin.lazygit' },
-- Navigation --
{ import = 'user.plugin.neo-tree' },
{ import = 'user.plugin.telescope' },
{ import = 'user.plugin.harpoon' },
-- Utilities --
{ import = 'user.plugin.comment' },
{ import = 'user.plugin.noice' },
{ import = 'user.plugin.swift' },
{ import = 'user.plugin.toggleterm' },
{ import = 'user.plugin.which-key' },
{ import = 'user.plugin.wrapping' },
-- Import all the plugin configs in the 'plugin' directory
{ import = "user.plugin" },
-- Plugins that don't have a configuration file.
{
"folke/zen-mode.nvim",
opts = { }
opts = {},
},
{
"christoomey/vim-tmux-navigator",
lazy = false,
},
{
"NMAC427/guess-indent.nvim",
opts = { }
},
{ import = 'user.plugin.todo-comments' },
{ "NoahTheDuke/vim-just", ft = { "just" } },
{
'chipsenkbeil/distant.nvim',
branch = 'v0.3',
config = function()
require('distant'):setup()
end
"chipsenkbeil/distant.nvim",
version = "v0.*",
event = "VeryLazy",
},
}, {
checker = {
enabled = true,
notify = false,
},
change_detection = {
notify = false,
},
-- LSP, formatting, etc. --
{ 'folke/neodev.nvim', opts = {} },
{ import = 'user.plugin.lsp' },
{ import = 'user.plugin.lualine' },
{ import = 'user.plugin.treesitter' },
{ import = 'user.plugin.formatter' },
{ import = 'user.plugin.go' },
{ import = 'user.plugin.nvim-lint' },
--{'fladson/vim-kitty', lazy=true, },
})
vim.keymap.set("n", "<leader>ll", "<CMD>Lazy<CR>", { desc = "Open [L]azy" })

View File

@@ -2,7 +2,8 @@ local o = vim.opt
local wo = vim.wo
local fn = vim.fn
vim.cmd.set('inccommand=split')
vim.cmd.set("inccommand=split")
o.filetype = "on"
o.updatetime = 500 -- faster completion
o.timeoutlen = 800 -- time to wait for a mapped sequence to complete (in milliseconds)
o.ttimeoutlen = 300 -- Time in milliseconds to wait for a key code sequence to complete
@@ -33,7 +34,7 @@ o.shiftwidth = 2 -- the number of spaces inserted for each indentation
o.tabstop = 2 -- how many columns a tab counts for
o.termguicolors = true -- set term gui colors (most terminals support this)
o.cursorline = true -- highlight the current line
o.scrolloff = 8 -- Minimal number of screen lines to keep above and below the cursor
o.scrolloff = 20 -- Minimal number of screen lines to keep above and below the cursor
o.sidescrolloff = 5 -- The minimal number of columns to scroll horizontally
o.hlsearch = false -- highlight all matches on previous search pattern
o.ignorecase = true -- ignore case in search patterns

View File

@@ -0,0 +1,17 @@
-- Setup snippets here.
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local ms = ls.multi_snippet
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local t = ls.text_node
ls.add_snippets("lua", {
s("hello", {
t('print("hello '),
i(1),
t(' world")'),
}),
})

View File

@@ -0,0 +1,34 @@
-- Setup snippets here.
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local ms = ls.multi_snippet
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local t = ls.text_node
ls.add_snippets("lua", {
-- Setup a new snippet file.
s("sf", {
t({
"-- Setup snippets.",
'local ls = require("luasnip")',
"local s = ls.snippet",
"local sn = ls.snippet_node",
"local ms = ls.multi_snippet",
"local i = ls.insert_node",
"local f = ls.function_node",
"local c = ls.choice_node",
"local t = ls.text_node",
"-- Add snippets",
}),
t('ls.add_snippets("'),
i(1, "<file-type>"),
t({
'", {',
"\t-- Define snippets here.",
"})",
}),
}),
})

View File

@@ -0,0 +1,131 @@
-- Setup snippets.
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local ms = ls.multi_snippet
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local t = ls.text_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
-- Add snippets
ls.add_snippets("swift", {
-- Add a dependency snippet.
s({ trig = "@d", desc = "Add a dependency." }, fmt("@Dependency(\\.{}) var {}", { i(1), rep(1) })),
-- Add a dependency client.
s(
{
trig = "@dc",
desc = "Add a dependency client.",
},
fmt(
[[
public extension DependencyValues {{
var {}: {} {{
get {{ self[{}.self] }}
set {{ self[{}.self] = newValue }}
}}
}}
@DependencyClient
public struct {} {{
// Insert interface here.
{}
}}
extension {}: TestDependencyKey {{
public static let testValue: {} = Self()
}}
]],
{
i(1, "<name>"),
i(2, "<Dependency>"),
rep(2),
rep(2),
rep(2),
i(0),
rep(2),
rep(2),
}
)
),
s(
{ trig = "str", desc = "Add a struct" },
fmt(
[[
struct {}: {} {{
{}
}}
]],
{ i(1, "<Name>"), i(2, "<Protocols>"), i(0) }
)
),
-- Decorate a type or function with an @_spi(...)
s({ trig = "@_s", desc = "Add spi modifier." }, fmt("@_spi({})", { i(1, "name") })),
-- Add an @_spi(...) import ...
s(
{ trig = "@_si", desc = "Import with spi." },
fmt(
[[
@_spi({}) import {}
{}
]],
{ i(1, "name"), i(2, "module"), i(0) }
)
),
-- Document a function
-- TODO: add dynamic number of prameters.
s(
{ trig = "docf", desc = "Document a function." },
fmt(
[[
/// {}
///
/// - Parameters:
/// - {}: {}
]],
{ i(1, "A short description."), i(2, "<param>"), i(3, "Describe the parameter.") }
)
),
-- Add a parameter to a documentation string.
s(
{ trig = "param", desc = "Add a parameter to documentation" },
fmt(
[[
/// - {}: {}
]],
{ i(1, "<param>"), i(2, "<description>") }
)
),
-- Add a withDependencies
s(
{ trig = "wd", desc = "withDependencies" },
fmt(
[[
withDependencies {{
$0.{} = {}
}} operation: {{
@Dependency(\.{}) var {}
{}
}}
]],
{
i(1, "<dependency>"),
i(2, "<override>"),
rep(1),
rep(1),
i(0),
}
)
),
})

View File

@@ -9,3 +9,8 @@ CFM
Hydronic
subpar
quo
IAQ
wc
HVAC
dehumidification
ansible

Binary file not shown.

View File

@@ -8,9 +8,11 @@ debug="${DEBUG}"
declare -a paths=()
declare chooseOpt=
declare -a directory=()
zparseopts -D -- \
{c,-choose}=chooseOpt
{c,-choose}=chooseOpt \
{d,-directory}:=directory
#################### Helpers ####################
@@ -39,9 +41,21 @@ function setup_fuzzy_find_paths() {
debug_print "paths: $paths"
}
function create_session() {
local selected_name=$1
local selected=$2
tmux new-session -ds "$selected_name" -c "$selected" -n "editor"
tmux send-keys -t editor 'n' Enter
tmux new-window -d -n "terminal" -c "$selected"
tmux new-window -d -n 'files' -c "$selected"
tmux send-keys -t files 'yazi' Enter
}
#################### MAIN ####################
declare choose="${chooseOpt[-1]}"
declare selected=
if [[ -n $choose ]]; then
debug_print "Choose from existing."
@@ -49,6 +63,14 @@ if [[ -n $choose ]]; then
tmux list-sessions -F \#S | gum filter \
--placeholder "Pick a session..."
)
elif [ ${#directory} -gt 0 ]; then
debug_print "Using directory option."
selected=${directory[-1]}
if [ "$selected" = "." ] || [ "$selected" = "" ]; then
selected="${PWD}"
fi
debug_print "Directory: $selected"
elif [[ "$#" -eq 1 ]]; then
debug_print "Using existing session: $1"
selected=$1
@@ -72,14 +94,19 @@ selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s "$selected_name" -c "$selected"
exit 0
create_session "$selected_name" "$selected"
# tmux new-session -s "$selected_name" -c "$selected"
# exit 0
elif ! tmux has-session -t "$selected_name" 2> /dev/null; then
create_session "$selected_name" "$selected"
fi
# Create a session if it doesn't exist.
if ! tmux has-session -t "$selected_name" 2> /dev/null; then
tmux new-session -ds "$selected_name" -c "$selected"
fi
# if ! tmux has-session -t "$selected_name" 2> /dev/null; then
# tmux new-session -ds "$selected_name" -c "$selected" -n "editor"
# tmux send-keys -t editor 'n' Enter
# tmux new-window -d -n "terminal" -c "$selected"
# fi
[ -z $TMUX ] && tmux attach -t "$selected_name" \
|| tmux switch-client -t "$selected_name"

View File

@@ -0,0 +1,79 @@
#!/usr/bin/env zsh
#
# An adapter script to use gopass to store and retrieve passwords for ansible vault.
#
# When calling from ansible vault it get's passed --vault-id [ID] which is the id
# of the secret to retrieve.
#
local secretPath="ansible"
function usage() {
cat <<EOF
An adapter script that integrates gopass as storage for ansible vault id's.
To retreive a secret based on the vault id, then pass the '--vault-id' flag with an
associated [ID] to look for. (This is generally handled / passed in by the ansible-vault
command)
You can also call this script with the '--set' flag and an [ID] argument
to create a new secret for the given id. The default behavior of the
set option is to prompt for the secret, you can optionally pass the '--generate'
flag to automatically generate a secret. If an [ID] argument is not supplied to
the set option then we will prompt for the id to store the secret under.
Secrets are stored in the default password store at '$secretPath/<ID>'.
Usage: vault-gopass-client [-s | --set] [-g | --generate] [--vault-id <ID>] [ID]
-s | --set: Set a new secret for the given ID.
-g | --generate: Used with the set option to automatically generate the secret.
--vault-id <ID>: Used to retrieve a secret for the given ID.
-h | --help: Show this usage message.
Examples:
# Automatically generate a secret for the 'foo' id.
$ vault-gopass --set --generate foo
# Retrieve the secret for 'foo' and print it to stdout.
$ vault-gopass --vault-id foo
EOF
}
# parse the passed in options, failing if unrecognized options are given.
zparseopts -D -E -F - \
g=generateFlag -generate=generateFlag \
h=helpFlag -help=helpFlag \
s=setFlag -set=setFlag \
-vault-id:=vaultId \
|| exit 1
# check for the help flag, show usage and exit.
[ ${#helpFlag} = 1 ] && usage && exit 0
if [ ${#vaultId} = 2 ]; then
# we received the vault-id option, so we print the
# secret to stdout
password=$(gopass show --password "$secretPath/${vaultId[-1]}")
echo "$password"
exit 0
elif [ ${#setFlag} = 1 ]; then
# Use the first argument as the id, we ask for an id
# if not supplied.
local id=$1
if [ "$id" = "" ]; then
read -r id\?"Vault ID: "
fi
# Check for generate flag to automatically generate a password.
[ ${#generateFlag} = 1 ] \
&& gopass generate "$secretPath/$id" 24 \
&& exit 0
# Insert a password prompting the user to supply it.
gopass insert "$secretPath/$id"
fi

View File

@@ -70,12 +70,13 @@ bind-key -r K kill-pane
bind -n S-Left previous-window
bind -n S-Right next-window
bind -n M-h previous-window
bind -n M-L next-window
bind -n M-l next-window
bind C-l send-keys 'C-l'
bind f run-shell "tmux display-popup -E -w 80% -h 80% ~/.local/scripts/tmux-sessionator"
bind-key -r C run-shell -b "~/.local/scripts/tmux-sessionator ~/.dotfiles"
bind S run-shell -b "~/.config/tmux/plugins/tmux-fzf/scripts/session.sh switch"
unbind s
bind s run-shell -b "~/.config/tmux/plugins/tmux-fzf/scripts/session.sh switch"
# reload new changes
bind-key r source-file ~/.config/tmux/tmux.conf\; \display-message "source-file done"
@@ -88,24 +89,68 @@ set -g @plugin 'tmux-plugins/tmux-yank'
#set -g @plugin 'erikw/tmux-powerline'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @catppuccin_flavor 'mocha' # latte, frappe, macchiato, mocha
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules_right "directory session"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
# Configure Catppuccin
set -g @catppuccin_flavor "macchiato"
set -g @catppuccin_status_background "none"
set -g @catppuccin_window_status_style "none"
set -g @catppuccin_pane_status_enabled "off"
set -g @catppuccin_pane_border_status "off"
set -g @catppuccin_directory_text "#{pane_current_path}"
# Configure Online
set -g @online_icon "ok"
set -g @offline_icon "nok"
# Needs to stay at the bottom.
run '~/.config/tmux/plugins/tpm/tpm'
# status left look and feel
set -g status-left-length 100
set -g status-left ""
set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_red},fg=#{@thm_bg},bold]  #S },#{#[bg=#{@thm_bg},fg=#{@thm_green}]  #S }}"
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_maroon}]  #{pane_current_command} "
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_blue}]  #{=/-32/...:#{s|$USER|~|:#{b:pane_current_path}}} "
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]#{?window_zoomed_flag,│,}"
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_yellow}]#{?window_zoomed_flag,  zoom ,}"
# status right look and feel
set -g status-right-length 100
set -g status-right ""
set -ga status-right "#{?#{e|>=:10,#{battery_percentage}},#{#[bg=#{@thm_red},fg=#{@thm_bg}]},#{#[bg=#{@thm_bg},fg=#{@thm_pink}]}} #{battery_icon} #{battery_percentage} "
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│"
set -ga status-right "#[bg=#{@thm_bg}]#{?#{==:#{online_status},ok},#[fg=#{@thm_mauve}] 󰖩 on ,#[fg=#{@thm_red},bold]#[reverse] 󰖪 off }"
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│"
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_blue}] 󰭦 %Y-%m-%d 󰅐 %H:%M "
# bootstrap tpm
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Configure Tmux
set -g status-position top
set -g status-style "bg=#{@thm_bg}"
set -g status-justify "absolute-centre"
# pane border look and feel
setw -g pane-border-status top
setw -g pane-border-format ""
setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_overlay_0}"
setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_surface_0}"
setw -g pane-border-lines single
# window look and feel
set -wg automatic-rename on
set -g automatic-rename-format "Window"
set -g window-status-format " #I#{?#{!=:#{window_name},Window},: #W,} "
set -g window-status-style "bg=#{@thm_bg},fg=#{@thm_rosewater}"
set -g window-status-last-style "bg=#{@thm_bg},fg=#{@thm_peach}"
set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_bg}"
set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_bg},bold"
set -gF window-status-separator "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}]│"
set -g window-status-current-format " #I#{?#{!=:#{window_name},Window},: #W,} "
set -g window-status-current-style "bg=#{@thm_peach},fg=#{@thm_bg},bold"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

View File

@@ -1,4 +1,4 @@
local wezterm = require('wezterm')
local wezterm = require("wezterm")
local config = {}
if wezterm.config_builder then
@@ -12,14 +12,13 @@ end
-- background = "#131111"
-- }
config.color_scheme = 'Catppuccin Mocha'
config.color_scheme = "Catppuccin Mocha"
-- Font
config.font = wezterm.font_with_fallback {
'JetBrains Mono',
'Inconsolata Nerd Font Mono',
}
config.font = wezterm.font_with_fallback({
"JetBrains Mono",
"Inconsolata Nerd Font Mono",
})
config.font_size = 16.0
-- Window
@@ -28,13 +27,15 @@ config.enable_scroll_bar = false
config.initial_cols = 150
config.initial_rows = 80
config.window_padding = {
left = 5,
left = 10,
right = 5,
top = 0,
bottom = 0
bottom = 0,
}
config.window_close_confirmation = 'NeverPrompt'
config.window_close_confirmation = "NeverPrompt"
--config.window_decorations = 'TITLE'
-- Set higher fps
config.max_fps = 120
-- Tab Bar
config.show_tabs_in_tab_bar = true

193
yazi/theme.toml Normal file
View File

@@ -0,0 +1,193 @@
# https://github.com/yazi-rs/flavors.git
# Catpuccin - Mocha
# : Manager {{{
[manager]
cwd = { fg = "#94e2d5" }
# Hovered
hovered = { reversed = true }
preview_hovered = { underline = true }
# Find
find_keyword = { fg = "#f9e2af", bold = true, italic = true, underline = true }
find_position = { fg = "#f5c2e7", bg = "reset", bold = true, italic = true }
# Marker
marker_copied = { fg = "#a6e3a1", bg = "#a6e3a1" }
marker_cut = { fg = "#f38ba8", bg = "#f38ba8" }
marker_marked = { fg = "#94e2d5", bg = "#94e2d5" }
marker_selected = { fg = "#f9e2af", bg = "#f9e2af" }
# Tab
tab_active = { reversed = true }
tab_inactive = {}
tab_width = 1
# Count
count_copied = { fg = "#1e1e2e", bg = "#a6e3a1" }
count_cut = { fg = "#1e1e2e", bg = "#f38ba8" }
count_selected = { fg = "#1e1e2e", bg = "#f9e2af" }
# Border
border_symbol = "│"
border_style = { fg = "#7f849c" }
# : }}}
# : Mode {{{
[mode]
normal_main = { fg = "#1e1e2e", bg = "#89b4fa", bold = true }
normal_alt = { fg = "#89b4fa", bg = "#313244" }
# Select mode
select_main = { fg = "#1e1e2e", bg = "#a6e3a1", bold = true }
select_alt = { fg = "#a6e3a1", bg = "#313244" }
# Unset mode
unset_main = { fg = "#1e1e2e", bg = "#f2cdcd", bold = true }
unset_alt = { fg = "#f2cdcd", bg = "#313244" }
# : }}}
# : Status bar {{{
[status]
separator_open = ""
separator_close = ""
# Progress
progress_label = { fg = "#ffffff", bold = true }
progress_normal = { fg = "#89b4fa", bg = "#45475a" }
progress_error = { fg = "#f38ba8", bg = "#45475a" }
# Permissions
perm_sep = { fg = "#7f849c" }
perm_type = { fg = "#89b4fa" }
perm_read = { fg = "#f9e2af" }
perm_write = { fg = "#f38ba8" }
perm_exec = { fg = "#a6e3a1" }
# TODO: -- remove these once Yazi 0.4 gets released
separator_style = { fg = "#313244", bg = "#313244" }
mode_normal = { fg = "#1e1e2e", bg = "#89b4fa", bold = true }
mode_select = { fg = "#1e1e2e", bg = "#a6e3a1", bold = true }
mode_unset = { fg = "#1e1e2e", bg = "#f2cdcd", bold = true }
permissions_t = { fg = "#89b4fa" }
permissions_r = { fg = "#f9e2af" }
permissions_w = { fg = "#f38ba8" }
permissions_x = { fg = "#a6e3a1" }
permissions_s = { fg = "#7f849c" }
# TODO: remove these once Yazi 0.4 gets released --
# : }}}
# : Pick {{{
[pick]
border = { fg = "#89b4fa" }
active = { fg = "#f5c2e7", bold = true }
inactive = {}
# TODO: -- remove these once Yazi 0.4 gets released
[select]
border = { fg = "#89b4fa" }
active = { fg = "#f5c2e7", bold = true }
inactive = {}
# TODO: remove these once Yazi 0.4 gets released --
# : }}}
# : Input {{{
[input]
border = { fg = "#89b4fa" }
title = {}
value = {}
selected = { reversed = true }
# : }}}
# : Completion {{{
[completion]
border = { fg = "#89b4fa" }
# : }}}
# : Tasks {{{
[tasks]
border = { fg = "#89b4fa" }
title = {}
hovered = { fg = "#f5c2e7", underline = true }
# : }}}
# : Which {{{
[which]
mask = { bg = "#313244" }
cand = { fg = "#94e2d5" }
rest = { fg = "#9399b2" }
desc = { fg = "#f5c2e7" }
separator = "  "
separator_style = { fg = "#585b70" }
# : }}}
# : Help {{{
[help]
on = { fg = "#94e2d5" }
run = { fg = "#f5c2e7" }
hovered = { reversed = true, bold = true }
footer = { fg = "#313244", bg = "#cdd6f4" }
# : }}}
# : Notify {{{
[notify]
title_info = { fg = "#a6e3a1" }
title_warn = { fg = "#f9e2af" }
title_error = { fg = "#f38ba8" }
# : }}}
# : File-specific styles {{{
[filetype]
rules = [
# Images
{ mime = "image/*", fg = "#94e2d5" },
# Media
{ mime = "{audio,video}/*", fg = "#f9e2af" },
# Archives
{ mime = "application/*zip", fg = "#f5c2e7" },
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "#f5c2e7" },
# Documents
{ mime = "application/{pdf,doc,rtf,vnd.*}", fg = "#a6e3a1" },
# Fallback
{ name = "*", fg = "#cdd6f4" },
{ name = "*/", fg = "#89b4fa" }
]
# : }}}

3
yazi/yazi.toml Normal file
View File

@@ -0,0 +1,3 @@
[manager]
show_hidden = true
show_symlink = true

View File

@@ -26,8 +26,8 @@ export GITUSER="m-housh"
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
# Directories
export ANSIBLE_GEN_DIR="$GHREPOS/ansible/ansible-gen-playbook"
export ANSIBLE_LOCAL="$GHREPOS/ansible"
export ANSIBLE_LOCAL="$REPOS/ansible"
export ANSIBLE_GEN_DIR="$ANSIBLE_LOCAL/ansible-gen-playbook"
export ANSIBLE_MACOS_PLAYBOOK_DIR="$HOME/ansible-macos-playbook"
export ARCHIVE="/Volumes/Archive"
export BUCKET="/Volumes/Bucket"
@@ -78,8 +78,8 @@ export VAULT_ADDR="https://vault.housh.dev"
# Ansible
export ANSIBLE_HOME="$XDG_CONFIG_HOME/ansible"
export ANSIBLE_VAULT_PASSWORD_FILE="$XDG_DATA_HOME/ansible/.vaultpwd"
export DEFAULT_VAULT_PASSWORD_FILE="$XDG_DATA_HOME/ansible/.vaultpwd"
export ANSIBLE_VAULT_PASSWORD_FILE="$SCRIPTS/vault-gopass-client"
export DEFAULT_VAULT_PASSWORD_FILE="$SCRIPTS/vault-gopass-client"
# Tmux-Sessionator path.
export TMUX_SESSIONATOR_PATH="$HOME:$SCRIPTS:$LOCAL_REPOS:$REPOS:$ANSIBLE_LOCAL:$GHREPOS:$HVACIOTREPOS"

View File

@@ -61,9 +61,11 @@ path_prepend \
"/usr/local/bin" \
"/opt/homebrew/bin" \
"/opt/homebrew/sbin" \
"$HOME/.local/share/gem/bin" \
"$GOROOT/bin" \
"$GOPATH/bin" \
"$XDG_DATA_HOME/bin" \
"$HOME/.local/bin" \
"$SCRIPTS"
# last arg will be first in $FPATH
@@ -71,7 +73,7 @@ fpath_prepend \
"$(brew --prefix)/share/zsh/site-functions" \
"$(brew --prefix)/share/zsh-completions" \
"$ZDOTDIR/completions" \
"$HOME/.local/completions" \
"$HOME/.local/share/zsh/completions" \
"$ZDOTDIR/functions"
autoload -Uz $fpath[1]/*(.:t)
@@ -96,7 +98,7 @@ export HISTFILE=$ZDOTDIR/history
setopt autocd
# NOTE: This may be overriden in local env overrides (typically located in $XDG_DATA_HOME/zsh/env.zsh
export CDPATH=".:$GHREPOS:$GHREPOS/ansible:$REPOS/github.com:$DOTFILES:$LOCAL_REPOS:$HOME"
export CDPATH=".:$REPOS:$REPOS/ansible:$DOTFILES:$LOCAL_REPOS:$BUCKET:$HOME"
#------------------------------ options ------------------------------
# (see `man zshoptions`)
@@ -122,9 +124,6 @@ zsh_add_plugin "zsh-users/zsh-autosuggestions"
zsh_add_plugin "zsh-users/zsh-syntax-highlighting"
zsh_add_plugin "Aloxaf/fzf-tab"
# Use fzf in history / search contexts.
eval "$(fzf --zsh)"
#------------------------------ completions ------------------------------
# case insensitive path-completion
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
@@ -184,11 +183,15 @@ alias pf='pass fzf' # fuzzy find a password quickly and copy
alias pg='gopass show' # get an attribute of a password file quickly.
alias pgc='gopass show --clip' # get an attribute of a password file and copy to the clipboard.
alias reload='exec zsh -l' # reload the shell, useful when making changes.
alias s='swift' # shorthand to access swift commands
alias st='swift test' # swift test
alias sb='swift build' # swift build
alias t='tmux' # access tmux quickly
alias tka='tmux kill-server' # kill tmux server and all sessions.
alias ts='$SCRIPTS/tmux-sessionator' # create new tmux session, fuzzy finding common locations.
alias tss='$SCRIPTS/tmux-sessionator --choose' # attach to an existing tmux session.
alias tls='tmux list-sessions' # list tmux sessions
alias tks='tmux kill-session -t' # kill tmux session
alias temp='cd $(mktemp -d)' # create a temporary directory and move into it.
alias vi='nvim' # set vi to open neovim
alias newf='"$SCRIPTS"/newx --function' # generate a new shell function
@@ -199,6 +202,10 @@ alias nvim-kickstart='NVIM_APPNAME=kickstart nvim' # set neovim to use kickst
alias nvim-lazy='NVIM_APPNAME=lazy nvim' # set neovim to use lazy config.
alias wget="wget --hsts-file=$XDG_DATA_HOME/wget-hsts" # set wget history location.
# NOTE: This needs to stay near the bottom, or it doesn't work properly.
# Use fzf in history / search contexts.
source <(fzf --zsh)
#------------------------------ local configs ------------------------------
# TODO: The .zshrc-local is a legacy location and should be removed once my machines are
@@ -207,4 +214,3 @@ alias wget="wget --hsts-file=$XDG_DATA_HOME/wget-hsts" # set wget history locat
# I tried sourcing them in the the `.zshenv` files, but did not work.
_source_if "$ZDOTDIR/.zshrc-local"
_source_if "$LOCAL_ENV"

View File

@@ -9,36 +9,9 @@
# the current working directory.
function tns() {
local session_name=
local tmux_dir=
# parse the session, if based on the directory of the argument passed in.
# otherwise use the current directory.
[ -n "$1" ] && \
session_name=$(basename "$1" | tr . _) && \
tmux_dir="$1"
[ -z "$session_name" ] \
&& session_name=$(basename "$PWD" | tr . _) && \
tmux_dir="$PWD"
tmux_running=$(pgrep tmux)
# check if tmux is not running / attached to a session.
# if not, then create a new session.
if [ -z $TMUX ] && [ -z $tmux_running ]; then
tmux new-session -s "$session_name" -c "$tmux_dir" && return 0
local directory=$1
if [ -n "$directory" ]; then
directory=${PWD}
fi
# create a session if it doesn't exist, in the background, so
# that we can switch sessions.
if ! tmux has-session -t "$session_name" 2> /dev/null; then
tmux new-session -ds "$session_name" -c "$tmux_dir"
fi
# attach to the session or switch if it already exists.
[ -z $TMUX ] && \
tmux attach -t "$session_name" \
|| tmux switch-client -t "$session_name"
tmux-sessionator --directory "$directory"
}