Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boltlessengineer/smart-tab.nvim
Easily jump to the end of current node.
https://github.com/boltlessengineer/smart-tab.nvim
neovim neovim-plugin nvim nvim-plugin
Last synced: 3 months ago
JSON representation
Easily jump to the end of current node.
- Host: GitHub
- URL: https://github.com/boltlessengineer/smart-tab.nvim
- Owner: boltlessengineer
- Created: 2023-10-28T04:40:00.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2023-11-18T06:58:24.000Z (8 months ago)
- Last Synced: 2024-01-25T14:02:56.557Z (5 months ago)
- Topics: neovim, neovim-plugin, nvim, nvim-plugin
- Language: Lua
- Homepage:
- Size: 7.81 KB
- Stars: 45
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Lists
- awesome-stars - boltlessengineer/smart-tab.nvim - Easily jump to the end of current node. (Lua)
- my-neovim-pluginlist - boltlessengineer/smart-tab.nvim - tab.nvim) ![](https://img.shields.io/github/last-commit/boltlessengineer/smart-tab.nvim) ![](https://img.shields.io/github/commit-activity/y/boltlessengineer/smart-tab.nvim) (Editing support / Insert)
README
# smart-tab.nvim
simple plugin implements smart-tab feature from [Helix
23.10](https://helix-editor.com/news/release-23-10-highlights/#smart-tab).> Smart Tab is a new feature bound to the tab key in the default keymap.
> When you press tab and the line to the left of the cursor isn't all
> whitespace, the cursor will jump to the end of the syntax tree's
> parent node.> This is useful in languages like Nix for adding semicolons at the end
> of an attribute set or jumping to the end of a block in a C-like
> language## Note for differences
I haven't used or looked inside helix's implementation. I just borrowed
the idea, so behavior might differ from Helix's. Let me know if you have
any suggestions for improvement.## Setup
```lua
require('smart-tab').setup({
-- default options:
-- list of tree-sitter node types to filter
skips = { "string_content" },
-- default mapping, set `false` if you don't want automatic mapping
mapping = "",
-- filetypes to exclude
exclude_filetypes = {}
})
```### Manual Keymap
```lua
vim.keymap.set("i", "", require('smart-tab').smart_tab)
```> NOTE: this won't fallback to ``
## Usage
1. Press `` on insert mode.
2. If cursor is at non-blank line, cursor jumps to end of the current
node- If current node type is in `skips`, cursor jumps to end of it's
parrent node- If cursor is at blank line, literal `` is inserted
### Examples
Normal smart-tab.
```javascript
let obj = {
key = 1,| // <- press here
}
let obj = {
key = 1,
}| // <- cursor moves to here
```Smart tab with skipping some node types.
```javascript
let str = "abc|de"
// ^ press here
let str = "abcde"|
// ^ cursor moves to here (skipping `string_content` node)
```You can still insert `` on blank line.
```javascript
let example3 = {
| // <- press in blank line
}
let example3 = {
| // literal `` is inserted
}
```