Faster, faster and faster! A neovim distro based on my dotfiles.
For better experience, you can use LightBoat.starter to install this distro.
Check LightBoat.starter to learn how to install this distro with the starter.
- [N]
ys{motion}{pair}: Surround with{pair}. - [N]
yss{pair}: Surround the whole line with{pair}. - [N]
yS{pair}: Surround till end of line with{pair}. - [N]
ds{pair}: Delete surrounding{pair}. - [N]
cs{old_pair}{new_pair}: Change surrounding from{old_pair}to{new_pair}. - [V]
S{pair}: Surround the selected text with{pair}.
NOTE: There is a special pair called f (function call) provided by nvim-surround.
With this pair, you can add, delete, and change function call. For example, ysiwf will
let you input a function name, and then it will surround the current word with
function_name(current_word). You can use dsf to delete the function call,
and csf{new_function_name} to change the function name.
NOTE: There is a special pair called q (quotation mark) provided by nvim-surround.
'', "", and `` are all valid pairs. With this pair, you can use dsq,
and csq{pair} to delete, and change surrounding quotation marks.
NOTE: For pair surround, all the opening brackets will add a space around the content,
while all the closing brackets will not add a space around the content. For example,
ysiw( will result in ( content ), while ysiw) will result in (content).
- [N]
gcu: Git current undo. Reset current hunk. - [N]
gcd: Git current diff. Show the diff of current hunk. - [N]
gcl: Git current blame line. Show the git blame of current line. - [N]
g]: Go to next unstaged hunk. - [N]
g[: Go to previous unstaged hunk. - [N]
gca: Git conflict accept ancestor. - [N]
gcb: Git conflict accept both. - [N]
gcc: Git conflict accept current. - [N]
gci: Git conflict accept incoming. - [N]
gcn: Git conflict accept none. - [N]
]x: Go to next conflict. - [N]
[x: Go to previous conflict.
- [N]
<leader>{num}: Go to the{num}-th buffer.0for the 10-th buffer. - [N]
<leader>h: Split vertically and leave the cursor in the left window. - [N]
<leader>j: Split horizontally and leave the cursor in the bottom window. - [N]
<leader>k: Split horizontally and leave the cursor in the top window - [N]
<leader>l: Split vertically and leave the cursor in the right window. - [N]
<leader>T: Move current window to a new tab. - [N]
<c-h>: Move to the left window. - [N]
<c-j>: Move to the bottom window. - [N]
<c-k>: Move to the top window. - [N]
<c-l>: Move to the right window. - [N]
=: Equalize the size of all windows. - [N]
<left>: Resize current window to the left. - [N]
<down>: Resize current window to the bottom. - [N]
<up>: Resize current window to the top. - [N]
<right>: Resize current window to the right. - [N]
H: Go to the left buffer of current one in buffer line. - [N]
L: Go to the right buffer of current one in buffer line. - [N]
gb: Buffer picker. Pick a buffer in buffer line to go to.
- [I]
<localleader>1: Insert heading level 1. - [I]
<localleader>2: Insert heading level 2. - [I]
<localleader>3: Insert heading level 3. - [I]
<localleader>4: Insert heading level 4. - [I]
<localleader>a: Insert image block. - [I]
<localleader>b: Insert bold line block. - [I]
<localleader>c: Insert code block. - [I]
<localleader>d: Insert delete line block. - [I]
<localleader>f: Move to and remove next placeholder. - [I]
<localleader>i: Insert italic line block. - [I]
<localleader>m: Insert math line block. - [I]
<localleader>t: Insert command line block. - [I]
<localleader>M: Insert math block. - [NV]
gx: Toggle task list item.
- [N]
%: When{count}is less than 7, it will move to the{count}-th matching word. Otherwise, it will move to the{count}percentage of the file. - [N]
g%: Go to previous matching word. - [N]
]%: Go to next outer closing word. - [N]
[%: Go to previous outer opening word. - [N]
z%: Go to next inner of a block. - [N]
Z%: Go to previous inner of a block.
- [N]
<leader>r: Run current file with the appropriate program. - [N]
<leader>tt: Toggleexpandtab. - [N]
<leader>t2: Set tab with 2 spaces. - [N]
<leader>t4: Set tab with 4 spaces. - [N]
<leader>t8: Set tab with 8 spaces.
There are two types of mappings in LightBoat:
- The builtin key mappings, which are defined in the keymap.lua file. These key mappings do not depend on other plugins.
- The key mappings for plugins, which are defined in the plugins' files.
For the second type of key mappings, it can be divided into two sub-types:
- Those can be customized by configuring
vim.g.lightboat_opts. - Those can not be customized by configuring
vim.g.lightboat_opts.
Those below are the default configuration for some key mappings of type 1:
return {
keys = {
-- ...
['<leader>l'] = { key = '<leader>l', desc = 'Split right' },
['<leader>j'] = { key = '<leader>j', desc = 'Split below' },
['<leader>h'] = { key = '<leader>h', desc = 'Split right' },
['<leader>k'] = { key = '<leader>k', desc = 'Split above' },
-- ...
},
}If you want to customize some key mappings. For example, you man want to use <c-s> to split
the window, you just need to update the key fields of the origin key mappings:
-- Make sure the variable is not `nil`
vim.g.lightboat_opts = {}
vim.g.lightboat_opts.keymap = {}
vim.g.lightboat_opts.keymap.keys = {
-- Use `<c-s>` to split vertically
['<leader>l'] = { key = '<c-s>' },
-- Disable the `<leader>h` key mapping
['<leader>h'] = false,
}When you customize the key mappings, you should be careful that your new key is not
occupied by LightBoat. To do so, you can use :map <c-s> to check if the key is occupied.
In this case, you will get output like:
s <C-S> *@<Lua 1326: ~/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/apply.lua:41>
blink.cmp
n <C-S> * <Lua 358: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
Flash Search Two Characters
x <C-S> * <Lua 163: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
Flash Search Two Characters
s <C-S> * <Lua 22: vim/_defaults.lua:0>
vim.lsp.buf.signature_help()
These are telling you that the <c-s> in n, x, and s modes are occupied.
Let's take a look at the default key mappings of comment:
return {
keys = {
-- ...
['<m-/>'] = {
key = '<m-/>',
mode = { 'n', 'x', 'i' },
expr = true,
remap = true,
desc = 'Toggle comment for current line',
},
['<m-?>'] = {
key = '<m-?>',
mode = { 'n', 'x', 'i' },
expr = true,
remap = true,
desc = 'Comment toggle current block',
},
},
}To customize these above, you just need to update the key fields.
For example, if you want to update <m-/> into <c-/>, you can do this below:
vim.g.lightboat_opts = {}
vim.g.lightboat_opts.comment = {}
vim.g.lightboat_opts.comment.keys = {
-- NOTE:
-- `<c-/>` is a little bit special in nvim.
-- To know what `<c-/>` really is in your terminal,
-- you can press `<c-v><c-/>` in insert mode, which will give you the right key to binding
['<m-/>'] = { key = '�' },
}To know what is the current configuration, you can run
:lua vim.api.nvim_buf_set_lines(0, 0, 0, false, vim.split(vim.inspect(vim.g.lightboat_opts), '\n'))
in an empty buffer, this will set current buffer with the current configuration.