aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/binds.lua
blob: 55da90535cbbdc1c4106517843bf9eda08492840 (plain)
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
54
local map = vim.keymap.set
-- local color_converter = require "color_converter"

-- toggle nvim-tree
map("n", "<Leader>t", "<cmd>NvimTreeToggle<CR>")
-- toggle trouble
map("n", "<Leader>e", "<cmd>TroubleToggle<CR>")
-- undo
map("n", "U", "<C-r>")

map("c", "<CR>", function()
    if vim.fn.pumvisible() == 1 then
        return "<C-y>"
    end
    return "<CR>"
end, { expr = true })

map("n", "H", "5h")
map("n", "J", "5j")
map("n", "K", "5k")
map("n", "L", "5l")

-- disable arrow keys
map("n", "<UP>", "<NOP>")
map("n", "<DOWN>", "<NOP>")
map("n", "<LEFT>", "<NOP>")
map("n", "<RIGHT>", "<NOP>")

map("i", "<UP>", "<NOP>")
map("i", "<DOWN>", "<NOP>")
map("i", "<LEFT>", "<NOP>")
map("i", "<RIGHT>", "<NOP>")

map("n", "<Leader>h", vim.lsp.buf.hover)
map("n", "<Leader>gd", vim.lsp.buf.definition)

map("n", "<leader>bp", function()
    require('cokeline.mappings').pick("focus")
end, { desc = "Pick a buffer to focus" })
map("n", "<leader>bq", function()
    require('cokeline.mappings').pick("close")
end, { desc = "Pick a buffer to close" })
map("n", "<Leader>p", function ()
    require("cokeline.mappings").by_step("switch", -1)
end, { silent = true })
map("n", "<Leader>n", function ()
    require("cokeline.mappings").by_step("switch", 1)
end, { silent = true })


-- local function setup_lsp_keys(_client, buffer)
--     map("<Leader>d", vim.diagnostic.open_float, "Line diagnostics")
--
-- end