-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeymaps.lua
More file actions
53 lines (50 loc) · 1.23 KB
/
Copy pathkeymaps.lua
File metadata and controls
53 lines (50 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
local keymap = vim.keymap.set
local opts = { noremap = true, silent = true }
local function is_floating_window()
return vim.api.nvim_win_get_config(0).relative ~= ""
end
keymap("n", "<Space>", "", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local whichkey_ok, _ = pcall(require, "whichkey")
if whichkey_ok then
keymap("n", "<C-Space>", "<cmd>WhichKey \\<space><cr>", opts)
end
keymap("n", "<C-i>", "<C-i>", opts)
keymap("t", "<Esc>", [[<C-\><C-n>]], { noremap = true })
-- Buffer hopping
local disabled_tab_hopping = {
help = true,
qf = true,
nofile = true,
fugitiveblame = true,
fugitive = true,
NeogitStatus = true,
fzf = true,
lazy = true,
mason = true,
}
keymap("n", "<Tab>", function()
if disabled_tab_hopping[vim.bo.filetype]
or is_floating_window()
then
return
end
if not (vim.fn.winlayout()[1] == "leaf") then
vim.cmd('wincmd w')
else
vim.cmd("bn")
end
end, opts)
keymap("n", "<S-Tab>", function()
if disabled_tab_hopping[vim.bo.filetype]
or is_floating_window()
then
return
end
if not (vim.fn.winlayout()[1] == "leaf") then
vim.cmd('wincmd x')
else
vim.cmd("bp")
end
end, opts)