Commit Graph

313 Commits

Author SHA1 Message Date
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