What's Changed
Features
Add setup entry point and default options by @nmfirdausw in #1
Highlights
- Install and edit. One
setup() call gives you a modern editor with no extra configuration.
- Thoughtful defaults. Indentation, search, completion, folding and interface options are tuned and grouped by purpose.
- Pure Neovim. Batu sets native
vim.opt values and pulls in no dependencies.
- Fully overridable. Change any value with a table, or turn the defaults off with
options = false.
- Treesitter folds. Code folds by syntax and starts fully expanded.
Installation
Requires Neovim 0.12+ (uses vim.pack).
vim.pack.add({ "https://github.com/nmfirdausw/batu.nvim" })
require("batu").setup()
Options guide
setup() applies Batu's defaults through vim.opt. The options field controls what happens:
| Value |
Effect |
true (default) |
Apply Batu's defaults |
false |
Apply none |
| a table |
Apply the defaults, with your values merged on top |
-- Batu's defaults
require("batu").setup()
-- No defaults: you set every option yourself
require("batu").setup({ options = false })
-- Defaults, with your own values on top
require("batu").setup({
options = {
shiftwidth = 2,
tabstop = 2,
softtabstop = 2,
relativenumber = false,
},
})
Options in your table override Batu's values. Options you leave out keep Batu's defaults. You can also pass options Batu doesn't set.
What the defaults set
Editing
| Option |
Value |
Why |
expandtab |
true |
Insert spaces instead of tabs |
shiftwidth, tabstop, softtabstop |
4 |
4-space indentation |
shiftround |
true |
Round indents to a multiple of shiftwidth |
smartindent |
true |
Indent automatically on new lines |
virtualedit |
"block" |
Move freely in visual block mode |
Behaviour
| Option |
Value |
Why |
clipboard |
"unnamedplus" |
Share the system clipboard |
confirm |
true |
Ask before discarding unsaved changes |
undofile |
true |
Keep undo history across sessions |
timeoutlen |
300 |
Shorter wait for mapped key sequences |
updatetime |
250 |
Faster swap writes and CursorHold events |
Interface
| Option |
Value |
Why |
number, relativenumber |
true |
Hybrid line numbers |
cursorline, cursorlineopt |
true, "number" |
Highlight only the current line number |
cmdheight |
0 |
Hide the command line until needed |
laststatus |
3 |
One global statusline |
signcolumn |
"yes" |
Avoid layout shifts when signs appear |
list, listchars |
true, tab » , trail ·, nbsp ␣ |
Show whitespace |
scrolloff, sidescrolloff |
8 |
Keep context around the cursor |
pumheight |
10 |
Limit popup menu height |
splitbelow, splitright |
true |
Open splits below and to the right |
Search
| Option |
Value |
Why |
ignorecase, smartcase |
true |
Ignore case unless you type capitals |
inccommand |
"split" |
Preview :s results live in a split |
Completion
| Option |
Value |
Why |
completeopt |
"menuone,noselect" |
Show the menu without preselecting an item |
wildignorecase |
true |
Case-insensitive command-line completion |
wildmode |
"noselect:lastused,full" |
Offer last-used matches first |
Folding
| Option |
Value |
Why |
foldmethod |
"expr" |
Fold by expression |
foldexpr |
"v:lua.vim.treesitter.foldexpr()" |
Treesitter-based folds |
foldlevelstart |
99 |
Open all folds when a file opens |
Treesitter folds need a parser for the filetype. Without one, nothing folds.
New Contributors
Full Changelog: https://github.com/nmfirdausw/batu.nvim/commits/v0.1.0