fix: nvim tab and c-i keys
This commit is contained in:
parent
d80d64c5f3
commit
b1a8f70058
@ -73,6 +73,9 @@ map('n', '<Space>w', '<cmd>w<cr>', { noremap = true })
|
|||||||
map('n', '<Space>q', '<cmd>wq<cr>', { noremap = true })
|
map('n', '<Space>q', '<cmd>wq<cr>', { noremap = true })
|
||||||
map('n', '<Esc><Esc>', '<cmd>let @/ = ""<cr>', { noremap = true })
|
map('n', '<Esc><Esc>', '<cmd>let @/ = ""<cr>', { noremap = true })
|
||||||
|
|
||||||
|
-- fix interpreting C-I as Tab
|
||||||
|
map('n', '<C-I>', '<C-I>', { noremap = true })
|
||||||
|
|
||||||
-- Splits
|
-- Splits
|
||||||
map('n', '<C-h>', '<C-w>h', { noremap = true })
|
map('n', '<C-h>', '<C-w>h', { noremap = true })
|
||||||
map('n', '<C-j>', '<C-w>j', { noremap = true })
|
map('n', '<C-j>', '<C-w>j', { noremap = true })
|
||||||
@ -218,12 +221,6 @@ ls.config.set_config({
|
|||||||
|
|
||||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/snippets" })
|
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/snippets" })
|
||||||
|
|
||||||
local has_words_before = function()
|
|
||||||
unpack = unpack or table.unpack
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Completion
|
-- Completion
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
@ -236,20 +233,14 @@ cmp.setup {
|
|||||||
['<CR>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }),
|
['<CR>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }),
|
||||||
['<C-Space>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }),
|
['<C-Space>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }),
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if ls.expand_or_locally_jumpable() then
|
||||||
cmp.select_next_item()
|
|
||||||
elseif ls.expand_or_locally_jumpable() then
|
|
||||||
ls.expand_or_jump()
|
ls.expand_or_jump()
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if ls.locally_jumpable(-1) then
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif ls.locally_jumpable(-1) then
|
|
||||||
ls.jump(-1)
|
ls.jump(-1)
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
|
@ -3,6 +3,7 @@ env:
|
|||||||
|
|
||||||
key_bindings:
|
key_bindings:
|
||||||
- { key: N, mods: Control|Shift, action: SpawnNewInstance }
|
- { key: N, mods: Control|Shift, action: SpawnNewInstance }
|
||||||
|
- { key: I, mods: Control, chars: "\x1b[105;5u" }
|
||||||
|
|
||||||
font:
|
font:
|
||||||
normal:
|
normal:
|
||||||
|
Loading…
Reference in New Issue
Block a user