Author of CHADTree here.
My goal is to eventually bring neovim to VSCode level of experience.
I cannot do this in lua, it is too painful to use for this type of work.
All of my stuff here are private, including the dependencies.
If you want to use my config, please fork it, because I will tinker with stuff all the time.
This is all type checked!
settings["updatetime"] = 300
settings["whichwrap"] += ("h", "l", "<", ">", "[", "]")
keymap.nv("/", silent=False) << "/\V"
keymap.nv("?", silent=False) << "?\V"
autocmd("FocusLost", "VimLeavePre", modifiers=("*", "nested")) << "silent wa!"
Runtime validation of configuration. You can't make typos, or type errors!
You can even configure LSPs from YAML!
- bin: mypy
type: fs
args:
- --
- ${filename}
filetypes:
- python
install:
pip:
- mypy
- uri: https://github.com/junegunn/fzf.vim
vals:
fzf_buffers_jump: True
fzf_layout:
window:
width: 0.9
height: 0.9
keys:
- modes: n
opts:
silent: False
maps:
"<leader>O": ":Rg "
Will install NPM & PIP & go & git packages for you in their private namespace.
Only accessible from inside neovim
.
install.sh packages
Will also remind you to update weekly. Runs inside neovim
in a floating window.
Will also install runtime dependencies under their private namespace.
The runtime is isolated from your other packages!
install.sh deps
And many setting changes akin to emacs
' CUA
mode.
-
Not only install dependencies for you
-
Able to run multiple linters in parallel on the same file
-
Able to run multiple prettiers in sequence on the same file
-
A
word
text object that works for lisps and in help docs -
Locale aware!
-
and some more basic ones like
move
,replace
,search
,entire
-
Built-in float term
-
Built-in tab detection
-
Debounced auto save
-
...
Prefix: I am not ragging on any of the other plugin authors. In fact I use alot of the plugins written in a VimL style. However, I do think the old way of doing things is a bit insane, as you will see in my comparison.
Due to the well known limitations of VimL there is this tendency for things written in VimL to use alot of built-in functions, especially regex, which is in my opinion is counter productive because they introduce much accidental complexity.
Take the example of tab detection
.
We have two essential problems:
-
Should I use tab or space for this file?
-
What is the predominate tab size?
Look at how a popular Vim plugin solves this:
From a glance we can know that:
-
It is language specific
-
It tries to detect comments
-
It has some fairly "intricate" regex beyond just "tell me where whitespaces are"
Now something like this is not only very difficult to read, but also even harder to generalize onto all filetypes, and ensure there are no werid corner cases.
Now compare this to the following naive algorithm
-
Sample some lines from the file deterministically
-
If the lines start with more tabs than spaces, indent with
tabs
, else withspaces
-
For each line in sample, from
i
in[2..8]
, expand tabs withi
spaces -
Calculate
indent_level
for each line in 3) and outputdivisibility
asindent_level % i == 0
ifindent_level > 0
-
Reverse sort by
divisibility, i
in lexicographic order, the foremosti
is the indent level
Now this is not only easy to implement, it is also very easy to understand.
We only do [2..8]
because no sane person would use > 8
levels of indent.
The indent level with the greatest divisibility
implies that most lines are indented at that level.
To solve the issue of common divisors, we sort by highest i