Compare commits

...

117 Commits

Author SHA1 Message Date
Paul Stemmet e0e3d72e8e
nvim: fix lsp.preset.Rust opts handling
Passed structure was incorrect
2024-09-08 19:26:10 +00:00
Paul Stemmet ac705ce937
merge: develop <--- feat/nvim-minor-improvements
* HEAD
| \
| * 38568df <github@luxolus.com> nvim: improve cspell.json file handling
| * afaf382 <github@luxolus.com> nvim: improve ToggleGutter to remove indent trace, diagnostics
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2024-09-07 16:09:00 +00:00
Paul Stemmet 38568df712
nvim: improve cspell.json file handling
This doesn't handle looking for workspace level files, but will stop
the "Add word to dictionary" code action from creating random
cspell.json files in whatever vim considers to be the current working
directory.

Eventually, I'd like to move this all into neoconf.json, but this is
better than the current, non functional state
2024-09-07 16:05:42 +00:00
Paul Stemmet afaf382e25
nvim: improve ToggleGutter to remove indent trace, diagnostics
So that it fulfills its intended purpose: making vim ready for terminal
level copying.

This removes the extra overlay'd text segments from the window
2024-09-07 16:05:15 +00:00
Paul Stemmet 7724f3d086
merge: develop <--- feature/LazyVim
* HEAD
| \
| * fbc0ca3 <github@luxolus.com> docs: update README for nvim changes
| * 80ed55f <github@luxolus.com> zshrc: add podman,bazel opt plugs
| * ad874d1 <github@luxolus.com> zshrc: rm PSOXIZSH_EXPERIMENTAL_NEOVIM_LUA flag
| * 269c980 <github@luxolus.com> nvim: add psoxizsh.function key binds
| * 055ce78 <github@luxolus.com> nvim: use Global.* key binds in psoxizsh.plugins
| * 69a424a <github@luxolus.com> nvim: use Buffer.Lsp key binds in psoxizsh.lsp.key
| * f22a04f <github@luxolus.com> nvim: add psoxizsh.functions
| * aa49be0 <github@luxolus.com> nvim: refactor psoxizsh.key
| * 478c623 <github@luxolus.com> init.lua: rewrite nvim entrypoint to use psoxizsh.entrypoint
| * f4cf1b7 <github@luxolus.com> nvim: add psoxizsh.entrypoint
| * b17c563 <github@luxolus.com> nvim: add psoxizsh.entrypoint.profile
| * 585e13d <github@luxolus.com> nvim: add psoxizsh.startup.keybinds
| * 1637296 <github@luxolus.com> nvim: add psoxizsh.startup
| * bf29a51 <github@luxolus.com> nvim: add psoxizsh.plugins.ide
| * 9add4b0 <github@luxolus.com> nvim: add psoxizsh.lsp.keys
| * 0a15980 <github@luxolus.com> nvim: add psoxizsh.plugins.editor
| * 388b6da <github@luxolus.com> nvim: add psoxizsh.plugins.treesitter
| * ecb1bc2 <github@luxolus.com> nvim: add psoxizsh.plugins.ui
| * 1613c7b <github@luxolus.com> nvim: add psoxizsh.plugins.colorscheme
| * 3a56818 <github@luxolus.com> nvim: add psoxizsh.plugins.core
| * cf879d6 <github@luxolus.com> nvim: add psoxizsh.lsp.preset servers
| * b22285e <github@luxolus.com> nvim: add psoxizsh.lsp.core
| * f4a32dc <github@luxolus.com> nvim: add submodule lazy.nvim
| * fff545c <github@luxolus.com> nvim: rm psoxizsh.plugins.plug
| * 85081d7 <github@luxolus.com> nvim: rm old psoxizsh.lsp.{preset,servers,util} modules
| * ad7f34b <github@luxolus.com> nvim: rm orphaned modules psoxizsh.{plugins.bootstrap,diagnostic}
| * 5e80c28 <github@luxolus.com> repo: rm examples/ nvim/spellfile
| * 53ade04 <github@luxolus.com> repo: update submodules
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2024-08-31 19:02:05 +00:00
Paul Stemmet fbc0ca3713
docs: update README for nvim changes 2024-08-31 18:37:08 +00:00
Paul Stemmet 80ed55f65d
zshrc: add podman,bazel opt plugs 2024-08-31 18:28:07 +00:00
Paul Stemmet ad874d18aa
zshrc: rm PSOXIZSH_EXPERIMENTAL_NEOVIM_LUA flag
Instead, we now presume that if neovim is installed, the user will use
it over the default vim.

We also slightly refactor the entrypoint for neovim, using the default
paths for MYVIMRC, over setting VIMINIT and MYVIMRC explicitly.
2024-08-31 18:28:06 +00:00
Paul Stemmet 269c980010
nvim: add psoxizsh.function key binds 2024-08-31 18:28:06 +00:00
Paul Stemmet 055ce78bbd
nvim: use Global.* key binds in psoxizsh.plugins 2024-08-31 18:28:06 +00:00
Paul Stemmet 69a424a081
nvim: use Buffer.Lsp key binds in psoxizsh.lsp.key 2024-08-31 18:28:06 +00:00
Paul Stemmet f22a04f130
nvim: add psoxizsh.functions
these are a collection of functions that we have built in house, those
their insides replaced to work better with the new plugin manager

namely

- Format
- OpenConfig
- ToggleGutter
2024-08-31 18:28:05 +00:00
Paul Stemmet aa49be08cb
nvim: refactor psoxizsh.key
We remove the old bind.lua functionality for creating recursive auto
initialized groups of bindings, replacing it with a simpler data
structure that only provides a common, simple mechanism for storing all
the information needed to make a new key bind in the future.

This change is good for two reasons:

1. the luals LSP can now provide autocompletion for keybinds
2. the module is much simpler, and can be extended easily to map the
   existing data structure into other formats, like the one used by
   lazy.nvim's keys map, or Neovim's own vim.keymap.set

We also update, refactor and rename the old map.lua file to binds.lua,
so that we remain consistent in our terminology with Neovim itself

Lastly, we touch up key/init.lua to handle these changes, and make it
easier for others to potentially create their own keybinds
2024-08-31 18:28:04 +00:00
Paul Stemmet 478c623268
init.lua: rewrite nvim entrypoint to use psoxizsh.entrypoint
Plus, add a detailed description of the new location(s) for configuration, and
a brief overview of how plugins work
2024-08-31 18:28:04 +00:00
Paul Stemmet f4cf1b75db
nvim: add psoxizsh.entrypoint
these modules serve as the entrypoint for users to enter psoxizsh's
neovim configuration.
2024-08-31 18:28:04 +00:00
Paul Stemmet b17c56305c
nvim: add psoxizsh.entrypoint.profile
These are simple "prebaked" functions that can modify the PsoxizshConfig
object before it is utilized further.

It allows the primary users of this repo to have seperate "profiles"
that they can maintain in the main code base, while also allowing others
to just pass a similiar function to PsoxizshConfig.profile.
2024-08-31 18:28:04 +00:00
Paul Stemmet 585e13d3d9
nvim: add psoxizsh.startup.keybinds
Add our standard keybinds, largely picked from LazyVim's
config/keymap.lua file, filtered down to our taste.

Probably some of these should become configurable in the
future.

References: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
2024-08-31 18:28:04 +00:00
Paul Stemmet 1637296d69
nvim: add psoxizsh.startup
This commit rewrites the psoxizsh init to conform to lazy.nvim plugin
schema.

This is a port of the old early/pre/post/late stages we used to use to
functions we can call during our toplevel module's eventual setup()
call.

We should probably add optional callbacks to each so that users can
retain the older method of initialization...
2024-08-31 18:28:03 +00:00
Paul Stemmet bf29a51829
nvim: add psoxizsh.plugins.ide 2024-08-31 18:28:03 +00:00
Paul Stemmet 9add4b0481
nvim: add psoxizsh.lsp.keys
This is our inhouse overrides over LazyVim's key maps for the LSP on_attach
function.

Unfortunately there's no good way to do this, other than directly
mutating the key binds LazyVim creates
2024-08-31 18:28:03 +00:00
Paul Stemmet 0a15980464
nvim: add psoxizsh.plugins.editor 2024-08-31 18:28:03 +00:00
Paul Stemmet 388b6daa3a
nvim: add psoxizsh.plugins.treesitter 2024-08-31 18:28:03 +00:00
Paul Stemmet ecb1bc2965
nvim: add psoxizsh.plugins.ui 2024-08-31 18:28:03 +00:00
Paul Stemmet 1613c7b94d
nvim: add psoxizsh.plugins.colorscheme 2024-08-31 18:28:03 +00:00
Paul Stemmet 3a56818202
nvim: add psoxizsh.plugins.core 2024-08-31 18:28:02 +00:00
Paul Stemmet cf879d6999
nvim: add psoxizsh.lsp.preset servers 2024-08-31 18:28:02 +00:00
Paul Stemmet b22285ef0f
nvim: add psoxizsh.lsp.core
Adds back some of the functionality of the late lsp.server, such that we
can paper over the exact implementation details of _how_ we're enabling
the language server.

In practice, this will allow us to create a bunch of preset
PsoxizshLspServer types, which users can then opt into enabling in their
plugin/* configs
2024-08-31 18:28:02 +00:00
Paul Stemmet f4a32dc0ba
nvim: add submodule lazy.nvim 2024-08-31 18:28:02 +00:00
Paul Stemmet fff545ce8a
nvim: rm psoxizsh.plugins.plug
this is will be broken up and readded in future commits, to conform with
the LazyVim method of plugin config
2024-08-31 18:28:01 +00:00
Paul Stemmet 85081d79b0
nvim: rm old psoxizsh.lsp.{preset,servers,util} modules 2024-08-31 18:28:01 +00:00
Paul Stemmet ad7f34b624
nvim: rm orphaned modules psoxizsh.{plugins.bootstrap,diagnostic}
these are superseded by lazy.nvim's superior bootstrap process, and
LazyVim's builtin diagnostic configuration
2024-08-31 18:28:01 +00:00
Paul Stemmet 5e80c28f26
repo: rm examples/ nvim/spellfile
these are not relevant or useful, anymore.
2024-08-31 18:28:00 +00:00
Paul Stemmet 53ade04eb5
repo: update submodules 2024-08-31 18:28:00 +00:00
Paul Stemmet 2c08b914c1
merge: develop <--- feature/nvim-0.9-updates
* HEAD
| \
| * ad66707 <github@luxolus.com> nvim: update plugins for nvim v0.9
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2024-07-07 21:31:35 +00:00
Paul Stemmet ad6670791a
nvim: update plugins for nvim v0.9
Largely, this is simply bumping versions and fixing a few configurations
that were changed in newer versions of the plugins.

I did however notice our package manager (packer.nvim) is orphaned now,
and I need to switch to a different one in the near future...
2024-07-07 21:30:47 +00:00
psox st8l 45d7789e15 Update git sub-modules and add zsh-vi-mode
- cloned oh-my-zsh to dolysis the repo and replaced it here
  upstream should now be https://git.st8l.com/dolysis/ohmyzsh.git
2023-11-19 13:35:53 +00:00
Paul Stemmet f02c998488
merge: develop <--- feature/null-ls-cspell
* HEAD
| \
| * 3e1e459 <github@luxolus.com> nvim/plug: add null-ls.nvim@main, cspell.nvim@main
| * 5311f20 <github@luxolus.com> nvim/plug: rm cmp-spell
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2023-06-08 15:37:12 +00:00
Paul Stemmet 3e1e459c50
nvim/plug: add null-ls.nvim@main, cspell.nvim@main
These gives us back the ability to use cspell, which was lost in the
transition from coc-nvim to our current lua based setup.

However, it requires the following to take effect:

1. Have nodejs installed (nvm is fine)
2. Run ':MasonInstall cspell'
3. Run ':PackerCompile'
4. Restart

All goes well, when you next open nvim, you should have cspell powered
spell checking and :LspInfo should show null-ls running.

Word substitutes triggered via:
  @Buffer.Lsp.N.Leader.CodeAction

Next/Prev word (or other diagnostic) via:
  @Global.N.DiagnosticNext
  @Global.N.DiagnosticPrev

Where @ = nvim/lua/psoxizsh/key/bind.lua
2023-06-08 15:10:46 +00:00
Paul Stemmet 5311f2013e
nvim/plug: rm cmp-spell
This will be superseded by the coming cspell integration
2023-06-08 15:09:54 +00:00
Paul Stemmet f4cc11581f
merge: develop <--- fix/misc
* HEAD
| \
| * 707f9da <github@luxolus.com> nvim/plug/cmp: various fixes
| * c9d7e5c <github@luxolus.com> nvim/key/map: fix Lsp.FormatDocument action
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2023-06-04 22:02:08 +00:00
Paul Stemmet 707f9daafe
nvim/plug/cmp: various fixes
- Pull completions from all buffers, not just current
- Limit total items to 15
- Better organization of cmd completions
2023-06-04 22:00:26 +00:00
Paul Stemmet c9d7e5ca50
nvim/key/map: fix Lsp.FormatDocument action
neovim moved buf.formatting to buf.format, a while back, leaving this as
effectively setting `action = null`, which throws warnings on start; so
we fix that.
2023-06-04 21:25:56 +00:00
Paul Stemmet 5f07c09d46
merge: develop <--- feature/improve-cmp-cmdline
* HEAD
| \
| * 7c38526 <github@luxolus.com> nvim/plug: improve cmdline (:) completions
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2023-04-02 16:00:20 +00:00
Paul Stemmet 7c385263f1
nvim/plug: improve cmdline (:) completions
This commit enables nvim-cmp's cmdline completion support, overriding
the builtin neovim's.

We gain a nicer menu, more sources (paths, history), and a slightly more
intelligent listing with some support for file specific commands (e, r,
w).

We also switch out the 'path' completion source with 'async_path',
preventing delays / freezes when traversing slow or large fs trees
2023-04-02 15:56:01 +00:00
Paul Stemmet 79a7215464
merge: develop <--- feature/sumneko-to-lua-ls
* HEAD
| \
| * 3110368 <github@luxolus.com> nvim/lsp: preset.Lua sumneko_lua -> lua_ls
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2023-04-02 14:57:28 +00:00
Paul Stemmet 31103686c5
nvim/lsp: preset.Lua sumneko_lua -> lua_ls
As the server has been renamed in lspconfig

References: 501cfd09b9
2023-04-02 14:56:42 +00:00
Paul Stemmet e10d704780
merge: develop <--- fix/colorscheme-name
* HEAD
| \
| * c7039c1 <github@luxolus.com> nvim/init: g.my_color_scheme: onedarkpro->onedark
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2023-01-02 11:30:52 +00:00
Paul Stemmet c7039c10da
nvim/init: g.my_color_scheme: onedarkpro->onedark
Fixes breaking change in upstream.

Upstream-Ref: e3369ba112
2023-01-02 11:27:11 +00:00
Paul Stemmet 3fbebc60e3
merge: develop <--- feature/code-action
* HEAD
| \
| * a46119d <github@luxolus.com> nvim/psoxizsh: misc. tidying of init scripts
| * 70eb4b4 <github@luxolus.com> nvim/key: Buffer.Lsp.N.Leader.CodeAction
| * 9a41cb4 <github@luxolus.com> nvim/plug: +dressing@master
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-12-09 20:23:54 +00:00
Paul Stemmet a46119d7b8
nvim/psoxizsh: misc. tidying of init scripts
Some formatting changes, and an improvement to ReloadConfig/0 to print
out a message when configuration has been reloaded
2022-12-09 20:23:39 +00:00
Paul Stemmet 70eb4b400a
nvim/key: Buffer.Lsp.N.Leader.CodeAction 2022-12-09 20:23:39 +00:00
Paul Stemmet 9a41cb4bb4
nvim/plug: +dressing@master
This is a plugin which overrides vim.prompt and vim.input handlers,
providing Telescope integration, and a much more pleasant experience
over the default menus provided by nvim.

The primary reason for this plugin is vim.lsp.buf.code_action/1, which
uses vim.input.
2022-12-09 20:23:39 +00:00
Paul Stemmet 08761102fd
merge: develop <--- fix/keymap-group-newindex
* HEAD
| \
| * 6978596 <github@luxolus.com> nvim/key: add __newindex meta to bind.Group
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-12-09 20:23:26 +00:00
Paul Stemmet 6978596066
nvim/key: add __newindex meta to bind.Group
This allows callers of the struct to perform the more normal '='
assignment and have sane behavior.

Previously, this would not do what one expects when used with bind.Bind
or other bind.Group(s): it merely adds them to the Group object
directly, not adding it to the ._children table or downward propagating
the Group's settings.

This is fixed here, by adding a __newindex metamethod to the bind.Group
object, which checks to see if the addition is a known Bind or Group
type, and does the right if it is, falling back to the previous behavior
if it isn't
2022-12-09 20:23:12 +00:00
Paul Stemmet 9be9933052
merge: develop <--- fix/load-file-autos-early
* HEAD
| \
| * 7a1ce7b <github@luxolus.com> nvim/psoxizsh: move PsoxFileAutos to early config
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-12-09 20:22:49 +00:00
Paul Stemmet 7a1ce7b98a
nvim/psoxizsh: move PsoxFileAutos to early config
As otherwise it appears they load too late, and will sporadically be
ignored when loading files.
2022-12-09 20:22:08 +00:00
Paul Stemmet 0553bbc116
merge: develop <--- fix/unclobber-module-errors
* HEAD
| \
| * ff33cf5 <github@luxolus.com> nvim/util: report mload module errors
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-12-09 20:21:41 +00:00
Paul Stemmet ff33cf52d9
nvim/util: report mload module errors
This commit unclobbers syntax and other errors that can occur when
loading a module.

Previously, we just pcall/2'd any inputs and silently assumed that any
error reported meant the module didn't exist. The changes within add a
third branch to the mix: EXISTS, NOT_FOUND, and LOAD_ERR.

We keep the previous behaviour of not throwing when an error is
detected, but we do print out a big, red, angry message now.

As a side note, this should also slightly improve performance, due to
less errors being thrown; on account of us manually detecting whether a
module exists or not.
2022-12-09 20:21:15 +00:00
psox 6e8bbd4e22 README.md: Update to reflect new repository 2022-11-10 18:45:26 +00:00
psox b4ac43c337 examples/nvim: Added some example files
These file should be added to ~/.config/nvim and can be used as
the basis for customizations you want to add
2022-11-10 18:30:14 +00:00
psox b95014ff08 zshrc: fix issue with paru alias 2022-11-10 18:29:26 +00:00
Paul Stemmet 43a20358cc
merge: develop <--- fix/cmp-lsp-and-lua-dev-rename
* HEAD
| \
| * eaa530e <github@luxolus.com> nvim/plug: lua-dev -> neodev
| * 5798da7 <github@luxolus.com> nvim/plug/lspconfig: use cmp.defaults_capabilities/0
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-29 20:43:42 +00:00
Paul Stemmet eaa530e16d
nvim/plug: lua-dev -> neodev
plugin was renamed upstream, and now provides a hook for lspconfig,
making our override/1 work more in line with the standard 'override
the lspconfig.setup/1 param' that most of the other presets follow.
2022-10-29 20:15:44 +00:00
Paul Stemmet 5798da7368
nvim/plug/lspconfig: use cmp.defaults_capabilities/0
cmp.update_capabilities are deprecated as of hrsh7th/cmp-nvim-lsp@389f06d,
so use replacement instead.
2022-10-29 18:27:19 +00:00
Paul Stemmet dc8168aeed
merge: develop <--- fix/gitsigns-nvim-080
* HEAD
| \
| * eb0a6b1 <github@luxolus.com> nvim/plug: gitsigns.branch = main
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-08 20:28:35 +00:00
Paul Stemmet eb0a6b1899
nvim/plug: gitsigns.branch = main
Until lewis6991/gitsigns.nvim#613 is fixed
2022-10-08 20:26:34 +00:00
Paul Stemmet 846a710863
merge: develop <--- fix/various-plugin-configs
* HEAD
| \
| * 9f1587f <github@luxolus.com> nvim/spellfile: add more common words
| * b62a59e <github@luxolus.com> nvim/plug/cmp-spell: fix path expansion
| * 9e6a96c <github@luxolus.com> nvim/diagnostic: clobber repeated diagnostic floats
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-08 18:17:08 +00:00
Paul Stemmet 9f1587fe24
nvim/spellfile: add more common words 2022-10-08 18:12:24 +00:00
Paul Stemmet 9199326bf3
merge: develop <--- feature/nvim-super-keys
* HEAD
| \
| * 8d00216 <github@luxolus.com> nvim/key: add Super keys
| * 15e7729 <github@luxolus.com> nvim/plug: +toggleterm.nvim@v2
| * 69974b4 <github@luxolus.com> nvim/plug: +trouble.nvim@master
| * d6f7bba <github@luxolus.com> nvim/plug: +telescope.nvim@0.1.x, -fzf, -fzf.nvim
| * 3cb079b <github@luxolus.com> nvim/plug/neotree: <F2> -> <C-Left>
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-08 18:11:09 +00:00
Paul Stemmet b62a59e17b
nvim/plug/cmp-spell: fix path expansion
Silly mistakes:

1. Only running `vim.fn.expand/1` in the if check
2. Using `vim.fn.exists/1` for file checks (it doesn't do this)

Just rip the whole loop out, as probably a user isn't expecting
`[count]spell-action` to select different files depending on whether
they (and how many of them) exist.

Still leaves the problem of file creation, but ¯\_(ツ)_/¯
2022-10-08 16:51:44 +00:00
Paul Stemmet 9e6a96c5b0
nvim/diagnostic: clobber repeated diagnostic floats
Due to the way we render `vim.diagnostic.open_float/1` on every `CursorHold`
event, this window will open over other floats that a user (may have)
opened, particularly `keys.Buffer.Lsp.N.ShowDocumentation`, which can be
frustrating.

This commit changes the behaviour to open the diagnostic float once per
cursor location, as this is probably what the user wants for the most
part. It is still possible for a user to run into the scenario where
they move to a diagnostic and open a float only for it to be replaced
on the `CursorHold`, but this should be much more infrequent.

Credit to github.com/wookayin for explaining how to do this.
See:
  wookayin/dotfiles@ee687b036c
  /nvim/lua/config/lsp.lua
  #L249-L263
2022-10-08 16:51:44 +00:00
Paul Stemmet 8d00216396
nvim/key: add Super keys
super keys are super powered binds accessible via <C-Arrow_Key>, for
example, <C-Left> opens the current file tree.

These binds are expected to be used often and provide 4 fundamental
features:

1. Terminal               | <C-Up>
2. Fuzzy Search           | <C-Right>
3. Workspace diagnostics  | <C-Down>
4. File tree              | <C-Left>

Each is powerful, but can be thought of as a different 'mode' that
should be intentionally invoked by the user.

Fuzzy search has perhaps the most potential of the supers, allowing for
everything from fuzzy file searches to direct integration with the
active LSP, allowing for fuzzy searching of actual symbols; functions,
classes, etc.

A builtin terminal is useful for running background jobs (compiles,
tests), and is generally useful for all the things a shell is when you
don't have a multiplexer of some kind (tmux, good terminal, etc)

A file tree is useful for IDE like movement between files and getting a
general view of the current workspace's git +-~ status. Not mention for
deletion and/or movement of files.

Last but not least, diagnostics are great for understanding the active
codebase's health, and for providing an aggregate overview of
outstanding issues in the code.
2022-10-08 16:51:37 +00:00
Paul Stemmet 15e77291d9
nvim/plug: +toggleterm.nvim@v2
Provides a floating terminal window that can be easily toggled, bound to
`<C-Up>`.

Not much more to say, this is just awesome.
2022-10-08 16:51:03 +00:00
Paul Stemmet 69974b4d7e
nvim/plug: +trouble.nvim@master
This plugin provides a concise listing of current diagnostic messages
across the workspace, grouped by file.

It replaces neomake / quickfix lists, and importantly is a lot less
buggy, faster and less intrusive than the previous solution.

You can toggle it via `<C-Down>`.
2022-10-08 16:51:03 +00:00
Paul Stemmet d6f7bbaa3a
nvim/plug: +telescope.nvim@0.1.x, -fzf, -fzf.nvim
This commit removes (direct) FZF plugins in favor of telescope.nvim,
which provides a significantly nicer, native experience in doing fuzzy
searching.

The primary out of the box method for interacting with Telescope is
through the <C-Right> super key, which opens a 'meta-menu' of searchers
that you can choose from.

Some of the more interesting options are 'find_files', 'live_grep_search',
and 'lsp_symbols'. Note that you can use fuzzy searching for these. For
example, the chord <C-Right>ff<CR> brings up the 'find_files' menu.

Users are encouraged to create their own key maps for commonly used
searchers.

Also ignore Telescope windows in pear-tree as pear-tree's <CR> bind seems
to interact poorly with Telescope usage of <CR> (i.e it blocks it completely),
so we disable it
2022-10-08 16:50:34 +00:00
Paul Stemmet 3cb079be10
nvim/plug/neotree: <F2> -> <C-Left>
and remove old diagnostic settings, as we use a separate file for that
now
2022-10-05 18:38:09 +00:00
Paul Stemmet 72434c743e
merge: develop <--- feature/nvim-completion
* HEAD
| \
| * b263e62 <github@luxolus.com> nvim/init.post: add color overrides
| * c7ba099 <github@luxolus.com> nvim/spellfile: add base wordlist
| * 178d0a7 <github@luxolus.com> nvim/plug: +cmp-spell@master
| * 267fb25 <github@luxolus.com> nvim/plug: +nvim-cmp@master +cmp plugins...
| * b3cbfbd <github@luxolus.com> nvim/diagnostic: configure neovim's diagnostics API
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-05 18:37:31 +00:00
Paul Stemmet b263e62f3a
nvim/init.post: add color overrides
As something keeps resetting these, we'll just reset them right back
2022-10-05 18:36:55 +00:00
Paul Stemmet c7ba09929a
nvim/spellfile: add base wordlist
These are just the words I came across while doing development,
presumably there will be many more in the future
2022-10-05 18:36:55 +00:00
Paul Stemmet 178d0a7340
nvim/plug: +cmp-spell@master
This commit adds integration for the builtin spell checker to our auto
completion engine.

Now, unfortunately, it is not nearly as intelligent as coc-spell-checker
is, and is missing _lots_ of common words that I/we use every day.

To alleviate this a bit, there are three spell files that can be used to
add/remove/override spell words:

1. <workspace>/.vim/words.utf-8.add
2. ~/.config/nvim/words.utf-8.add
3. $PSOXIZSH/nvim/spellfile/words.utf-8.add

You may also easily add / remove words from a given file via:

- [count]<Leader>ss: Whitelist word in `count` spell file, defaulting to
  the lowest write-able file
- [count]<Leader>sw: Blacklist word in `count` spell file, defaulting to
  the lowest write-able file
- [count]<Leader>sus: Undo whitelist word in `count` spell file
- [count]<Leader>suw: Undo blacklist word in `count` spell file
- ]s: Next bad word
- [s: Previous bad word
2022-10-05 18:36:54 +00:00
Paul Stemmet 267fb252c7
nvim/plug: +nvim-cmp@master +cmp plugins...
This commit adds (nvim-)cmp as our completion engine / framework.

We also add completion sources for (file)paths, buffer contents, LSP
actions and snippets -- courtesy of vsnip.

This provides similar functionality to coc's completion engine, but
with (much) better support for LSP actions, lua native key maps and
significantly more configuration options that can be easily overridden
but psoxizsh users.

We add similar default key maps as with what existed in coc, namely
that <CR> exits the autocompletion window, <C-Space> does the selected
LSP action, <Tab>/<S-Tab> cycles through options and <PageUp/Down>
scrolls documentation of the current item.

We also explicitly enable completion / snippet support in client capacities
sent to LSP servers, as many require this before offering completions
2022-10-05 18:36:54 +00:00
Paul Stemmet b3cbfbd26f
nvim/diagnostic: configure neovim's diagnostics API
Basic run down is:

- Disable virtual_text
- Add severity icons
- Add key maps for goto prev/next diagnostic
- Add diagnostic popup on hover
2022-10-05 18:36:54 +00:00
Paul Stemmet ccf65fecb1
merge: develop <--- feature/nvim-lsp
* HEAD
| \
| * b43f8da <github@luxolus.com> nvim/plug: +nvim-treesitter@master
| * 67d2949 <github@luxolus.com> nvim/plug: +rust-tools.nvim@master, +lua-dev.nvim@master
| * baeffe7 <github@luxolus.com> nvim/plug: +fidget@master
| * 93cdfd0 <github@luxolus.com> nvim/plug: +nlsp-settings.nvim@main
| * 6c34c88 <github@luxolus.com> nvim/plug: +nvim-lspconfig@master
| * bb937f9 <github@luxolus.com> nvim/plug: -coc.nvim -neomake +mason.nvim@main +mason-lspconfig.nvim@main
| * bb4fa19 <github@luxolus.com> nvim/plug: -nvim-yarp -vim-hug-neovim-rpc
| * 635eb80 <github@luxolus.com> nvim/lsp/servers: add json,yaml,vim,lua
| * af4b4fa <github@luxolus.com> nvim/lsp/preset: add presets for many languages
| * 7ff228a <github@luxolus.com> nvim/lsp/util: add Servers, Server, Filter
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-05 18:34:34 +00:00
Paul Stemmet b43f8da756
nvim/plug: +nvim-treesitter@master
Adds support for treesitter syntax / grammars when editing files.

This is currently an experimental neovim feature but is (very) likely to
be merged into the upstream in one of the next releases.
2022-10-05 18:33:40 +00:00
Paul Stemmet 67d2949984
nvim/plug: +rust-tools.nvim@master, +lua-dev.nvim@master
These are helper plugs for setting up the language servers for Rust
and Lua respectively
2022-10-05 18:33:40 +00:00
Paul Stemmet baeffe7989
nvim/plug: +fidget@master
This is a plugin for reporting '$/progress' status messages from neovim.

Realistically, only (some) LSP servers actually use this, but it
provides a clean, minimal method for understanding what an LSP is
working on at the minute.

`Server.Rust`, `Server.Lua` and `Server.Json` support it at a minimum,
from my personal testing
2022-10-05 18:33:40 +00:00
Paul Stemmet 93cdfd051f
nvim/plug: +nlsp-settings.nvim@main
This plugin provides project (and user) local configuration files for
LSP settings, similiar to coc-settings files.

By default, it will search

- $HOME/.config/nlsp-settings/<language-server>.json
- <project-root>/.nlsp-settings/<language-server>.json

for configuration, automatically updating the language server with the
settings found within. These override any settings set within lua...
bare this in mind.

You may access the associated files via:

:LspSettings [local] <language>|buffer
2022-10-05 18:33:40 +00:00
Paul Stemmet 6c34c88896
nvim/plug: +nvim-lspconfig@master
This plugin provides the tools for initializing language servers, using
the builtin neovim LSP client. It provides the major low level glue for
actually starting and configuring a given language server; however it
**does not** ensure that the actual language server is present on the
system / in PATH.

That function is handled by mason / mason-lspconfig, which will prompt
the user to install the necessary server(s) upon calling
`lspconfig[$server].setup { ... }`.

We provide a default on_attach function the sets up some default key
maps for LSP related functionality, loading a user overridable map of
language servers and their associated setup objects or functions.

Note that "setting up" a language server is not the same as loading it,
which is a considerably more expensive operation. Hence, we make no
effort to lazily setup language servers.
2022-10-05 18:33:39 +00:00
Paul Stemmet bb937f9db7
nvim/plug: -coc.nvim -neomake +mason.nvim@main +mason-lspconfig.nvim@main 2022-10-05 18:33:39 +00:00
Paul Stemmet bb4fa19006
nvim/plug: -nvim-yarp -vim-hug-neovim-rpc
Removed unused plugins
2022-10-05 18:33:39 +00:00
Paul Stemmet 635eb80808
nvim/lsp/servers: add json,yaml,vim,lua
These were selected as they seem generally useful in everyday usage of
neovim. Vim/Lua is obvious, Json and Yaml is generally useful for
config editing.
2022-10-05 18:33:39 +00:00
Paul Stemmet af4b4fa24d
nvim/lsp/preset: add presets for many languages
See below for the list of presets:

- Json
- Yaml
- Vim
- Lua
- Rust
- Go
- Awk
- Bash
- C
- CXX
- CMake
- CSS
- DockerFile
- Elixir
- GraphQL
- HTML
- JavaScript
- Jsonnet
- Markdown
- Perl
- PHP
- Python
- Ruby
- SQL
- Toml
- Terraform
- TypeScript
- TailwindCSS
- XML
2022-10-05 18:33:39 +00:00
Paul Stemmet 7ff228ae64
nvim/lsp/util: add Servers, Server, Filter
These objects provide a nice abstraction over the underlying
complexities of configuring language servers in native Neovim.

The idea is to allow users of the module to define Server/s that can
just be included somewhere and have them activate with fuss.

That said, we *do* want ways of configuring the underlying systems, and
this module provides two, one for direct consumers of this module
(Spec.setup), and one for users *of predefined Servers*, in the form of
Server.with/1.
2022-10-05 18:33:39 +00:00
Paul Stemmet 2fca27a5ab
merge: develop <--- feature/keymap
* HEAD
| \
| * 1f65b77 <github@luxolus.com> nvim: remove vimpeccable (plug/vimp)
| * cfbd1ad <github@luxolus.com> nvim/key/init: forward to key/map for now
| * 42feb20 <github@luxolus.com> nvim/key: add central location for all custom key binds
| * d557737 <github@luxolus.com> nvim/key: add Bind, BindGroup apis
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-05 18:32:17 +00:00
Paul Stemmet 1f65b77c0a
nvim: remove vimpeccable (plug/vimp)
This commit removes all vimpeccable (vimp) usage from the code base, as
it has been superseded by 'psoxizsh.key'.

In addition to simplifying the code, this also removes the annoying
spurious errors that would be generated when reloading configuration.

One thing to note: this commit also remove most of the LSP config we
have for coc.nvim. This is intentional, and will be corrected via a
future patchset utilizing the native neovim LSP client, as coc has
become annoying to maintain.
2022-10-05 17:49:19 +00:00
Paul Stemmet cfbd1adfc9
nvim/key/init: forward to key/map for now
This will likely change in the future, don't rely too hard on this behavior for
now
2022-10-05 17:49:19 +00:00
Paul Stemmet 42feb20e8b
nvim/key: add central location for all custom key binds
This commit adds a file that users can use to lookup available key binds
that are set.

The big benefit here is largely discoverability, as psoxizsh users no
longer are required to search thorough the entire code base looking for
binds.

That said, we *only* cover those explicitly set by psoxizsh, but
covering any created by plugins that may be used.

Still, this is a significant improvement compared to the previous
situation, and more importantly; prevents the situation from getting
worse as we add more plugins.

NOTE: Must go through prior work (util/keymap, vimp) and codebase, to properly
      search and replace all instances of key binding
2022-10-05 17:49:19 +00:00
Paul Stemmet d55773757b
nvim/key: add Bind, BindGroup apis
This commit adds wrapper objects around vim.keymap functionality.

Bind represents a single key bind, which can be register/2'ed with
Neovim. By default, Bind enables noremap and silent (:h map-arguments)
by default, as this is almost always what a user wants.

BindGroup(s) are DAG collections of child BindGroup(s) inner nodes
and Bind leaf nodes. Options are passed down the tree, though they
may be overridden by child objects.

Together they allow callers to create composable, lazy key bind
groupings, that can be instantiated together, while deferring the
implementation and activation of such groups.

Generally speaking, the big idea is to provide several well known
group 'aliases', for example, bind.Global, bind.User or bind.Lsp,
and let users override key binds in these groups, while the actual
functionality is provider (Bind.action) is opaque to them.
2022-10-05 17:49:19 +00:00
Paul Stemmet f0fa1c67fd
merge: develop <--- feature/ui-improvements
* HEAD
| \
| * 96ffa3e <github@luxolus.com> nvim/plug: +notify@v3
| * 861bbdf <github@luxolus.com> nvim/plug: -vim-one, +onedarkpro.nvim@master
| * 436d1d1 <github@luxolus.com> nvim/plug: bufferline.branch=v2.*
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-05 17:46:24 +00:00
Paul Stemmet 96ffa3e660
nvim/plug: +notify@v3
This is a much prettier frontend for the vim.notify API, which is used
by a lot of plugins to communicate information and/or errors.

Try it out yourself:
  :lua vim.notify('Hello, world!', 'info', { title = 'Testing Notify'})
2022-10-05 16:16:38 +00:00
Paul Stemmet 861bbdfb1d
nvim/plug: -vim-one, +onedarkpro.nvim@master
Better color scheme implementation of one
2022-10-05 16:16:37 +00:00
Paul Stemmet 436d1d17d3
nvim/plug: bufferline.branch=v2.*
As we're already using nvim >0.7.0 functionality
2022-10-05 16:16:37 +00:00
Paul Stemmet 6c8a018ae7
merge: develop <--- feature/misc-fixes-20221002
* HEAD
| \
| * ebf3308 <github@luxolus.com> nvim: linting, formatting
| * cb9e6a5 <github@luxolus.com> nvim/plug/neotree: remove spurious diagnostic sign config
| * 76a113c <github@luxolus.com> nvim/plug/lualine: slight fixes to settings
| * 184a8b6 <github@luxolus.com> nvim/util/highlight: for :highlight in lua
| * fb81d8b <github@luxolus.com> nvim/util: reorganize to allow for multiple submodules
| * a4410d6 <github@luxolus.com> nvim/autocmd: remove polyfill for <0.7 versions
| * ee4fac3 <github@luxolus.com> nvim/init.early: move &background, &termguicolors into early
| * d6827a4 <github@luxolus.com> nvim/init.post: set colorscheme to g.my_color_scheme
| * c815f5a <github@luxolus.com> tmux: fix truecolor in tmux
| * 138e66f <github@luxolus.com> zshrc: remove plugins.cargo
| /
| develop

Signed-off-by: Bazaah <github@luxolus.com>
2022-10-02 19:30:18 +00:00
Paul Stemmet ebf3308fc2
nvim: linting, formatting 2022-10-02 18:59:19 +00:00
Paul Stemmet cb9e6a55e5
nvim/plug/neotree: remove spurious diagnostic sign config
This shouldn't be being set by a plugin, particularly one that has
nothing to do with diagnostics
2022-10-02 18:59:19 +00:00
Paul Stemmet 76a113c215
nvim/plug/lualine: slight fixes to settings
- Enable toggleterm support (it now recognizes TT windows)
- Use gitsigns for branch detection (faster than running external
  git commands)
- Remove 'italic' from branch section highlights
2022-10-02 18:59:19 +00:00
Paul Stemmet 184a8b6724
nvim/util/highlight: for :highlight in lua
Provides a nicer API around doing highlighting in neovim / lua
2022-10-02 18:59:19 +00:00
Paul Stemmet fb81d8b2b9
nvim/util: reorganize to allow for multiple submodules
This change moves the original module loading utilities to
util/mload.lua, while providing a shim object that lazily attempts to
locate a function that matches the name of the indexed object.

This changes allows me to better organize utility functions
2022-10-02 18:59:19 +00:00
Paul Stemmet a4410d681f
nvim/autocmd: remove polyfill for <0.7 versions
This needlessly complicates the code, and is no longer needed, as nvim
0.7 is fairly common now.
2022-10-02 18:59:19 +00:00
Paul Stemmet ee4fac3834
nvim/init.early: move &background, &termguicolors into early
As many plugins use these when setting colors and highlights, leading to
poor coloring now that truecolor support is fixed in tmux
2022-10-02 18:59:18 +00:00
Paul Stemmet d6827a4fe5
nvim/init.post: set colorscheme to g.my_color_scheme 2022-10-02 18:59:18 +00:00
Paul Stemmet c815f5aa25
tmux: fix truecolor in tmux
So story time, I discovered :checkhealth in Neovim, and it gave a fairly
decent explanation of how to fix terminal truecolor support.

Namely, use `tmux-256color` (or `screen-256color`) for the
default-terminal, then force truecolor (Tc) in the terminal-overrides

It also mentioned that `focus-events` needs to be enabled for n/vim to
detect changes to its buffers. Notably, this allows vim to rerender
changed content when switching into a tmux pane containing a vim
session.
2022-10-02 18:59:17 +00:00
Paul Stemmet 138e66f245
zshrc: remove plugins.cargo
as the upstream has merged its functionality into plugins.rust, which is
already set.

See ohmyzsh/ohmyzsh#10270 , ohmyzsh/ohmyzsh@89a740b
2022-10-02 18:59:17 +00:00
psox cf932c2051 tmux: add ctrl-shift movement fragment file 2022-09-29 16:41:46 +01:00
psox fdba97e517
update formatting 2022-09-24 06:31:32 +00:00
psox 9c82dc25b4
recursive update 2022-09-24 06:29:05 +00:00
psox 1715cac996
fix grep error 2022-09-24 06:21:49 +00:00
55 changed files with 2046 additions and 1150 deletions

8
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "oh-my-zsh"]
path = oh-my-zsh
url = https://github.com/robbyrussell/oh-my-zsh.git
url = https://git.st8l.com/dolysis/ohmyzsh.git
[submodule "zsh-custom/plugins/zsh-autosuggestions"]
path = zsh-custom/plugins/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions
@ -25,3 +25,9 @@
[submodule "tmux/plugins/tpm"]
path = tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm
[submodule "zsh-custom/plugins/zsh-vi-mode"]
path = zsh-custom/plugins/zsh-vi-mode
url = https://github.com/jeffreytse/zsh-vi-mode
[submodule "nvim/lazy.nvim"]
path = nvim/lazy.nvim
url = https://github.com/folke/lazy.nvim.git

View File

@ -10,13 +10,14 @@ This is optimized by default for dark terminals, and contains configurations for
use with
- zsh >= v5.8
- neovim >= v0.6
- neovim >= v0.9
- tmux >= 3.2
All of these have standard setting but can be customized by using optional
include files. Please read the following configs
- `vimrc`
- `init.lua`
- `zshrc`
- `tmux/tmux.conf`
@ -48,8 +49,7 @@ them and then run the following commands.
(
git pull --recurse-submodules=yes
git submodule foreach git fetch --all --prune
git submodule foreach git checkout master
git submodule foreach git pull
git submodule update --remote --rebase
git pull --recurse-submodules=yes
)
@ -63,7 +63,7 @@ src
```bash
git clone --recurse-submodules --recursive https://github.com/psox/psoxizsh.git ~/.psoxizsh
git clone --recurse-submodules --recursive https://git.st8l.com/dolysis/psoxizsh.git ~/.psoxizsh
# This should work on Linux. It is not tested on MacOS or Windows
~/.psoxizsh/fresh-system
@ -75,7 +75,7 @@ git clone --recurse-submodules --recursive https://github.com/psox/psoxizsh.git
```bash
# Make sure you are root
git clone --recurse-submodules --recursive https://github.com/psox/psoxizsh.git /etc/psoxizsh
git clone --recurse-submodules --recursive https://git.st8l.com/dolysis/psoxizsh.git /etc/psoxizsh
# This should work on Linux. It is not tested on MacOS or Windows
# for each user that wants to use this as the user run this command
@ -85,7 +85,7 @@ git clone --recurse-submodules --recursive https://github.com/psox/psoxizsh.git
## Configure NeoVim
Make sure you have neovim (tested on v0.6.1) installed and after starting zsh
Make sure you have neovim (tested on v0.9.x, v0.10.x) installed and after starting zsh
check that the following variable are set by typing
You will need to install `neovim`, `nodejs` and `npm` to get the full use of vim
@ -93,10 +93,14 @@ You will need to install `neovim`, `nodejs` and `npm` to get the full use of vim
Just start neovim (`nvim`) and wait for it to finish. After that quit and it
should be ready to use.
You can also use: `nvim --headless '+Lazy! sync' +TSUpdate +qa` to sync all plugins
without opening neovim.
See the default entrypoint ([init.lua](./init.lua)) for more details on how to
configure your local setup further.
```bash
echo $VIMINIT
echo $MYVIMRC
echo $VIMHOME
nvim ~/.config/nvim/init.lua
```
Enjoy

View File

@ -0,0 +1,74 @@
{
// cspell: enableCompoundWords
"coc.preferences.formatOnSaveFiletypes": [
"json",
"jsonc",
"rust",
"markdown",
"xml",
"html",
"css",
"lua",
"go"
],
"markdownlint.config": {
"line-length": {
"line_length": 120
}
},
"coc.preferences.enableMarkdown": false,
"prettier.proseWrap": "always",
"diagnostic.errorSign": "", //
"diagnostic.warningSign": "", //
"diagnostic.hintSign": "", //
"diagnostic.infoSign": "", //
"diagnostic.checkCurrentLine": false,
"diagnostic.level": "hint",
"diagnostic.autoRefresh": true,
"diagnostic.refreshOnInsertMode": false,
"diagnostic.locationlistUpdate": true,
"diagnostic.virtualText": true,
"diagnostic.signPriority": 20,
"diagnostic.enableHighlightLineNumber": false,
"suggest.disableMenu": false,
"suggest.snippetIndicator": "",
"suggest.languageSourcePriority": 100,
"suggest.enablePreview": true,
"suggest.removeDuplicateItems": true,
"suggest.detailField": "preview",
"suggest.labelMaxLength": 100,
"suggest.noselect": false,
"suggest.selection": "recentlyUsedByPrefix",
"suggest.acceptSuggestionOnCommitCharacter": true,
"suggest.completionItemKindLabels": {
"default": "",
"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": "" //
},
"Lua.telemetry.enable": false
// cspell: ignore struct
// vim: filetype=jsonc
}

View File

@ -1,3 +1,94 @@
--[[
This is entrypoint Psoxizsh uses to start Neovim.
The majority of configuration can be done via the following files:
~/.config/nvim
lua
   config
      autocmds.lua | Any additional autocmds (late loaded)
      keymaps.lua | Any additional key binds (late loaded)
      lazy.lua |
      options.lua | Any vim.opt or vim.g configuration (early loaded)
   plugins | Any additional plugins, changes to existing
   spec1.lua | plugins, plugin specific key binds, etc.
   specN.lua |
init.lua | <--- You are here
autocmds.lua:
Any custom autocommands to create.
You can use `psoxizsh.autocmd` as a helper for creating these.
Example:
local au = psoxizsh.autocmd
au.MyCustomGroup {
{ 'VimEnter', 'yaml', ':silent echo opened a YAML file!' }
}
keymaps.lua:
Any additional key binds to create.
You can use the builtin `vim.keymap.set` to create these. See :h vim.keymap
for more details.
Example:
local map = vim.keymap.set
map('n', '<leader>:', function() print('using a lua function') end)
map({ 'i', 'v' }, '<leader>:', '<cmd>silent echo using a vim cmdstring<CR>')
options.lua:
Any extra options you wish to set.
Unlike other files, options.lua is loaded *EARLY*, before most initialization
happens, letting you set things like mapleader, background color, etc before
other things that use this information are loaded.
However, this also means that (excluding parts of psoxizsh itself) you cannot
access any plugin related configuration.
Example:
local opt, g = vim.opt, vim.g
g.mapleader = ','
plugins/*.lua
Any direct submodules in the plugin/ directory will have their plugin specs
merged and loaded during initialization.
A full description of a plugin is beyond the purview of this document, but
briefly, each spec object describes where to source it, how to configure it,
when to load it, and any additional plugins it depends on.
These specs are then merged according to the following rules:
- cmd : the list of commands will be extended with your custom commands
- event : the list of events will be extended with your custom events
- ft : the list of filetypes will be extended with your custom filetypes
- keys : the list of keymaps will be extended with your custom keymaps
- opts : your custom opts will be merged with the default opts
- dependencies: the list of dependencies will be extended with your custom dependencies
- any other property will override the defaults
See https://lazy.folke.io/spec for the full spec description, or look at
some of the examples in $PSOXIZSH/nvim/lua/psoxizsh/plugins for more.
---
Unless you wish to change the options passed directly to our package manager,
you do not need to change this file. If you do, copy this file to your local
~/.config/nvim/init.lua and make the modifications needed:
cp -v $PSOXIZSH/init.lua ~/.config/nvim/init.lua
Next, add the following line (replacing 'overrides' with your config overrides)
just above the call to .start():
require('psoxizsh.entrypoint.config').with(overrides)
--]]
vim.opt.rtp:append( os.getenv('PSOXIZSH') .. '/nvim' )
require 'psoxizsh'
require('psoxizsh.entrypoint').start()

1
nvim/lazy.nvim Submodule

@ -0,0 +1 @@
Subproject commit 48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d

View File

@ -4,15 +4,13 @@ local Groups = {}
local Group = { mt = {} }
local AutoCmd = { mt = {} }
local __builtin_support = vim.fn.has('nvim-0.7') == 1
-- Use the recent builtin APIs provided by neovim itself
local function builtin(group, autos)
vim.api.nvim_create_augroup(group, {})
local gid = vim.api.nvim_create_augroup(group, { clear = true })
for _, auto in ipairs(autos) do
local opts = auto.opts or {}
opts.group = group
opts.group = gid
opts.pattern = auto.pattern
if type(auto.command) == "string" then
@ -25,31 +23,7 @@ local function builtin(group, autos)
end
end
-- Use an old library to make the autos
-- Note that relies on the local package manager to ensure this plugin is available
local function polyfill(group, autos)
local poly = require 'autocmd-lua'
local autocmds = {}
for _, auto in ipairs(autos) do
local events = auto.event
if type(auto.event) == "string" then
events = { auto.event }
end
for _, e in ipairs(events) do
table.insert(autocmds, { event = e, pattern = auto.pattern, cmd = auto.command })
end
end
poly.augroup {
group = group,
autocmds = autocmds,
}
end
local autocmd = __builtin_support and builtin or polyfill
local autocmd = builtin
function M.new()
local m = {}

View File

@ -0,0 +1,108 @@
---@class psoxizsh.entrypoint.config
local M = {}
---@class PsoxizshConfig
---@field profile string|PsoxizshConfigProfileCb|nil The stock profile to apply to the config
---@field keybinds PsoxizshConfigKeysCb|nil A callback to allow users to set the PsoxizshKeyBinds
---@field lazy LazyConfig|nil The configuration passed to our package manager
---@alias PsoxizshConfigKeysCb fun(keys: PsoxizshKeyBinds):nil
---@alias PsoxizshConfigProfileCb fun(config: PsoxizshConfig):nil
---Default PsoxizshConfig
---@return PsoxizshConfig
local defaults = function()
return {
lazy = {
spec = {
{ 'LazyVim/LazyVim',
import = 'lazyvim.plugins',
priority = 10000
},
{ 'psoxizsh',
import = 'psoxizsh.plugins',
priority = 09999,
dir = os.getenv('PSOXIZSH') .. '/nvim',
lazy = false,
opts = {},
config = function(_, opts) require('psoxizsh').setup(opts) end
},
{ import = 'plugins' },
},
defaults = {
lazy = false,
version = false,
keymaps = false,
},
install = {
colorscheme = {
'onedark', 'tokyonight', 'habamax',
}
},
checker = {
enabled = true,
concurrency = math.max(vim.uv.available_parallelism() - 2, 2),
frequency = 60 * 60 * 8, -- 8 hours
},
performance = {
rtp = {
disabled_plugins = {
-- 'gzip',
-- 'matchit',
-- 'matchparen',
'netrwPlugin',
-- 'tarPlugin',
'tohtml',
'tutor',
-- 'zipPlugin',
},
},
},
},
keybinds = function() --[[ don't override keybinds by default ]] end,
}
end
---Fetch the current PsoxizshConfig table
---@return PsoxizshConfig
function M.get()
if not M._lazy_config then
M._lazy_config = defaults()
end
return M._lazy_config
end
---Merge the given overrides into the current PsoxizshConfig
---@param overrides? PsoxizshConfig|PsoxizshConfigProfileCb
function M.set(overrides)
if type(overrides) == 'nil' then return end
if type(overrides) == 'function' then
M._lazy_config = overrides(M.get())
return
end
if type(overrides) == 'table' then
M._lazy_config = vim.tbl_deep_extend('force', M.get(), overrides)
return
end
vim.notify_once(
'config provided was neither a function or table, ignoring',
vim.log.levels.WARN,
{ title = 'psoxizsh.entrypoint' }
)
end
---Merge the given overrides into the current PsoxizshConfig, returning it
---@param overrides? PsoxizshConfig|PsoxizshConfigProfileCb
---@return PsoxizshConfig
function M.with(overrides)
M.set(overrides)
return M.get()
end
return M

View File

@ -0,0 +1,56 @@
---@class psoxizsh.entrypoint
local M = {}
local add_lazy_rtp = function()
if _G._psoxizsh_entrypoint_add_lazy_rtp == 1 then
return
end
vim.opt.rtp:prepend(os.getenv('PSOXIZSH') .. '/nvim/lazy.nvim')
_G._psoxizsh_entrypoint_add_lazy_rtp = 1
end
---Called the keybind callback, if any
---@param fn? PsoxizshConfigKeysCb
local set_keybinds = function(fn)
if type(fn) == 'function' then
fn(require('psoxizsh.key.binds'))
end
end
---Set the active profile (if any)
---@param profile? string|PsoxizshConfigProfileCb
---@param config PsoxizshConfig
local set_profile = function(profile, config)
if not profile then return end
if type(profile) == 'function' then
profile(config)
end
if type(profile) == 'string' then
if profile == 'psox' or profile == 'bazaah' then
require(('psoxizsh.entrypoint.profile.%s'):format(profile))(config)
end
end
end
---Begin Psoxizsh NeoVim initalization, with the default config
function M.start()
M.start_with(nil)
end
---Begin Psoxizsh NeoVim initalization with the given overrides
---@param overrides? PsoxizshConfig|PsoxizshConfigProfileCb
function M.start_with(overrides)
local config = require('psoxizsh.entrypoint.config').with(overrides)
add_lazy_rtp()
set_profile(config.profile, config)
set_keybinds(config.keybinds)
require('lazy').setup(config.lazy)
end
return M

View File

@ -0,0 +1 @@
return function(_) end

View File

@ -0,0 +1,16 @@
local function psox_keybinds()
local keys = require 'psoxizsh.key.binds'
-- Use Ctrl-Shift-<Arrow> for movement
keys.Global.NavigateUp.Key = '<C-S-Up>'
keys.Global.NavigateLeft.Key = '<C-S-Left>'
keys.Global.NavigateRight.Key = '<C-S-Right>'
keys.Global.NavigateDown.Key = '<C-S-Down>'
end
local function psox(config)
config.keybinds = psox_keybinds
end
return psox

View File

@ -0,0 +1,35 @@
-- Top level functions to be used in key binds and commands
local M, S = {}, {}
---Toggle the line numbers and diagnostic gutter
function M.ToggleGutter()
local o, diagnostic = vim.opt, vim.diagnostic
if o.number:get() then
S.signcolumn = o.signcolumn:get()
o.number = false
o.relativenumber = false
o.signcolumn = 'no'
diagnostic.enable(false)
else
o.number = true
o.relativenumber = true
o.signcolumn = S.signcolumn or 'yes:1'
diagnostic.enable(true)
end
vim.cmd 'IBLToggle'
end
---Open a float with your local config files
function M.OpenConfig()
return LazyVim.pick.config_files()()
end
---Format the active selection or buffer
function M.Format()
return LazyVim.format { force = true }
end
return M

View File

@ -1,196 +1,18 @@
local o, g, fn, cmd = vim.opt, vim.g, vim.fn, vim.cmd
local au, util = require 'psoxizsh.autocmd', require 'psoxizsh.util'
local function psoxizsh_early_config()
-- Local early configuration
util.try_mreload('early')
---@class psoxizsh
local M = {}
-- Set global color scheme var
if not g.my_color_scheme then
g.my_color_scheme = 'one'
end
---Initialize Psoxizsh NeoVim
---@param _ table|nil
function M.setup(_)
local startup = require 'psoxizsh.startup'
local au = require 'psoxizsh.autocmd'
-- Hide buffers don't close them
o.hidden = true
startup.pre()
startup.early()
-- Sane pane opening
o.splitbelow = true
o.splitright = true
-- File indent opts
o.encoding = "utf-8"
o.shiftwidth = 2
o.tabstop = 8
o.softtabstop = 2
o.expandtab = true
o.list = true
o.listchars:append {
trail = '\u{02FD}',
extends = '\u{22B3}',
precedes = '\u{22B2}',
nbsp = '\u{02EC}',
conceal = '\u{2219}',
tab = '\u{2559}\u{254C}\u{2556}',
}
o.ignorecase = true
o.infercase = true
cmd 'filetype plugin indent on'
-- Set completion messages off
o.shortmess:append { c = true }
-- Preview window + menu for autocompletions
o.completeopt:append {
'preview',
'menuone',
'longest',
}
-- Lower update time (Default 4000)
o.updatetime = 300
-- Numbered lines
o.number = true
o.relativenumber = true
o.signcolumn = 'yes:1'
-- Disable '--INSERT--' and friends
o.showmode = false
-- Use existing buffers
o.switchbuf = { "useopen", "usetab" }
-- Set global statusline (0.7+ only)
if fn.has('nvim-0.7') == 1 then o.laststatus = 3 end
-- Local pre plugin configuration
util.try_mreload('pre')
LazyVim.on_very_lazy(startup.post)
LazyVim.on_very_lazy(startup.late)
end
-- Load plugins
local function psoxizsh_post_config(plugs)
local vimp = require 'vimp'
-- Local post plugin configuration
util.try_mreload('post')
-- Setup file backups
cmd ':silent !mkdir -p ~/.vimbackup'
o.backupdir = fn.expand('~') .. '/.vimbackup'
o.directory = fn.expand('~') .. '/.vimbackup'
o.hlsearch = true
-- ripgrep settings
g.rg_highlight = 'true'
g.rg_derive_root = 'true'
-- Other
g.rainbow_active = 1
au.PsoxFileAutos {
{ 'FileType', 'yaml', 'setlocal indentkeys-=<:> ts=8 sts=2 sw=2 expandtab' },
{ 'FileType', 'go', 'setlocal ts=8 sts=4 sw=4 noexpandtab' },
{ 'FileType', 'quickfix,netrw', 'setlocal nobuflisted' },
{ 'FileType', 'netrw', function() require('vimp').nmap({'buffer', 'silent'}, '<ESC>', ':call CloseNetrw()<CR>') end },
}
cmd([[
function! CloseNetrw() abort
for bufn in range(1, bufnr('$'))
if bufexists(bufn) && getbufvar(bufn, '&filetype') ==# 'netrw'
silent! execute 'bwipeout ' . bufn
if getline(2) =~# '^" Netrw '
silent! bwipeout
endif
return
endif
endfor
endfunction
]])
if plugs:has('fzf') then
if fn.executable('rg') == 1 then
vimp.nnoremap('<A-g>', ':Rg ')
vimp.nnoremap('<leader><A-g>', ':Rg! ')
vimp.nnoremap({'silent'}, '<A-S-g>', ':Rg<CR>')
vimp.nnoremap({'silent'}, '<leader><A-S-g>', ':Rg!<CR>')
end
vimp.nnoremap('<A-f>', ':Files ')
vimp.nnoremap('<leader><A-f>', ':Files! ')
vimp.nnoremap({'silent'}, '<A-S-f>', ':Files<CR>')
vimp.nnoremap({'silent'}, '<leader><A-S-f>', ':Files!<CR>')
vimp.nnoremap('<A-b>', ':Buffers ')
vimp.nnoremap('<leader><A-b>', ':Buffers! ')
vimp.nnoremap({'silent'}, '<A-S-b>', ':Buffers<CR>')
vimp.nnoremap({'silent'}, '<leader><A-S-b>', ':Buffers!<CR>')
end
-- Workaround for writing readonly files
vimp.cnoremap({'silent'}, 'w!!', 'w !sudo tee % >/dev/null')
-- Open any known user configuration paths for editing
vimp.nnoremap({'silent'}, '<leader>ve', function()
local rtp = vim.fn.join(o.runtimepath:get(), ',')
local files = {
early = vim.fn.globpath(rtp, '/lua/early.lua', 0, 1)[1] or nil,
pre = vim.fn.globpath(rtp, '/lua/pre.lua', 0, 1)[1] or nil,
post = vim.fn.globpath(rtp, '/lua/post.lua', 0, 1)[1] or nil,
late = vim.fn.globpath(rtp, '/lua/late.lua', 0, 1)[1] or nil,
my = os.getenv("MYVIMRC") or nil,
}
for _, file in pairs(files) do
if vim.fn.filereadable(file) == 1 then
cmd('edit ' .. file)
end
end
end)
-- Toggles all gutter items
vimp.nnoremap({'silent'}, '<leader>N', function()
if o.number:get() then
o.number = false
o.relativenumber = false
o.signcolumn = 'no'
else
o.number = true
o.relativenumber = true
o.signcolumn = 'yes:1'
end
end)
-- Reload configuration
vimp.nnoremap('<leader>vs', function() vimp.unmap_all() plugs:reload() end)
o.background = 'dark'
o.termguicolors = true
g.one_allow_italics = 1
cmd('highlight Comment term=italic cterm=italic gui=italic')
end
local function psoxizsh_late_config(_)
-- Local late configuration
util.try_mreload('late')
-- Rest of config below is specifically not user override-able
o.exrc = true
o.secure = true
o.modeline = true
o.modelines = 7
end
local hooks = {
early = { 'PsoxConfigEarly', psoxizsh_early_config },
post = { 'PsoxConfigPost', psoxizsh_post_config },
late = { 'PsoxConfigLate', psoxizsh_late_config },
}
return require('psoxizsh.plugins') { hooks = hooks }
return M

View File

@ -0,0 +1,117 @@
local core = require 'psoxizsh.key.core'
---@alias PsoxizshKeyBinds psoxizsh.key.binds
---@class psoxizsh.key.binds
local M = {}
local B = core.mkbind
-- ############################
-- ## GLOBAL BINDINGS ##
-- ############################
M.Global = {
-- ############
-- ## Supers ##
-- ############
--
Super = {
FileBrowser = B { '<C-Left>' , '<cmd>Neotree toggle reveal position=left<CR>' , desc = 'Toggle File Browser' , } ,
FuzzySearch = B { '<C-Right>' , '<cmd>Telescope builtin<CR>' , desc = 'Activate Telescope fuzzy finder' , } ,
Terminal = B { '<C-Up>' , '<cmd>ToggleTerm<CR>' , desc = 'Open terminal in a float' , } ,
Diagnostics = B { '<C-Down>' , '<cmd>TroubleToggle<CR>' , desc = 'Open workspace diagnostics' , } ,
},
-- ##############
-- ## <Leader> ##
-- ##############
--
Format = B { '<Leader>F' , desc = 'Format selection or buffer' , } ,
OpenConfig = B { '<Leader>ve' , desc = 'Open user Neovim configuration files' , } ,
ReloadConfig = B { '<Leader>vs' , desc = 'Reload Neovim configuration' , } ,
ToggleGutter = B { '<Leader>N' , desc = 'Toggle Neovim gutter' , } ,
ToggleBuffers = B { '<Leader><Tab>' , desc = 'Open buffer list' , } ,
ToggleGitStatus = B { '<Leader>gs' , desc = 'Open Git status float' , } ,
-- ################
-- ## Navigation ##
-- ################
--
-- Tmux interplay
NavigateLeft = B { '<C-h>', desc = 'Navigate left one window' , } ,
NavigateDown = B { '<C-j>', desc = 'Navigate down one window' , } ,
NavigateUp = B { '<C-k>', desc = 'Navigate up one window' , } ,
NavigateRight = B { '<C-l>', desc = 'Navigate right one window' , } ,
--
-- Buffer movement
--
BufferNext = B { '<Tab>' , desc = 'Next buffer or tab' , } ,
BufferPrev = B { '<S-Tab>' , desc = 'Previous buffer or tab' , } ,
--
-- Diagnostics
--
DiagnosticNext = B { ']g' , desc = 'Next buffer diagnostic' , } ,
DiagnosticPrev = B { '[g' , desc = 'Previous buffer diagnostic' , } ,
-- #####################
-- ## Auto completion ##
-- #####################
--
AutoComplete = {
Trigger = B { '<C-Space>' , desc = 'Request completion at <cword>' , } ,
Abort = B { '<C-CR>' , desc = 'Abort active completion' , } ,
Confirm = B { '<CR>' , desc = 'Select active completion' , } ,
Next = B { '<Tab>' , desc = 'Next completion entry' , } ,
Prev = B { '<S-Tab>' , desc = 'Previous completion entry' , } ,
ScrollUp = B { '<PageUp>' , desc = 'Scroll up completion entry documentation' , } ,
ScrollDown = B { '<PageDown>' , desc = 'Scroll down completion entry documentation' , } ,
},
SudoWrite = B { 'w!!' , desc = 'Sudo write the current file' , mode = 'c' } ,
}
-- ############################
-- ## BUFFER BINDINGS ##
-- ############################
M.Buffer = {
-- ###################
-- ## LSP on_attach ##
-- ###################
--
Lsp = {
LspInfo = B { '<Leader>Ci' , desc = 'Language Server Information' , } ,
RenameSymbol = B { '<Leader>rn' , desc = 'Rename <cword>' , } ,
RenameFile = B { '<Leader>rF' , desc = 'Rename the current file' , } ,
ShowDocumentation = B { 'K' , desc = 'Display documentation of <cword>' , } ,
ShowSignature = B { '<Leader>K' , desc = 'Display function signature help of <cword>' , } ,
ShowReferences = B { '<Leader>Cr' , desc = 'Display all references to <cword>' , } ,
CodeAction = B { '<Leader>.' , desc = 'Request code actions for <cword>' , } ,
SourceAction = B { '<Leader>Ca' , desc = 'Request source actions for <cword>' , } ,
GotoDefinition = B { 'gd' , desc = 'Jump to definition of <cword>' , } ,
GotoTypeDefinition = B { 'gT' , desc = 'Jump to type definition of <cword>' , } ,
GotoImplementation = B { 'gI' , desc = 'Jump to implementation of <cword>' , } ,
GotoDeclaration = B { 'gD' , desc = 'Jump to declaration of <cword>' , } ,
CodelensDisplay = B { '<Leader>>' , desc = 'Refresh & Display Codelens' , } ,
CodelensRun = B { '<Leader>r>' , desc = 'Run Codelens at <cword>' , } ,
ReferenceNext = B { ']]' , desc = 'Next reference' , } ,
ReferencePrev = B { '[[' , desc = 'Previous reference' , } ,
},
}
-- ############################
-- ## PLUGIN BINDINGS ##
-- ############################
M.Plugin = {
-- ###################
-- ## dressing.nvim ##
-- ###################
--
Dressing = {
Close = B { '<Esc>' , desc = 'Close the input modal' , mode = 'i' , } ,
Confirm = B { '<CR>' , desc = 'Submit the current input' , mode = 'i' , } ,
Prev = B { '<Up>' , desc = 'Previous item in input history' , mode = 'i' , } ,
Next = B { '<Down>' , desc = 'Next item in input history' , mode = 'i' , } ,
},
}
return M

View File

@ -0,0 +1,118 @@
local M = {}
--- A key bind.
---
--- Each Bind object represents a single key binding that can be registered with Neovim.
---@class PsoxizshKeyBind
---
---@field __struct 'PsoxizshKeyBind' Class identifier
---@field Key string Key that will be bound
---@field Mode string|string[] Mode(s) of the keybind, defaults to 'n' if unset
---@field Desc string|nil Description of the keybind
---@field Action string|function|nil Action to bind to `self.key`. May be a string, which will be interpreted as vimscript or a lua function
---@field opts PsoxizshKeyBindOpts|nil Set of options for this keybind -- not all options will apply to all call sites
---@field as fun(self: PsoxizshKeyBind, args: { [1]: PsoxizshKeyAsType }|PsoxizshKeyArgs): table
---@field _as_lazy fun(self: PsoxizshKeyBind, overrides?: PsoxizshKeyArgs): LazyKeysSpec
--- A set of `vim.keymap.set` {opts}.
---
--- See :h vim.keymap.set and :h map-arguments for details
---@class PsoxizshKeyBindOpts
---
---@field noremap boolean|nil Defaults to true
---@field remap boolean|nil Opposite of noremap (overrides, if set)
---@field nowait boolean|nil Defaults to false
---@field silent boolean|nil Defaults to true
---@field script boolean|nil Defaults to false
---@field expr boolean|nil Defaults to false
---@field unique boolean|nil Defaults to false
---@field buffer number|nil Defaults to false
---@class PsoxizshNewKeyBindArgs
---
---@field [1] string|nil The key pattern to use, alternative to `self.key`
---@field [2] string|function|nil The action to take; if applicable, alternative to `self.action`
---@field key string|nil The key pattern to use
---@field action string|function|nil The action to take; if applicable
---@field desc string|nil The description for this key bind
---@field mode string|string[]|nil The mode(s) to apply this key bind in
---@alias PsoxizshKeyArgs PsoxizshNewKeyBindArgs|PsoxizshKeyBindOpts
---@alias PsoxizshKeyAsType 'lazy'
local Bind = {
__struct = 'PsoxizshKeyBind',
}
---Create a new PsoxizshKeyBind
---@param key string
---@param action string|function|nil
---@param desc string|nil
---@param mode string|string[]
---@param opts PsoxizshKeyBindOpts|nil
function Bind.new(key, action, desc, mode, opts)
local this = vim.deepcopy(Bind)
this.Key = key
this.Action = action
this.Desc = desc
this.Mode = mode
this.opts = opts
return this
end
---Convert this PsoxizshKeyBind into another key bind format `type`
---@param self PsoxizshKeyBind
---@param args { [1]: PsoxizshKeyAsType }|PsoxizshKeyArgs
---@return table
function Bind.as(self, args)
local type = table.remove(args, 1)
if type == 'lazy' then return self:_as_lazy(args) end
return {}
end
---Convert this PsoxizshKeyBind into a LazyKeysSpec
---@param self PsoxizshKeyBind
---@param overrides? PsoxizshKeyArgs
---@return LazyKeysSpec
function Bind._as_lazy(self, overrides)
local args = overrides or {}
local key = args.key or args[1] or self.Key ; args.key = nil ; args[1] = nil
local action = args.action or args[2] or self.Action ; args.action = nil ; args[2] = nil
local desc = args.desc or self.Desc ; args.desc = nil
local mode = args.mode or self.Mode ; args.mode = nil
if mode == 'n' then mode = nil end ---@diagnostic disable-line: cast-local-type
local opts = vim.tbl_extend('force', self.opts or {}, args)
return { key, action, desc = desc, mode = mode, unpack(opts) }
end
---Create a new @PsoxizshKeyBind from the provided `opts`
---@param opts PsoxizshNewKeyBindArgs|PsoxizshKeyBindOpts
---@return PsoxizshKeyBind|nil
function M.mkbind(opts)
local key = opts[1] or opts.key
local action = opts[2] or opts.action
local mode = opts.mode or 'n'
local kopts = {
noremap = opts.noremap,
remap = opts.remap,
nowait = opts.nowait,
silent = opts.silent,
script = opts.script,
expr = opts.expr,
unique = opts.unique,
buffer = opts.buffer,
}
if not key then return nil end
return Bind.new(key, action, opts.desc, mode, next(kopts) ~= nil and kopts or nil)
end
return M

View File

@ -0,0 +1,11 @@
local core, binds = require 'psoxizsh.key.core', require 'psoxizsh.key.binds'
---@class psoxizsh.key
local M = {}
M.binds = binds
M.fn = {}
M.fn.mkbind = core.mkbind
return M

View File

@ -0,0 +1,95 @@
---@class PsoxizshLspServer
---@field id string The canonical name of the server
---@field specs LazySpec Any other LazySpecs that will be included with ours
---@field opts PsoxizshLspServerConfig This spec's config
---@field callback PsoxizshLspPresetCallback Converts self.opts into a LazySpec
---@field get fun(self: PsoxizshLspServer): LazySpec Return the materialized LazySpec for this server
---@field with fun(self: PsoxizshLspServer, opts: PsoxizshLspServerConfig): LazySpec Return the materialized LazySpec for this server, with the given opts merged in
---@operator call(PsoxizshLspServerConfig|nil): LazySpec
---@class PsoxizshLspServerConfig
---@field settings table The lspconfig settings for this server
---@alias PsoxizshLspPresetCallback fun(string, PsoxizshLspServerConfig): LazySpec
---@class psoxizsh.lsp.core
local M = {}
local S = {}
---Merge the provided config into the normal neovim/nvim-lspconfig structure
---@param server string
---@param config table
---@return table
function M.make_server(server, config)
return { servers = { [server] = config } }
end
---Create a LazyPlugin spec override for neovim/nvim-lspconfig for the given
---server and config
---@param server string
---@param opts PsoxizshLspServerConfig
---@return LazySpec
function M.lspconfig_server(server, opts)
return {
'neovim/nvim-lspconfig', opts = M.make_server(server, opts.settings)
}
end
---Create a new LSP server spec
---@param id string
---@param inherit LazySpec
---@param cb PsoxizshLspPresetCallback
---@return PsoxizshLspServer
function M.preset(id, inherit, cb)
return S.new(id, inherit, cb)
end
---Create a new PsoxizshLspServer
---@param id string
---@param specs LazySpec
---@param cb PsoxizshLspPresetCallback
---@return PsoxizshLspServer
function S.new(id, specs, cb)
local this = vim.deepcopy(S)
this.id = id
this.specs = specs
this.callback = cb
this.opts = { settings = {} }
setmetatable(this, {
__call = function(self, opts)
local hasopts = type(opts) == 'table' and next(opts) ~= 'nil' or type(opts) ~= 'nil'
return hasopts and self:with(opts) or self:get()
end
})
return this
end
---Get the LazyVim plugin spec(s) for this LspServer
---@param self PsoxizshLspServer
---@return LazySpec
function S.get(self)
local unpack = table.unpack or unpack
local specs = type(self.specs) == 'string' and {{ import = self.specs }} or self.specs
local lsp = self.callback(self.id, self.opts)
return { unpack(specs), lsp }
end
---Get the LazyVim plugin spec(s) for this LspServer
---@param self PsoxizshLspServer
---@param opts PsoxizshLspServerConfig
---@return LazySpec
function S.with(self, opts)
local this = vim.deepcopy(self)
this.opts = vim.tbl_deep_extend('force', this.opts, opts)
return this:get()
end
return M

View File

@ -0,0 +1,54 @@
-- Keys for LSP on_attach functionality
--
-- These are for generic / language server independent functions, see the below
-- link for how to add key binds for specific LSPs.
--
-- https://www.lazyvim.org/configuration/keymaps#lsp-server-keymaps
local function rebind(args)
local target, bind = args[1], args[2]
-- Do nothing if given a nil bind
if type(bind) == 'nil' then return end
-- Disable (but keep) the bind if given a false bind
if type(bind) == 'boolean' and not bind then
target[2] = false ; return
end
-- Otherwise, set key pattern and description
target[1] = bind.Key
if bind.Desc then target.desc = bind.Desc end
end
return {
{ 'neovim/nvim-lspconfig',
opts = function(_, _)
local keys = require('psoxizsh.key.binds').Buffer.Lsp
local K = require("lazyvim.plugins.lsp.keymaps").get()
-- So this is a bit obtuse to set, because we have to match the order
-- provided by LazyVim, see the following for the offsets
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/lsp/keymaps.lua#L15
rebind { K[1], keys.LspInfo } -- 'Lsp Info'
rebind { K[2], keys.GotoDefinition } -- 'Goto Definition'
rebind { K[3], keys.ShowReferences } -- 'References'
rebind { K[4], keys.GotoImplementation } -- 'Goto Implementation'
rebind { K[5], keys.GotoTypeDefinition } -- 'Goto Type Definition'
rebind { K[6], keys.GotoDeclaration } -- 'Goto Declaration'
rebind { K[7], keys.ShowDocumentation } -- 'Hover'
rebind { K[8], keys.ShowSignature } -- 'Signature Help'
rebind { K[9], false } -- 'Signature Help' (disable insert mode map)
rebind { K[10], keys.CodeAction } -- 'Code Action'
rebind { K[11], keys.CodelensRun } -- 'Run Codelens'
rebind { K[12], keys.CodelensDisplay } -- 'Refresh & Display Codelens'
rebind { K[13], keys.RenameFile } -- 'Rename File'
rebind { K[14], keys.RenameSymbol } -- 'Rename'
rebind { K[15], keys.SourceAction } -- 'Source Action'
rebind { K[16], keys.ReferenceNext } -- 'Next Reference'
rebind { K[17], keys.ReferencePrev } -- 'Prev Reference'
rebind { K[18], false } -- 'Next Reference' (disable alt map)
rebind { K[19], false } -- 'Prev Reference' (disable alt map)
end
},
}

View File

@ -0,0 +1,66 @@
-- Language Server presets based off of LazyVim's extras.lang plugin sets
--
-- You can use these in your plugin/* files via calling them in a plugin spec.
--
-- For example:
--
-- ```lua
-- local Server = require 'psoxizsh.lsp.preset'
--
-- return { Server.Yaml(), Server.Json(), Server.Rust:with { checkOnSave = true } }
-- ```
local core = require 'psoxizsh.lsp.core'
---@class psoxizsh.lsp.preset
local M = {}
M.Ansible = core.preset('ansiblels', 'lazyvim.plugins.extras.lang.ansible', core.lspconfig_server)
M.Awk = core.preset('awklsp', {}, core.lspconfig_server)
M.Bazel = core.preset('bzl', {}, core.lspconfig_server)
M.Clang = core.preset('clangd', 'lazyvim.plugins.extras.lang.clangd', core.lspconfig_server)
M.CMake = core.preset('neocmake', 'lazyvim.plugins.extras.lang.cmake', core.lspconfig_server)
M.Docker = core.preset('dockerls', 'lazyvim.plugins.extras.lang.docker', core.lspconfig_server)
M.Elixir = core.preset('elixirls', 'lazyvim.plugins.extras.lang.elixir', core.lspconfig_server)
M.Go = core.preset('gopls', 'lazyvim.plugins.extras.lang.go', core.lspconfig_server)
M.Git = core.preset('_git_placeholder_', 'lazyvim.plugins.extras.lang.git', function(_, _) return nil end)
M.Json = core.preset('jsonls', 'lazyvim.plugins.extras.lang.json', core.lspconfig_server)
M.Lua = core.preset('lua_ls', {}, core.lspconfig_server)
M.Markdown = core.preset('marksman', 'lazyvim.plugins.extras.lang.markdown', core.lspconfig_server)
M.Perl = core.preset('perlnavigator', {}, core.lspconfig_server)
M.Php = core.preset('phpactor', 'lazyvim.plugins.extras.lang.php', core.lspconfig_server)
M.Python = core.preset('pyright', 'lazyvim.plugins.extras.lang.python', core.lspconfig_server)
M.Rust = core.preset('rust-analyzer', 'lazyvim.plugins.extras.lang.rust', function(server, opts)
return {
'mrcjkb/rustaceanvim',
opts = {
server = { default_settings = { [server] = opts.settings } }
}
}
end)
M.Terraform = core.preset('terraformls', 'lazyvim.plugins.extras.lang.terraform', core.lspconfig_server)
M.Toml = core.preset('taplo', 'lazyvim.plugins.extras.lang.toml', core.lspconfig_server)
M.TypeScript = core.preset('vtsls', 'lazyvim.plugins.extras.lang.typescript', core.lspconfig_server)
M.JavaScript = M.TypeScript
M.Yaml = core.preset('yamlls', 'lazyvim.plugins.extras.lang.yaml', core.lspconfig_server)
return M

View File

@ -1,24 +0,0 @@
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim'
local repo_url = 'https://github.com/wbthomason/packer.nvim'
local strapped = nil
-- Bootstraps our package manager, ensuring it is present on the local system
local function bootstrap()
local should_install = fn.empty(fn.glob(install_path)) > 0
if should_install then
fn.system({'git', 'clone', '--depth', '1', repo_url, install_path})
end
return should_install
end
if not strapped then
strapped = bootstrap()
end
return function()
return strapped
end

View File

@ -0,0 +1,20 @@
return {
{ 'catppuccin', enabled = false }, -- disable LazyVim default colorscheme
{ 'olimorris/onedarkpro.nvim',
priority = 1000,
opts = {
plugins = { all = true },
styles = {
comments = 'italic',
},
options = {
bold = true,
italic = true,
underline = true,
undercurl = true,
},
},
},
}

View File

@ -1,23 +0,0 @@
return function()
local bl, vimp, util = require 'bufferline', require 'vimp', require 'psoxizsh.util'
local defaults = {
always_show_bufferline = true,
numbers = "none",
diagnostics = 'coc',
offsets = {{
filetype = 'neo-tree',
text = 'File Explorer',
text_align = 'center'
}},
show_buffer_close_icons = false,
separator_style = { '\u{E0B0}', '\u{E0B1}' },
sort_by = 'relative_directory',
}
bl.setup (util.mconfig('config.bufferline', { options = defaults }))
vimp.nnoremap({'silent'}, '<TAB>', ':BufferLineCycleNext<CR>')
vimp.nnoremap({'silent'}, '<S-TAB>', ':BufferLineCyclePrev<CR>')
vimp.nnoremap({'silent'}, '<leader><TAB>', ':BufferLinePick<CR>')
end

View File

@ -1,74 +0,0 @@
return function()
local fn, o, g = vim.fn, vim.opt, vim.g
local vimp, au = require 'vimp', require 'psoxizsh.autocmd'
local t = function(s)
return vim.api.nvim_replace_termcodes(s, true, true, true)
end
g['coc_global_extensions'] = {
'coc-yank',
'coc-spell-checker',
'coc-vimlsp',
'coc-rust-analyzer',
'coc-json',
'coc-markdownlint',
'coc-yaml'
}
-- Do action on current word
vimp.nmap({'silent'}, '<leader>.', '<Plug>(coc-codeaction-selected)w')
-- Do action on a selection
vimp.nmap({'silent'}, '<leader>/', '<Plug>(coc-codeaction-selected)')
vimp.xmap({'silent'}, '<leader>/', '<Plug>(coc-codeaction-selected)')
-- Rename symbol
vimp.nmap({'silent'}, '<leader>rn', '<Plug>(coc-rename)')
-- Goto definition / references
vimp.nmap({'silent'}, '<leader>gd', '<Plug>(coc-definition)')
vimp.nmap({'silent'}, '<leader>gr', '<Plug>(coc-references)')
-- Use tab for trigger completion with characters ahead and navigate.
-- NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
-- other plugin before putting this into your config.
vimp.inoremap({'silent', 'expr'}, '<TAB>', [[coc#pum#visible() ? coc#pum#next(1) : CheckBackspace() ? "\<Tab>" : coc#refresh()]])
vimp.inoremap({'expr'}, '<S-TAB>', [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]])
vim.cmd [[
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
]]
-- Make <CR> to accept selected completion item or notify coc.nvim to format
-- <C-g>u breaks current undo, please make your own choice.
vimp.inoremap({'silent', 'expr'}, '<C-Space>', [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<C-r>=coc#on_enter()\<CR>"]])
-- Use `[g` and `]g` to navigate diagnostics
vimp.nmap({'silent'}, '[g', '<Plug>(coc-diagnostic-prev)')
vimp.nmap({'silent'}, ']g', '<Plug>(coc-diagnostic-next)')
if fn.has('nvim-0.4') then
-- Remap PageUp and PageDown for scroll float windows/popups.
vimp.nnoremap({'silent', 'nowait', 'expr'}, '<PageDown>', [[coc#float#has_scroll() ? coc#float#scroll(1) : "\<PageDown>"]])
vimp.nnoremap({'silent', 'nowait', 'expr'}, '<PageUp>', [[coc#float#has_scroll() ? coc#float#scroll(0) : "\<PageUp>"]])
end
-- Use K to show documentation in preview window.
local show_documentation = function()
return fn.CocAction('hasProvider', 'hover')
and fn.CocActionAsync('doHover')
or fn.feedkeys('K', 'in')
end
vimp.nnoremap({'silent'}, 'K', show_documentation)
-- Open yank list
vimp.nnoremap({'silent'}, '<C-Y>', t':<C-u>CocList -A --normal yank<CR>')
au.PsoxCocAutos {
{ 'CursorHold', '*', function() fn.CocActionAsync('highlight') end },
{ 'User', 'CocJumpPlaceholder', function() fn.CocActionAsync('showSignatureHelp') end },
}
end

View File

@ -1,35 +0,0 @@
return function()
local fn, o, api = vim.fn, vim.o, vim.api
if fn.executable('rg') == 1 then
-- Override the default grep implementation in vim
o.grepprg = 'rg --vimgrep --smart-case --follow'
if fn.has('nvim-0.7') == 1 then
-- Only search file contents, not file name
-- We can use the stock :Files for that
local rg_func = function(opts)
return fn['fzf#vim#grep'](
"rg --column --line-number --no-heading --color=always --smart-case " .. fn.shellescape(opts.args),
true,
fn['fzf#vim#with_preview']({options = '--delimiter : --nth 4..'}),
opts.bang
)
end
api.nvim_create_user_command('Rg', rg_func, { nargs = '*', bang = true })
-- If the user hasn't set a default FZF command, and has ripgrep installed,
-- use it over find, otherwise defer to the user's preferred command
if fn.empty(os.getenv('FZF_DEFAULT_COMMAND')) == 1 then
local files_func = function(opts)
return fn['fzf#vim#files'](
opts.args,
fn['fzf#vim#with_preview']({source = 'rg --files --hidden --glob "!**/.git/**" '}),
opts.bang
)
end
api.nvim_create_user_command('Files', files_func, { nargs = '?', bang = true, complete = 'dir' })
end
end
end
end

View File

@ -1,12 +0,0 @@
return function()
local gitsigns, util = require 'gitsigns', require 'psoxizsh.util'
local defaults = {
sign_priority = 100,
current_line_blame_formatter_opts = {
relative_time = false
},
}
gitsigns.setup(util.mconfig('config.gitsigns', defaults))
end

View File

@ -1,65 +0,0 @@
return function()
local ll, util, nwd = require 'lualine', require 'psoxizsh.util', require("nvim-web-devicons")
local file_color = function()
local _, color = nwd.get_icon_colors_by_filetype(vim.bo.filetype)
return { fg = color }
end
local diff_source = function()
-- May be nil if gitsigns hasn't populated yet
local gs = vim.b.gitsigns_status_dict or {}
return {
added = gs.added,
modified = gs.changed,
removed = gs.removed,
}
end
local filename = {
'filename',
icon = 'ƒ',
symbols = { modified = '|', readonly = '|', unnamed = '' },
color = file_color,
}
local branch = { 'branch', icon = '', color = { gui = 'bold,italic' } }
local diagnostics = { 'diagnostics', sources = { 'coc' }, update_in_insert = true }
local diff = { 'diff', source = diff_source }
local defaults = {
options = {
theme = 'auto',
icons_enabled = true,
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = { 'mode' },
lualine_b = { branch, diff, diagnostics },
lualine_c = { filename },
lualine_x = {'filetype', 'encoding', 'fileformat'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { filename },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
extensions = { 'fugitive', 'quickfix', 'man', 'fzf', 'neo-tree' }
}
ll.setup(util.mconfig('config.lualine', defaults))
end

View File

@ -1,14 +0,0 @@
return function()
local g, fn = vim.g, vim.fn
-- Don't move cursor into qf/loc on open
g.neomake_open_list = 2
-- Allow multiple makers to resolve
g.neomake_serialize = 1
g.neomake_serialize_abort_on_error = 1
-- Let Neomake control window size
g.qf_auto_resize = 0
fn['neomake#configure#automake']('rw', 800)
end

View File

@ -1,162 +0,0 @@
return function()
local g, fn = vim.g, vim.fn
local neotree, util, vimp = require 'neo-tree', require 'psoxizsh.util', require 'vimp'
local defaults = {
close_if_last_window = true,
enable_git_status = true,
default_component_configs = {
container = {
enable_character_fade = true
},
indent = {
indent_size = 2,
padding = 1, -- extra padding on left hand side
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
-- expander config, needed for nesting files
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "",
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon"
},
modified = {
symbol = "[+]",
highlight = "NeoTreeModified",
},
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
-- Change type
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "~", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "",-- this can only be used in the git_status source
renamed = "",-- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
unstaged = "",
staged = "",
conflict = "",
},
},
},
window = {
position = "left",
width = 40,
mapping_options = {
noremap = true,
nowait = true,
},
mappings = {
["?"] = "show_help",
["q"] = "close_window",
["R"] = "refresh",
["<space>"] = { "toggle_node", nowait = false },
["<cr>"] = "open",
["S"] = "open_split",
["s"] = "open_vsplit",
["C"] = "close_node",
["z"] = "close_all_nodes",
["Z"] = "expand_all_nodes",
["X"] = "delete",
["r"] = "rename",
["a"] = { "add", config = { show_path = "relative" } },
["A"] = { "add_directory", config = { show_path = "relative" } },
["c"] = { "copy", config = { show_path = "relative" } },
["m"] = { "move", config = { show_path = "relative" } },
["y"] = "copy_to_clipboard",
["p"] = "paste_from_clipboard",
},
},
filesystem = {
filtered_items = {
visible = false, -- when true, they will just be displayed differently than normal items
hide_dotfiles = true,
hide_gitignored = true,
hide_hidden = true, -- only works on Windows for hidden files/directories
hide_by_name = { --[[ Example: 'node_modules' ]] },
hide_by_pattern = { --[[ Example '*.meta' ]] },
never_show = { --[[ remains hidden even if visible is toggled to true ]] },
},
follow_current_file = true, -- This will find and focus the file in the active buffer every
-- time the current file is changed while the tree is open.
group_empty_dirs = false, -- when true, empty folders will be grouped together
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
-- in whatever position is specified in window.position
-- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes
-- instead of relying on nvim autocmd events.
window = {
mappings = {
["<bs>"] = "navigate_up",
["."] = "set_root",
["H"] = "toggle_hidden",
["/"] = "fuzzy_finder",
["D"] = "fuzzy_finder_directory",
["f"] = "filter_on_submit",
["<c-x>"] = "clear_filter",
["[g"] = "prev_git_modified",
["]g"] = "next_git_modified",
},
},
},
buffers = {
follow_current_file = true, -- This will find and focus the file in the active buffer every
-- time the current file is changed while the tree is open.
group_empty_dirs = true, -- when true, empty folders will be grouped together
show_unloaded = true,
window = {
mappings = {
["X"] = "buffer_delete",
["<bs>"] = "navigate_up",
["."] = "set_root",
},
},
},
git_status = {
window = {
position = "float",
mappings = {
["A"] = "git_add_all",
["gu"] = "git_unstage_file",
["ga"] = "git_add_file",
["gr"] = "git_revert_file",
["gc"] = "git_commit",
["gp"] = "git_push",
["gg"] = "git_commit_and_push",
},
},
},
}
g['neo_tree_remove_legacy_commands'] = 1
fn.sign_define("DiagnosticSignError", {text = "", texthl = "DiagnosticSignError"})
fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticSignWarn"})
fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticSignInfo"})
fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticSignHint"})
vimp.nnoremap({'silent'}, '<F2>', ':Neotree toggle reveal position=left<CR>')
vimp.nnoremap({'silent'}, '<leader>gs', ':Neotree float git_status<CR>')
vimp.nnoremap({'silent'}, '<leader><S-TAB>', ':Neotree toggle reveal float source=buffers<CR>')
neotree.setup(util.mconfig('config.neotree', defaults))
end

View File

@ -1,8 +0,0 @@
return function()
local g = vim.g
-- Balance pairs when on open, close and delete
g.pear_tree_smart_openers = 1
g.pear_tree_smart_closers = 1
g.pear_tree_smart_backspace = 1
end

View File

@ -1,11 +0,0 @@
return function()
local g = vim.g
-- Don't force qf/loc windows to bottom
g.qf_window_bottom = 0
g.qf_loclist_window_bottom = 0
-- Let Neomake control window size
g.qf_auto_resize = 0
end

View File

@ -1,11 +0,0 @@
return function()
local g, vimp = vim.g, require 'vimp'
g['tmux_navigator_no_mappings'] = 1
g['tmux_navigator_disable_when_zoomed'] = 1
vimp.nnoremap({'override', 'silent'}, '<C-h>', ':TmuxNavigateLeft<CR>')
vimp.nnoremap({'override', 'silent'}, '<C-j>', ':TmuxNavigateDown<CR>')
vimp.nnoremap({'override', 'silent'}, '<C-k>', ':TmuxNavigateUp<CR>')
vimp.nnoremap({'override', 'silent'}, '<C-l>', ':TmuxNavigateRight<CR>')
end

View File

@ -0,0 +1,9 @@
-- Core / low level plugins used by others
return {
-- Community patch for Vim
{ 'tpope/vim-sensible', version = false, lazy = false },
-- Used in psoxizsh.* modules
{ 'nvim-lua/plenary.nvim', version = false, lazy = true },
}

View File

@ -0,0 +1,146 @@
local keys = require 'psoxizsh.key.binds'
return {
-- Disables search highlights when not searching
{ 'romainl/vim-cool', version = false, lazy = false },
-- Extends the '%' operator
{ 'andymass/vim-matchup', version = false, lazy = false },
-- Allows for per-window searches
{ 'mox-mox/vim-localsearch', version = false, lazy = false },
-- Comment helpers
{ 'scrooloose/nerdcommenter', version = false, lazy = false },
-- Text alignment
{ 'junegunn/vim-easy-align', version = false, lazy = false },
-- Pair () {} [], etc matching
{ 'tmsvg/pear-tree',
version = false,
lazy = false,
init = function(_)
-- Balance pairs when on open, close and delete
vim.g['pear_tree_smart_openers'] = 1
vim.g['pear_tree_smart_closers'] = 1
vim.g['pear_tree_smart_backspace'] = 1
-- Ignore Telescope windows
vim.g['pear_tree_ft_disabled'] = { 'TelescopePrompt' }
end,
},
{ 'echasnovski/mini.pairs', enabled = false }, -- We use pear-tree, disable LazyVim default
-- File browser
{ 'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
dependencies = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
opts = {
close_if_last_window = true,
enable_git_status = true,
filesystem = {
follow_current_file = { enabled = true },
}
},
keys = {
keys.Global.Super.FileBrowser:as { 'lazy', action = '<cmd>Neotree toggle reveal position=left<CR>' },
keys.Global.ToggleBuffers:as { 'lazy', action = '<cmd>Neotree toggle reveal float source=buffers<CR>' },
keys.Global.ToggleGitStatus:as { 'lazy', action = '<cmd>Neotree float git_status<CR>' },
},
},
-- Fuzzy search helpers
{ 'nvim-telescope/telescope.nvim',
branch = '0.1.x',
opts = {
defaults = {
mappings = { i = {
[keys.Global.Super.FuzzySearch.Key] = 'close'
}}
}
},
keys = {
keys.Global.Super.FuzzySearch:as { 'lazy', action = '<cmd>Telescope builtin<CR>' },
{ '<leader>,' , false },
}
},
-- Maker / diagnostics listing
{ 'folke/trouble.nvim',
dependencies = { 'kyazdani42/nvim-web-devicons' },
keys = {
keys.Global.Super.Diagnostics:as { 'lazy', action = '<cmd>Trouble diagnostics toggle<CR>' },
},
},
-- Terminal
{ 'akinsho/toggleterm.nvim',
version = '^2.0',
opts = {
open_mapping = keys.Global.Super.Terminal.Key,
start_in_insert = true,
insert_mappings = false,
terminal_mappings = true,
direction = 'float',
float_opts = { border = 'curved' },
},
keys = {
keys.Global.Super.Terminal:as { 'lazy', action = '<cmd>ToggleTerm<CR>' },
},
},
-- Tmux integration for pane movement
{ 'christoomey/vim-tmux-navigator',
cmd = { 'TmuxNavigateLeft', 'TmuxNavigateDown', 'TmuxNavigateUp', 'TmuxNavigateRight', 'TmuxNavigatePrevious' },
init = function(_)
vim.g['tmux_navigator_no_mappings'] = 1
vim.g['tmux_navigator_disable_when_zoomed'] = 1
end,
keys = {
keys.Global.NavigateUp:as { 'lazy', action = '<cmd>TmuxNavigateUp<CR>' },
keys.Global.NavigateLeft:as { 'lazy', action = '<cmd>TmuxNavigateLeft<CR>' },
keys.Global.NavigateRight:as { 'lazy', action = '<cmd>TmuxNavigateRight<CR>' },
keys.Global.NavigateDown:as { 'lazy', action = '<cmd>TmuxNavigateDown<CR>' },
},
},
-- Buffer management
{ 'qpkorr/vim-bufkill',
version = false,
lazy = false,
init = function(_)
-- We create these ourselves, with descriptions for which-key.nvim
vim.g['BufKillCreateMappings'] = 0
-- If the buffer you want to kill is in many windows,
-- the following option governs what to do.
--
-- default: 'confirm'
-- options: 'confirm' / 'kill' / 'cancel'
vim.g['BufKillActionWhenBufferDisplayedInAnotherWindow'] = 'confirm'
end,
keys = {
{ '<leader>bun' , '<Plug>BufKillBun' , desc = 'Unload Buffer' },
{ '<leader>!bun' , '<Plug>BufKillBangBun' , desc = 'Unload Buffer, force' },
{ '<leader>bd' , '<Plug>BufKillBd' , desc = 'Kill Buffer' },
{ '<leader>!bd' , '<Plug>BufKillBangBd' , desc = 'Kill Buffer, force' },
{ '<leader>bw' , '<Plug>BufKillBw' , desc = 'Wipeout Buffer' },
{ '<leader>!bw' , '<Plug>BufKillBangBw' , desc = 'Wipeout Buffer, force' },
{ '<leader>bundo' , '<Plug>BufKillUndo' , desc = 'Undo last Buffer action' },
},
},
-- Git integration
{ 'tpope/vim-fugitive', version = false, lazy = false },
-- Per project configuration
{ import = 'lazyvim.plugins.extras.lsp.neoconf' },
{ 'folke/neoconf.nvim',
version = '^1.0',
},
}

View File

@ -0,0 +1,191 @@
-- IDE components, autocompletion, DAPs
local keys = require 'psoxizsh.key.binds'
return {
-- Autocompletion + snippets + vim.diagnostic sources
-- Completion framework
{ 'hrsh7th/nvim-cmp',
dependencies = {
-- LSP sources
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lsp-signature-help',
-- Other sources:
{ url = 'https://codeberg.org/FelipeLema/cmp-async-path' },
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-cmdline',
'dmitmel/cmp-cmdline-history',
},
opts = function(_, opts)
local cmp = require('cmp')
local keys = keys.Global.AutoComplete ---@diagnostic disable-line: redefined-local
local auto_select = true
local has_words_before = function()
unpack = unpack or table.unpack
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
opts.preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None
opts.completion = { completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect") }
opts.mapping = cmp.mapping.preset.insert({
[keys.Next.Key] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.snippet.active({ direction = 1 }) then
vim.schedule(function() vim.snippet.jump(1) end)
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { 'i', 's' }),
[keys.Prev.Key] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.snippet.active({ direction = -1 }) then
vim.schedule(function() vim.snippet.jump(-1) end)
else
fallback()
end
end, { 'i', 's' }),
[keys.ScrollUp.Key] = cmp.mapping.scroll_docs(-4),
[keys.ScrollDown.Key] = cmp.mapping.scroll_docs(4),
[keys.Trigger.Key] = cmp.mapping.complete(),
[keys.Confirm.Key] = LazyVim.cmp.confirm({ select = auto_select }),
['<S-CR>'] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }),
[keys.Abort.Key] = function(fallback) cmp.abort() ; fallback() end,
})
-- Monkey patch the sources list LazyVim sets by default
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/coding.lua#L45-L50
local sources = {}
for _, src in ipairs(opts.sources) do
if src and src.name then
-- Insert function signature completions before LSP completions
if src.name == 'nvim_lsp' then
table.insert(sources, { name = 'nvim_lsp_signature_help' })
end
-- Replace path with async_path (less UI freezing)
if src.name == "path" then
table.insert(sources, { name = 'async_path' })
goto continue
end
-- Load completions from all open buffers
if src.name == 'buffer' then
table.insert(sources, { name = 'buffer', option = { get_bufnrs = vim.api.nvim_list_bufs } })
goto continue
end
end
table.insert(sources, src)
::continue::
end
opts.sources = sources
end
},
-- IDE stuff + language highlighting
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{ 'neovim/nvim-lspconfig' },
{ import = 'psoxizsh.lsp.keys' },
{ 'vim-perl/vim-perl',
version = false,
ft = { 'perl' },
build = 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny'
},
{ 'rust-lang/rust.vim',
version = false,
ft = { 'rust' }
},
{ 'pearofducks/ansible-vim',
version = false,
ft = { 'yaml.ansible', 'yaml', 'yml.ansible', 'yml' }
},
{ 'kevinoid/vim-jsonc',
version = false,
},
{ 'luochen1990/rainbow',
version = false,
lazy = false,
init = function(_) vim.g['rainbow_active'] = 1 end,
},
{ 'sheerun/vim-polyglot', version = false, lazy = false, },
-- Framework for integrating non-LSP sources into nvim's LSP framework
{ import = 'lazyvim.plugins.extras.lsp.none-ls' },
{ 'nvimtools/none-ls.nvim',
opts = function(_, _)
LazyVim.on_very_lazy(function()
local lazyfmt = require 'lazyvim.util.format'
-- Remove the none-ls formatter, as we only want LazyVim to initialize
-- none-ls, not register it as a formatter
for i, formatter in ipairs(lazyfmt.formatters) do
if formatter.name == 'none-ls.nvim' then
table.remove(lazyfmt.formatters, i)
break
end
end
end)
end
},
{ 'nvimtools/none-ls.nvim',
dependencies = { 'davidmh/cspell.nvim' },
opts = function(_, opts)
if vim.fn.executable('cspell') == 0 then return end
-- CSpell setup
local cspell = require 'cspell'
local cspell_config_json = function(_)
return vim.fn.stdpath('config') .. '/cspell.json'
end
local cspell_opts = {
config = {
find_json = cspell_config_json,
on_add_to_json = function(payload)
if vim.fn.executable('jq') == 0 then return end
local p = payload.cspell_config_path
os.execute(string.format(
"jq -S '.words |= sort' %s > %s.tmp && mv %s.tmp %s",
p, p, p, p
))
end,
on_add_to_dictionary = function(payload)
if vim.fn.executable('sort') == 0 then return end
local p = payload.dictionary_path
os.execute(string.format('sort --dictionary-order %s -o %s', p, p))
end
},
diagnostics_postprocess = function(d)
local level, levels = d.severity, vim.diagnostic.severity
-- Cap maximum severity of spelling mistakes
if level == levels.ERROR or level == levels.WARN then
d.severity = levels.INFO
end
end,
}
-- Ensure our config file exists, otherwise cspell complains
local uv = (vim.uv or vim.loop);
if not uv.fs_stat(cspell_config_json()) then
vim.fn.writefile({'{}'}, cspell_config_json())
end
opts.sources = vim.tbl_extend('force', opts.sources or {}, {
cspell.diagnostics.with(cspell_opts),
cspell.code_actions.with(cspell_opts),
})
end,
},
}

View File

@ -1,245 +1,13 @@
local cmd, bootstrap, util = vim.cmd, require 'psoxizsh.plugins.bootstrap', require 'psoxizsh.util'
local cb_table = {}
local packer = nil
local keys, fn = require 'psoxizsh.key.binds', require 'psoxizsh.functions'
local EARLY, LATE = { early = 1, pre = 1 }, { post = 1, late = 1 }
-- Wrap the provided function in async context that will wait until all plugins have been initialized
local function defer_wrap(fn)
if bootstrap() then return fn end
return function(plugs)
local a = require 'plenary.async'
a.run(function()
-- Yield until packer's global plugin list is available
while _G.packer_plugins == nil do
a.util.sleep(100)
end
end, function()
fn(plugs)
end)
end
end
-- Plugins provides a hook based wrapper around packer.nvim, allowing
-- callers to register hooks at specific lifecycle events such as pre
-- and post plugin load.
--
-- A new, uninitialized one is provided upon requiring this module,
-- See :setup/1 and :init/0 for more on configuring and initializing
-- this object
local Plugins = { mt = {} }
-- Creates a new, uninitialized Plugins
--
-- You must call :init/0 (and likely :setup/1) before using this
-- object, though you can directly invoke the Plugins object as
-- you would :setup/1 as a convenience
function Plugins.new()
local m = {
_list = {},
_hooks = {},
}
setmetatable(m, Plugins.mt)
return m
end
-- Configures this Plugins, with the provided opts
--
-- You can provide a tables of hooks by name or { name, callback }
-- tuples.
--
-- In the former case, Plugins will create User <name> autocmds
-- when the lifecycle stage is hit, which you can register arbitrary
-- code to be invoked on.
--
-- In the latter, the provided callback fn will be invoked at the
-- lifecycle stage, with 'post' and 'late' hooks being provided the
-- current Plugins object as the first argument
--
-- @opts = {
-- hooks = {
-- early = name | { name, callback/0 }
-- pre = name | { name, callback/0 }
-- post = name | { name, callback/1 }
-- late = name | { name, callback/1 }
-- }
-- }
function Plugins.setup(self, opts)
opts = opts or {}
local hooks = opts.hooks or {}
self._hooks = vim.tbl_map(function(hk)
local t = type(hk)
if t == 'string' then return hk end
if t == 'table' then return hk[1] end
end, hooks)
local callbacks = vim.tbl_map(function(hk)
local t = type(hk[2])
if t == 'function' then return hk[2] end
end, hooks)
self:list_regen()
self:register_callbacks(callbacks)
return self
end
-- Invokes the plugin manager, and hooks any provided hooks as they become ready
--
-- Note, you shouldn't rerun this function, use :reload/0 instead if you want to
-- reload an existing Plugins
function Plugins.init(self)
self:do_hook 'early'
if packer == nil then
cmd [[packadd packer.nvim]]
packer = require 'packer'
packer.init {
max_jobs = 32
}
end
packer.reset()
self:do_hook 'pre'
for _, spec in ipairs(self:list()) do
packer.use(spec)
end
self:do_hook 'post'
self:do_hook 'late'
return self
end
-- Regenerate the plugin spec list, reloading the config if it has changed.
--
-- Note that this method *only* reloads the spec list, it does not reload
-- plugins, see :reload/0 for that
function Plugins.list_regen(self)
local plugs = util.mreload('psoxizsh.plugins.plug')
self._list = plugs(util.try_mconfig('plug'))
return self:list()
end
-- Return the current plugin list
function Plugins.list(self)
return self._list
end
-- Get the plugin spec for the provided @id.
--
-- The plugin id will be either the last component of the name, or if redefined by 'as',
-- whatever 'as' is.
--
-- Returns the spec if it exists, nil otherwise
function Plugins.get(self, id)
local needle = function(p)
local plugid = p.as and p.as or p[1] and p[1]:match("^.+/(.+)$")
return plugid == id
end
return vim.tbl_filter(needle, self:list())[1]
end
-- Check if the plugin @id exists in the current spec table
--
-- Returns true if it does, nil otherwise
function Plugins.has(self, id)
return self:get(id) and true or nil
end
-- Reload plugins, and rerun any registered hooks
function Plugins.reload(self)
self:list_regen()
self:init()
packer.compile()
end
-- Request the active Plugins to run the provided lifecycle's hook
--
-- Note that this may not run immediately, depending on current lifecycle
-- of underlying plugin manager
--
-- @name { 'early' | 'pre' | 'post' | 'late' }
function Plugins.do_hook(self, name)
if LATE[name] then
self:_post_hook(self._hooks[name])
elseif EARLY[name] then
self:_pre_hook(self._hooks[name])
end
end
-- Manually (re)register callbacks for any configured lifecycle hooks
--
-- Note that any hooks that were not registered in :setup/1 will be
-- silently ignored.
--
-- You may consider re-initializing the active Plugins via :setup/1:init/0
function Plugins.register_callbacks(self, callbacks)
_G._psoxizsh_plugins_cb = function(id) cb_table[id](self) end
cb_table = {}
cmd [[augroup PsoxConfigCallbacks]]
cmd [[autocmd!]]
for n, fn in pairs(callbacks) do
local id = self._hooks[n]
cb_table[id] = self:_make_callback(n, fn)
cmd(string.format('autocmd User %s call v:lua._psoxizsh_plugins_cb("%s")', id, id))
end
cmd [[augroup END]]
end
function Plugins._pre_hook(self, hook)
self:_dispatch_autocmd(hook)
end
function Plugins._post_hook(self, hook)
if bootstrap() and hook then
cmd [[augroup PsoxConfigBootstrap]]
cmd [[autocmd!]]
cmd [[autocmd VimEnter * ++once PackerSync]]
cmd [[augroup END]]
cmd ('augroup PsoxConfigDeferHook_' .. hook)
cmd ('autocmd!')
cmd ('autocmd User PackerCompileDone doautocmd User ' .. hook)
cmd ('augroup END')
else
self:_dispatch_autocmd(hook)
end
end
function Plugins._dispatch_autocmd(_, hook)
if hook then cmd('doautocmd User ' .. hook) end
end
function Plugins._make_callback(_, name, fn)
if LATE[name] then
return defer_wrap(fn)
else
return fn
end
end
-- Setup a convenience method for setting up + initializing a Plugins object
-- via directly calling the object with the opts that would normally be
-- provided to :setup/1
function Plugins.mt.__call(self, opts)
self:setup(opts):init()
end
-- Allow callers to access the underlying packer object
function Plugins.mt.__index(_, key)
return Plugins[key] or packer[key]
end
return Plugins.new()
return {
{
'psoxizsh',
keys = {
keys.Global.Format:as { 'lazy', action = fn.Format },
keys.Global.ToggleGutter:as { 'lazy', action = fn.ToggleGutter },
keys.Global.OpenConfig:as { 'lazy', action = fn.OpenConfig },
keys.Global.SudoWrite:as { 'lazy', action = [[w !sudo tee % >/dev/null]] },
},
},
}

View File

@ -1,146 +0,0 @@
local plugins = {
-- Allow packer to manage itself
{ 'wbthomason/packer.nvim',
opt = true,
cmd = 'Packer*',
module_pattern = { 'packer', 'packer%..*' }
},
-- Community patch for Vim
{ 'tpope/vim-sensible' },
-- Used in psoxizsh.* modules
{ 'nvim-lua/plenary.nvim' },
-- Utils for wrapping vimscript in lua easier
{ 'svermeulen/vimpeccable',
as = 'vimp'
},
-- Used for autocmds if we're not using a late enough version of neovim
{ 'jakelinnzy/autocmd-lua',
disable = vim.fn.has('nvim-0.7') == 1
},
-- Text alignment
{ 'junegunn/vim-easy-align' },
{ 'tmsvg/pear-tree',
config = require 'psoxizsh.plugins.config.pear-tree'
},
-- Git integration
{ 'tpope/vim-fugitive' },
-- File browser
{ 'nvim-neo-tree/neo-tree.nvim',
as = 'neo-tree',
branch = 'v2.x',
requires = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
after = 'vimp',
cmd = { 'Neotree', 'NeoTree*' },
keys = { '<F2>', '<leader>gs', '<leader><S-TAB>' },
config = require 'psoxizsh.plugins.config.neotree'
},
-- Comment helpers
{ 'scrooloose/nerdcommenter' },
-- Stat line integrations
{ 'nvim-lualine/lualine.nvim',
requires = {
'kyazdani42/nvim-web-devicons',
'lewis6991/gitsigns.nvim'
},
config = require 'psoxizsh.plugins.config.lualine'
},
{ 'akinsho/bufferline.nvim',
as = "bufferline",
tag = "v1.*",
requires = { 'kyazdani42/nvim-web-devicons' },
after = 'vimp',
config = require 'psoxizsh.plugins.config.bufferline'
},
{ 'lewis6991/gitsigns.nvim',
tag = 'release',
requires = { 'nvim-lua/plenary.nvim' },
config = require 'psoxizsh.plugins.config.gitsigns'
},
-- Buffer mangement
{ 'qpkorr/vim-bufkill' },
{ 'romainl/vim-qf',
config = require 'psoxizsh.plugins.config.vim-qf'
},
-- IDE stuff + language highlighting
{ 'neoclide/coc.nvim',
disable = vim.fn.executable('node') ~= 1,
branch = 'release',
after = 'vimp',
config = require 'psoxizsh.plugins.config.coc'
},
{ 'neomake/neomake',
config = require 'psoxizsh.plugins.config.neomake'
},
{ 'vim-perl/vim-perl',
ft = 'perl',
run = 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny'
},
{ 'rust-lang/rust.vim',
ft = 'rust'
},
{ 'pearofducks/ansible-vim',
ft = {'yaml', 'yml'}
},
{ 'kevinoid/vim-jsonc' },
{ 'luochen1990/rainbow' },
{ 'sheerun/vim-polyglot' },
-- Fuzzy search helpers
{ 'junegunn/fzf',
cmd = 'FZF',
fn = { 'fzf#run', 'fzf#wrap' }
},
{ 'junegunn/fzf.vim',
config = require 'psoxizsh.plugins.config.fzf'
},
{ 'adelarsq/vim-matchit' },
{ 'mox-mox/vim-localsearch' },
-- Color themes
{ 'rakr/vim-one',
config = function() vim.cmd(string.format('colorscheme %s', vim.g.my_color_scheme or 'one')) end
},
{ 'romainl/vim-cool' },
-- Tmux integration for pane movement
{ 'christoomey/vim-tmux-navigator',
keys = { '<C-h>', '<C-j>', '<C-k>', '<C-l>' },
cmd = { 'TmuxNavigateLeft', 'TmuxNavigateDown', 'TmuxNavigateUp', 'TmuxNavigateRight', 'TmuxNavigatePrevious' },
config = require 'psoxizsh.plugins.config.vim-tmux-navigator'
},
-- Other
{ 'roxma/nvim-yarp' },
{ 'roxma/vim-hug-neovim-rpc' },
}
local function concatArray(a, b)
local result = {unpack(a)}
for i = 1,#b do
result[#a+i] = b[i]
end
return result
end
return function(extra)
extra = extra or {}
return concatArray(plugins, extra)
end

View File

@ -0,0 +1,25 @@
-- For configuration of NeoVim Treesitter
return {
{ 'nvim-treesitter/nvim-treesitter',
dependencies = { 'p00f/nvim-ts-rainbow', 'andymass/vim-matchup' },
opts = {
-- Trigger prompt to install plugin on loading relevant filetype
auto_install = true,
-- Added via p00f/nvim-ts-rainbow
rainbow = {
enable = true,
extended_mode = true,
},
-- Added via andymass/vim-matchup
matchup = {
enabled = true,
include_match_words = true,
disable_virtual_text = false,
},
},
keys = function() end, -- disable LazyVim keymaps (they're stupid)
},
}

View File

@ -0,0 +1,100 @@
-- NeoVim UI elements
--
-- These are constant features of your window, plus any pop-in elements, like
-- vim.notify, vim.ui, or virtual text handlers
local keys = require 'psoxizsh.key.binds'
local logo = string.rep('\n', 8) .. [[
]] .. '\n\n'
return {
-- Setting our logo for empty `nvim` loads
{ 'nvimdev/dashboard-nvim',
opts = function(_, opts)
opts.config = opts.config or {}
opts.config.header = vim.split(logo, '\n')
end
},
-- vim.notify handler
{ 'rcarriga/nvim-notify', version = '^3.0.0' },
-- Bottom line integrations
{ 'nvim-lualine/lualine.nvim',
dependencies = {
{ 'kyazdani42/nvim-web-devicons', version = false },
{ 'lewis6991/gitsigns.nvim' },
},
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/ui.lua#L96
opts = {
extensions = { 'fugitive', 'quickfix', 'man', 'fzf', 'neo-tree', 'toggleterm' }
},
},
-- Top line plugin
{ 'akinsho/bufferline.nvim',
version = '^4.0.0',
dependencies = { { 'kyazdani42/nvim-web-devicons', version = false } },
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/ui.lua#L39
opts = {
options = {
numbers = 'none',
diagnostics = false,
always_show_bufferline = true,
show_buffer_close_icons = false,
separator_style = 'slope',
sort_by = 'relative_directory',
},
},
keys = function()
return {
keys.Global.BufferNext:as { 'lazy', action = '<cmd>BufferLineCycleNext<CR>' },
keys.Global.BufferPrev:as { 'lazy', action = '<cmd>BufferLineCyclePrev<CR>' },
}
end
},
-- Git integration
{ 'lewis6991/gitsigns.nvim',
commit = 'd44a7948ffc717af578c424add818b7684c7ed68',
requires = { { 'nvim-lua/plenary.nvim', version = false } },
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/editor.lua#L247
opts = {
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol',
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
},
},
},
-- vim.ui.input & vim.ui.select handler
{ 'stevearc/dressing.nvim',
opts = {
input = {
default_prompt = '<|>',
mappings = { i = {
[keys.Plugin.Dressing.Close.Key] = 'Close',
[keys.Plugin.Dressing.Confirm.Key] = 'Confirm',
[keys.Plugin.Dressing.Prev.Key] = 'HistoryPrev',
[keys.Plugin.Dressing.Next.Key] = 'HistoryNext',
}},
},
select = { backend = { 'telescope', 'builtin' } },
},
},
}

View File

@ -0,0 +1,133 @@
---@class psoxizsh.startup
local M = {}
---Called first, before any user callbacks are triggered
function M.pre() end
---Called before any plugins are initialized, but after any early user callbacks
function M.early()
local o, g, fn, cmd = vim.opt, vim.g, vim.fn, vim.cmd
local au = require 'psoxizsh.autocmd'
-- local diagnostic = require 'psoxizsh.diagnostic'
g.autoformat = false
-- Color settings
o.background = 'dark'
o.termguicolors = true
-- Hide buffers don't close them
o.hidden = true
-- Sane pane opening
o.splitbelow = true
o.splitright = true
-- File indent opts
o.encoding = "utf-8"
o.shiftwidth = 2
o.tabstop = 8
o.softtabstop = 2
o.expandtab = true
o.list = true
o.listchars:append {
trail = '\u{02FD}',
extends = '\u{22B3}',
precedes = '\u{22B2}',
nbsp = '\u{02EC}',
conceal = '\u{2219}',
tab = '\u{2559}\u{254C}\u{2556}',
}
o.ignorecase = true
o.infercase = true
cmd 'filetype plugin indent on'
-- Lower update time (Default 4000)
o.updatetime = 300
-- Numbered lines
o.number = true
o.relativenumber = true
o.signcolumn = 'yes:1'
-- Disable '--INSERT--' and friends
o.showmode = false
-- Use existing buffers
o.switchbuf = { "useopen", "usetab" }
o.timeoutlen = 1000
-- Set global statusline (0.7+ only)
if fn.has('nvim-0.7') == 1 then o.laststatus = 3 end
-- Setup vim.diagnostic APIs
-- diagnostic.setup {}
au.PsoxFileAutos {
{ 'FileType', 'yaml', function() cmd 'setlocal indentkeys-=<:> ts=8 sts=2 sw=2 expandtab' end },
{ 'FileType', 'go', function() cmd 'setlocal ts=4 sts=4 sw=4 noexpandtab' end },
{ 'FileType', 'quickfix,netrw', 'setlocal nobuflisted' },
}
require('psoxizsh.startup.keybinds').register_keybinds()
end
---Called after plugins have finished initializing, but before any late user callbacks
function M.post()
local o, g, fn, cmd = vim.opt, vim.g, vim.fn, vim.cmd
local au = require 'psoxizsh.autocmd'
-- Setup file backups
cmd ':silent !mkdir -p ~/.vimbackup'
o.backupdir = fn.expand('~') .. '/.vimbackup'
o.directory = fn.expand('~') .. '/.vimbackup'
o.hlsearch = true
-- ripgrep settings
g.rg_highlight = 'true'
g.rg_derive_root = 'true'
-- Other
g.rainbow_active = 1
local color_highlights_override = function()
local hl = require 'psoxizsh.util.highlight'
-- For nvim-cmp, for whatever reason these are overwritten if set in the
-- config function
hl.CmpItemAbbrDeprecated { strikethrough = true }
hl.CmpItemAbbrMatch { bold = true }
hl.CmpItemAbbrMatchFuzzy { bold = true }
hl.CmpItemMenu { italic = true }
-- Disable stupid spelling highlights (the 90s were a weird time)
hl.SpellCap:clear()
hl.SpellLocal:clear()
hl.SpellRare:clear()
end
color_highlights_override()
au.PsoxColorSchemeOverrides {
{ 'ColorScheme', '*', color_highlights_override }
}
end
---Called after plugins have initialized and any user callbacks have triggered
function M.late()
-- Rest of config below is specifically not user override-able
local o = vim.opt
o.exrc = true
o.secure = true
o.modeline = true
o.modelines = 7
end
return M

View File

@ -0,0 +1,80 @@
---@class psoxizsh.startup.keybinds
local M = {}
---All non plugin specific, overridable keybinds registered by psoxizsh
function M.register_keybinds()
local map = LazyVim.safe_keymap_set
-- Better up/down
map({ 'n', 'x' }, 'j', "v:count == 0 ? 'gj' : 'j'", { desc = 'Down', expr = true, silent = true })
map({ 'n', 'x' }, '<Down>', "v:count == 0 ? 'gj' : 'j'", { desc = 'Down', expr = true, silent = true })
map({ 'n', 'x' }, 'k', "v:count == 0 ? 'gk' : 'k'", { desc = 'Up', expr = true, silent = true })
map({ 'n', 'x' }, '<Up>', "v:count == 0 ? 'gk' : 'k'", { desc = 'Up', expr = true, silent = true })
-- Move Lines
map('n', '<A-j>', '<cmd>m .+1<cr>==', { desc = 'Move Line Down' })
map('n', '<A-k>', '<cmd>m .-2<cr>==', { desc = 'Move Line Up' })
map('i', '<A-j>', '<esc><cmd>m .+1<cr>==gi', { desc = 'Move Line Down' })
map('i', '<A-k>', '<esc><cmd>m .-2<cr>==gi', { desc = 'Move Line Up' })
map('v', '<A-j>', ":m '>+1<cr>gv=gv", { desc = 'Move Line Down' })
map('v', '<A-k>', ":m '<-2<cr>gv=gv", { desc = 'Move Line Up' })
-- Clear search with <esc>
map({ 'i', 'n' }, '<esc>', '<cmd>noh<cr><esc>', { desc = 'Escape and Clear hlsearch' })
-- Ensure the 'n' always searches forward and 'N' always searches backwards,
-- regardless of search mode ('/' '?')
--
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
map('n', 'n', "'Nn'[v:searchforward].'zv'", { expr = true, desc = 'Next Search Result' })
map('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next Search Result' })
map('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next Search Result' })
map('n', 'N', "'nN'[v:searchforward].'zv'", { expr = true, desc = 'Prev Search Result' })
map('x', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev Search Result' })
map('o', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev Search Result' })
-- Add undo break-points
map('i', ',', ',<c-g>u')
map('i', '.', '.<c-g>u')
map('i', ';', ';<c-g>u')
-- Better indenting
map('v', '<', '<gv')
map('v', '>', '>gv')
-- Diagnostics
map('n', ']o', vim.diagnostic.open_float, { desc = 'Line Diagnostics' })
map('n', ']g', M.diagnostic_goto(true), { desc = 'Next Diagnostic' })
map('n', '[g', M.diagnostic_goto(false), { desc = 'Prev Diagnostic' })
map('n', ']e', M.diagnostic_goto(true, 'ERROR'), { desc = 'Next Error' })
map('n', '[e', M.diagnostic_goto(false, 'ERROR'), { desc = 'Prev Error' })
-- Quit
map('n', '<leader>qa', '<cmd>qa<CR>', { desc = 'Quit All' })
-- Highlights under cursor
map('n', '<leader>hi', vim.show_pos, { desc = 'Inspect Pos' })
map('n', '<leader>hI', '<cmd>InspectTree<cr>', { desc = 'Inspect Tree' })
-- Windows
map('n', '<leader>w', '<C-w>', { desc = 'Windows', remap = true })
map('n', '<leader>wd', '<C-W>c', { desc = 'Delete Window', remap = true })
map('n', '<leader>-', '<C-W>s', { desc = 'New Window Below', remap = true })
map('n', '<leader>|', '<C-W>v', { desc = 'New Window Right', remap = true })
LazyVim.toggle.map('<leader>wz', LazyVim.toggle.maximize)
end
---Helper function for moving between diagnostics
---@param next boolean
---@param severity? 'ERROR'|'WARN'|'INFO'|'HINT'
---@return function
function M.diagnostic_goto(next, severity)
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
---@cast severity +integer
severity = severity and vim.diagnostic.severity[severity] or nil
return function() go({ severity = severity }) end
end
return M

View File

@ -1,68 +0,0 @@
local Util = {}
-- Reload a given module, returning the result of loading it.
function Util.mreload(module)
if package.loaded[module] then
package.loaded[module] = nil
end
return require(module)
end
-- Try reloading the given module, returning ok, module
function Util.try_mreload(module)
return pcall(Util.mreload, module)
end
-- Try reloading the given config module, returning either
-- its table or an empty one, if the module couldn't be loaded
--
-- The arguments can be:
-- 1. module string --> table
-- 2. module string --> fn() -> table
-- 3. table
-- 4. fn() --> table
--
-- It the latter cases, *configuration will not be reloaded*, this is
-- primaraily meant for inline, static configuration
function Util.try_mconfig(module)
if type(module) ~= "string" then
module = type(module) == "function" and module() or module
module = type(module) == "table" and module or {}
return module
end
local ok, config = Util.try_mreload(module)
config = type(config) == "function" and config() or config
return (ok and type(config) == "table") and config or {}
end
-- Retrieve the config table stored in the provided module,
-- merged with default the config module, if one is provided
--
-- The arguments can be:
-- 1. module string --> table
-- 2. module string --> fn() -> table
-- 3. table
-- 4. fn() --> table
--
-- It the latter cases, *configuration will not be reloaded*, this is
-- primaraily meant for inline, static configuration
--
-- Note: the config returned from the given module may optionally
-- set 'no_defaults = true' to opt out of the merging
function Util.mconfig(module, defaults)
module = Util.try_mconfig(module)
defaults = Util.try_mconfig(defaults)
if module.no_defaults then
return module
else
return vim.tbl_deep_extend('keep', module, defaults)
end
end
return Util

View File

@ -0,0 +1,201 @@
-- This module provides a highlight API that can be used in lua.
--
-- Each highlight may set its fg and bg colors, and any attributes
-- it may desire (italic, bold, etc).
--
-- You may also call .clear() on any highlight object to completely
-- remove the highlight
--
-- There are two major methods for using this module:
-- 1. By directly calling the module itself
-- 2. By indexing into the highlight group
--
-- Examples:
--
-- ```
-- local hl = require 'psoxizsh.util.highlight'
--
-- hl {
-- -- Note that colors are selected from sub objects first (gui.bg), then named top level
-- -- keys (ctermfg) and lastly unamed top level keys (fg, bg)
-- { 'Comment', italic = true, gui = { bg = '#0000' }, ctermbg = '#0000' },
-- -- You may select multiple highlight groups at once
-- { { 'TmuxSelect', 'TmuxHover' }, underdash = true, fg = '#FFFF', bg = '#FFFF' }
-- }
--
-- hl.clear({ 'Comment', 'TmuxHover', 'TmuxSelect' })
-- ```
--
-- ```
-- local hl = require 'psoxizsh.util.highlight'
--
-- hl.Comment { italic = true, underdot = true }
-- hl.LspInstallDone { bold = true, gui { bg = '#1E12' } }
-- hl.TmuxTree.clear()
-- ```
local cmd = vim.cmd
local ATTR = {
ITEMS = {
bold = 1, underline = 1, underlineline = 1,
undercurl = 1, underdot = 1, underdash = 1,
strikethrough = 1, reverse = 1, inverse = 1,
italic = 1, standout = 1, nocombine = 1,
NONE = 1,
},
KEYS = {
cterm = 1, ctermfg = 1, ctermbg = 1,
gui = 1, guifg = 1, guibg = 1, guisp = 1,
font = 1, blend = 1,
}
}
local Highlight = { mt = {} }
local Hl = { mt = {} }
-- Instantiates a new Hl object assiociated with the given hl_group
function Hl.new(hl_group)
local this = { group = hl_group, clear = Hl.clear }
setmetatable(this, Hl.mt)
return this
end
-- Deletes the highlight group assiociated with this Hl object
function Hl.clear(self)
cmd(string.format('highlight clear %s', self.group))
return true
end
-- Sets the highlight group assiociated with this Hl object
function Hl.set(self, n_opts)
local len, hl_line = 0, 'highlight ' .. self.group
for key, value in pairs(n_opts) do
len = len + 1
hl_line = hl_line .. Hl.attr2String(key, value)
end
if len == 0 then return nil end
cmd(hl_line)
return true
end
-- Normalizes the given highlight attributes into a format that can
-- be presented to ':highlight'
function Hl.normalize_attrs(_, raw)
local gui, cterm = raw.gui or {}, raw.cterm or {}
return {
cterm = Hl.attr_list('cterm', raw),
ctermfg = cterm.fg or raw.ctermfg,
ctermbg = cterm.bg or raw.ctermbg,
gui = Hl.attr_list('gui', raw),
guifg = gui.fg or raw.guifg or raw.fg,
guibg = gui.bg or raw.guibg or raw.bg,
font = gui.font or raw.font,
blend = gui.blend or raw.blend,
}
end
-- Generates a list of non nil attribute items, merging the
-- attrset and attrset[subkey] attributes trees, with the latter
-- having prefrence
function Hl.attr_list(subkey, attrset)
local list, sub = {}, attrset[subkey] or {}
for option, _ in pairs(ATTR.ITEMS) do
local resolved = sub[option] or attrset[option]
if resolved ~= nil then table.insert(list, option) end
end
return #list > 0 and list or nil
end
-- Formats the given attr key,value pair into a string that can be
-- given to ':highlight'
function Hl.attr2String(name, value)
if ATTR.KEYS[name] and #value > 0 then
local v = value
if type(v) == 'table' then
v = table.concat(value, ',')
end
return string.format(' %s=%s', name, v)
else
return ''
end
end
-- Sets the highlight group assiociated with this Hl object
function Hl.mt.__call(self, args)
local n_opts = Hl.normalize_attrs(self, args)
return Hl.set(self, n_opts)
end
-- Instantiates a new Highlight object
function Highlight.new()
local this = { clear = Highlight.clear }
setmetatable(this, Highlight.mt)
return this
end
-- Sets the given highlight group(s)
function Highlight.set(args)
local group = args[1] or args.group
if type(group) == 'table' then
local result = true
for _, g in ipairs(group) do
-- Failure is sticky, always record a failure if any group fails
if not Hl.new(g):set(args) and result then result = false end
end
return result
elseif type(group) == 'string' then
return Hl.new(group):set(args)
end
end
-- Clears the given highlight group.
--
-- Note this is closer to disabling the highlight group than it is to
-- resetting it to defaults
function Highlight.clear(group)
if type(group) == 'table' then
local result = true
for _, g in ipairs(group) do
-- Failure is sticky, always record a failure if any group fails
if not Hl.new(g):clear() and result then result = false end
end
return result
elseif type(group) == 'string' then
return Hl.new(group):clear()
end
end
-- Create a new Hl with the given name that can be called with a set
-- of highlight attrs to create / overwrite a highlight group
function Highlight.mt.__index(_, group)
return Hl.new(group)
end
-- Create highlight group(s), taking either a list or single attrset
function Highlight.mt.__call(_, args)
if args.group or type(args[1]) == 'string' then
return Highlight.set(args)
else
for _, attrset in ipairs(args) do
Highlight.set(attrset)
end
end
end
return Highlight.new()

View File

@ -0,0 +1,49 @@
local Util = { mt = {} }
local Lazy = { mt = {} }
local Submodules = {
mload = 'psoxizsh.util.mload',
}
function Util.new()
local this = { _submodules = Util.submodules() }
setmetatable(this, Util.mt)
return this
end
function Util.submodules()
local modules = {}
for key, mod in pairs(Submodules) do
modules[key] = Lazy.new(mod)
end
return modules
end
function Util.mt.__index(self, key)
for _, submod in pairs(self._submodules) do
if submod[key] then return submod[key] end
end
return nil
end
function Lazy.new(mod_name)
local this = { _module = false, _mod_name = mod_name }
setmetatable(this, Lazy.mt)
return this
end
function Lazy.mt.__index(self, key)
if not self._module then
self._module = require(self._mod_name)
end
return self._module[key]
end
return Util.new()

View File

@ -0,0 +1,120 @@
local M = {}
---@enum Code
local Code = { EXISTS = 1, NOT_FOUND = 0, LOAD_ERR = -1 }
--- Checks if the given module exists, and adds it to the preload
--- list if it does.
---@param module string
---@return boolean
local function module_exists(module)
if package.loaded[module] then return true end
for _, searcher in ipairs(package.loaders or package.searchers) do
local fn = searcher(module)
if type(fn) == 'function' then
package.preload[module] = fn
return true
end
end
return false
end
-- Reload a given module, returning the result of loading it.
function M.mreload(module)
if package.loaded[module] then
package.loaded[module] = nil
end
return require(module)
end
--- Try reloading the given module, returning (code, module|error)
--- Returns enumerated:
--- - Code.EXISTS, module
--- - Code.NOT_FOUND, nil
--- - Code.LOAD_ERR, error
---@param module string
---@return Code, any|string
function M.try_mreload(module)
if module_exists(module) then
local ok, result = pcall(M.mreload, module)
return ok and Code.EXISTS or Code.LOAD_ERR, result
else
return Code.NOT_FOUND, nil
end
end
-- Try reloading the given config module, returning either
-- its table or an empty one, if the module couldn't be loaded
--
-- The arguments can be:
-- 1. module string --> table
-- 2. module string --> fn() -> table
-- 3. table
-- 4. fn() --> table
--
-- It the latter cases, *configuration will not be reloaded*, this is
-- primarily meant for inline, static configuration
function M.try_mconfig(module)
-- Check if we were handed a object or function
-- instead of a module string
if type(module) ~= "string" then
module = type(module) == "function" and module() or module
module = type(module) == "table" and module or {}
return module
end
-- We definitely have a module string, try loading it
local c, config = M.try_mreload(module)
if c == Code.NOT_FOUND then
return {}
elseif c == Code.EXISTS then
return type(config) == "function" and config() or config
elseif c == Code.LOAD_ERR then
local options = {
title = string.format('Module Load Error: %s', module),
timeout = 2000
}
vim.notify_once(config, vim.log.levels.ERROR, options)
return {}
end
-- Catch fall through in case we ever add another Code variant
error(string.format("try_mconfig/1: unhandled Code '%s'", c))
end
-- Retrieve the config table stored in the provided module,
-- merged with default the config module, if one is provided
--
-- The arguments can be:
-- 1. module string --> table
-- 2. module string --> fn() -> table
-- 3. table
-- 4. fn() --> table
--
-- It the latter cases, *configuration will not be reloaded*, this is
-- primarily meant for inline, static configuration
--
-- Note: the config returned from the given module may optionally
-- set 'no_defaults = true' to opt out of the merging
function M.mconfig(module, defaults)
module = M.try_mconfig(module)
defaults = M.try_mconfig(defaults)
if module.no_defaults then
return module
else
return vim.tbl_deep_extend('keep', module, defaults)
end
end
return M

@ -1 +1 @@
Subproject commit 1448d234d6d9c25f64a48b16379b34db28a36898
Subproject commit c8e600f39779c6d2ef75b40304b5391a541c41df

View File

@ -0,0 +1,33 @@
# This fragmenet is meant to be used with a Vim plugin and provides unified movement
# between Vim window/panes and tmux panes. It requires you install the following in
# Vim to function correctly:
#
# github.com/christoomey/vim-tmux-navigator
#
# Include it by adding the following snippet to your early (or late) tmux.conf:
#
# source-file "$PSOXIZSH/tmux/fragment/ctrl-shift-movement.conf"
### --- This uses Ctrl-Shift-<arrow> movement --- ###
# Integration with vim-tmux-navigator & fzf
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind -n C-S-Left run "($is_vim && tmux send-keys C-S-Left) \
|| tmux select-pane -L"
bind -n C-S-Down run "($is_vim && tmux send-keys C-S-Down) \
|| ($is_fzf && tmux send-keys C-S-Down) \
|| tmux select-pane -D"
bind -n C-S-Up run "($is_vim && tmux send-keys C-S-Up) \
|| ($is_fzf && tmux send-keys C-S-Up) \
|| tmux select-pane -U"
bind -n C-S-Right run "($is_vim && tmux send-keys C-S-Right) \
|| tmux select-pane -R"
bind-key -T copy-mode-vi 'C-S-Left' select-pane -L
bind-key -T copy-mode-vi 'C-S-Down' select-pane -D
bind-key -T copy-mode-vi 'C-S-Up' select-pane -U
bind-key -T copy-mode-vi 'C-S-Right' select-pane -R

@ -1 +1 @@
Subproject commit 693e5a2a0f6acfd2666882655d5dfd32e8c6c50b
Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946

View File

@ -27,10 +27,14 @@ set -g status-right '#T #[fg=yellow,bold]#(uptime -p)#[default] #[fg=cyan,bold]%
set -g set-titles on
setw -g aggressive-resize on
setw -g monitor-activity on
# The following three makes italics work in tmux
set -g xterm-keys on
set -g default-terminal "xterm-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m'
# Correctly set up terminal for truecolor support
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ',xterm-256color:Tc'
# Fix :h 'autoread' in Vim
set -g focus-events on
# Refresh status line every 5 seconds
set -g status-interval 5

@ -1 +1 @@
Subproject commit e82701cb2b8c42f63479bb1a34e4f78a7cb5b75c
Subproject commit 46ae7ac8e35a52d2e2a8aed032d499cfcea49276

@ -1 +1 @@
Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8
Subproject commit c3d4e576c9c86eac62884bd47c01f6faed043fc5

@ -1 +1 @@
Subproject commit bebaa6126ede6bda698a6788c6cf3fa02ff1679c
Subproject commit 19ddc7f7cf0a4872d0dbfd8e4d9adc88eb37d1ff

@ -1 +1 @@
Subproject commit 4abed97b6e67eb5590b39bcd59080aa23192f25d
Subproject commit 87ce96b1862928d84b1afe7c173316614b30e301

@ -1 +1 @@
Subproject commit 1a9264bc661b3d52756916bf9ec3f41687d64db2
Subproject commit e0165eaa730dd0fa321a6a6de74f092fe87630b0

@ -0,0 +1 @@
Subproject commit cd730cd347dcc0d8ce1697f67714a90f07da26ed

@ -1 +1 @@
Subproject commit 3d3cff116a0c68ade27c537f85783afa80dd6e58
Subproject commit 53d04fcdc1ab938fc8242755378e3647facd6bff

44
zshrc
View File

@ -78,14 +78,18 @@ plugins=(
common-aliases
colored-man-pages
)
( which git &>/dev/null ) && plugins+=( git git-extras git-flow-avh ) && [[ "$ZSH_THEME" == "stemmet" ]] && [ -z "$_STARSHIP_Y_" ] && plugins+=( git-prompt )
( which git &>/dev/null ) &&
plugins+=( git git-extras git-flow-avh ) &&
[[ "$ZSH_THEME" == "stemmet" ]] &&
[ -z "$_STARSHIP_Y_" ] &&
plugins+=( git-prompt )
( which perl &>/dev/null ) && plugins+=( perl )
( which go &>/dev/null ) && plugins+=( golang )
( which oc &>/dev/null ) && plugins+=( oc )
( which rsync &>/dev/null ) && plugins+=( rsync )
( which aws &>/dev/null ) && plugins+=( aws )
( which rust &>/dev/null ) && plugins+=( rust )
( which cargo &>/dev/null ) && plugins+=( cargo )
( which jq &>/dev/null ) && plugins+=( jsontools )
( which encode64 &>/dev/null ) && plugins+=( encode64 )
( which docker-compose &>/dev/null ) && plugins+=( docker-compose )
@ -100,6 +104,8 @@ plugins=(
( which code &>/dev/null ) && plugins+=( vscode )
( which strfile &>/dev/null ) && plugins+=( chucknorris )
( which kubectl &>/dev/null ) && plugins+=( kubectl )
( which bazel &>/dev/null ) && plugins+=( bazel )
( which podman &>/dev/null ) && plugins+=( podman )
( [[ -e /etc/arch-release ]] ) && plugins+=( archlinux )
( [[ -e /etc/suse-release ]] ) && plugins+=( suse )
( [[ "$(uname)" == "Darwin" ]] ) && plugins+=( macos )
@ -116,21 +122,32 @@ plugins+=(
if [[ "$OSTYPE" =~ "linux*" || "$OSTYPE" =~ "darwin*" || "$OSTYPE" == "cygwin" ]]
then
export VIMINIT='source $MYVIMRC'
export VIMHOME=~/.vim
# Feature flag lua based Neovim config, until this is tested
# (and we figure out how to detect if we're running nvim or vim)
if [[ -n ${PSOXIZSH_EXPERIMENTAL_NEOVIM_LUA} ]]
# If neovim is installed, assume that we will not be supporting standard vim
if which nvim &>/dev/null
then
export MYVIMRC=$PSOXIZSH/init.lua
[[ -d ~/.config/nvim/lua/config ]] || mkdir -p ~/.config/nvim/lua/config
[[ -d ~/.config/nvim/lua/plugins ]] || mkdir -p ~/.config/nvim/lua/plugins
[[ -e ~/.config/nvim/init.lua ]] || ln -s $PSOXIZSH/init.lua ~/.config/nvim/init.lua
[[ -e ~/.config/nvim/lua/plugins/init.lua ]] || echo 'return {}' > ~/.config/nvim/lua/plugins/init.lua
else
export VIMINIT='source $MYVIMRC'
export MYVIMRC=$PSOXIZSH/vimrc
cmp $PSOXIZSH/vim/autoload/plug.vim $VIMHOME/autoload/plug.vim 2>/dev/null || (
mkdir -vp $VIMHOME/autoload/
cp -av $PSOXIZSH/vim/autoload/plug.vim $VIMHOME/autoload/plug.vim
)
fi
if [[ -n ${PSOXIZSH_EXPERIMENTAL_NEOVIM_LUA} ]]
then
if [[ ! -e ~/.cache/.psoxizsh_did_warn_neovim_lua ]]
then
echo "$0:$LINENO: The environment variable 'PSOXIZSH_EXPERIMENTAL_NEOVIM_LUA' is now unused, and may be removed"
touch ~/.cache/.psoxizsh_did_warn_neovim_lua &>/dev/null
fi
fi
fi
if [[ -d ~/.ssh ]]
@ -163,12 +180,15 @@ then
[ -z "$TMUX_PATH" ] && TMUX_PATH=~/.config/tmux
# Bootstrap the user's plugin directory, if required
[ -d "$TMUX_PATH/plugins" ] || { mkdir -vp "$TMUX_PATH/plugins" && cp -r "$PSOXIZSH/tmux/plugins" "$TMUX_PATH/plugins" }
# Bootstrap the users plugin directory, if required
[ -d "$TMUX_PATH/plugins" ] || {
mkdir -vp "$TMUX_PATH/plugins" &&
cp -r "$PSOXIZSH/tmux/plugins" "$TMUX_PATH/plugins"
}
# Both tmux and TPM are very opininated about where configs must live,
# and TPM will only expand one layer of source-file directives, so we
# symlink the base config to the user local config file, if it doesn't
# symlink the base config to the user local config file, if it does not
# exist.
[ ! -f ~/.tmux.conf ] && ln -s $PSOXIZSH/tmux/tmux.conf ~/.tmux.conf
[ ! -f "$TMUX_PATH/plugins.conf" ] && ln -s "$PSOXIZSH/tmux/fragment/plugins.conf" "$TMUX_PATH/plugins.conf"
@ -189,7 +209,7 @@ alias curlj="curl -H 'Content-Type: application/json' "
which nvim >/dev/null 2>&1 && alias vim="$(which nvim)"
alias v=vim
[[ -x /usr/bin/yay ]] && [[ "$(whoami)" != "pacman" ]] && alias yay='sudo -iupacman /usr/bin/yay'
[[ -x /usr/bin/paru ]] && [[ "$(whoami)" != "pacman" ]] && alias yay='sudo -iupacman /usr/bin/paru'
[[ -x /usr/bin/paru ]] && [[ "$(whoami)" != "pacman" ]] && alias paru='sudo -iupacman /usr/bin/paru'
typeset -A key
@ -252,7 +272,7 @@ fi
alias src='omz reload'
# Remove unwanted aliases
( where fd | grep -qE '\/s?bin\/fd' ) && alias fd &>/dev/null && unalias fd
( where fd | grep -qE '/s?bin/fd' ) && alias fd &>/dev/null && unalias fd
# Clean up global aliases
source <(alias -g | awk -F= '/^[A-Za-z]+/{print $1}' | xargs -I{} -n1 echo unalias "'{}'")