README: Allow to use Tab for indentation (#38)
This commit is contained in:
committed by
GitHub
parent
6b9570920e
commit
a46cfc219b
@@ -178,10 +178,17 @@ mapping = {
|
|||||||
You can specify your own custom mapping function.
|
You can specify your own custom mapping function.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
local check_back_space = function()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s')
|
||||||
|
end
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
['<Tab>'] = function(fallback)
|
['<Tab>'] = function(fallback)
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 then
|
||||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
|
||||||
|
elseif check_back_space() then
|
||||||
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Tab>', true, true, true), 'n')
|
||||||
elseif vim.fn['vsnip#available']() == 1 then
|
elseif vim.fn['vsnip#available']() == 1 then
|
||||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>(vsnip-expand-or-jump)', true, true, true), '')
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>(vsnip-expand-or-jump)', true, true, true), '')
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user