-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
73 lines (58 loc) · 1.75 KB
/
init.lua
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
-- Adapted from https://github.com/LunarVim/Neovim-from-scratch/blob/master/lua/user/options.lua
local options = {
backup = false,
fileencoding = "utf-8",
number = true,
relativenumber = true,
smartindent = true,
tabstop = 4,
wrap = true,
linebreak = true,
}
for k, v in pairs(options) do
vim.opt[k] = v
end
-- set local leader
if vim.g.maplocalleader == nil then
vim.g.maplocalleader = " "
end
-- https://github.com/LunarVim/Neovim-from-scratch/blob/master/lua/user/keymaps.lua
local opts = { noremap = true, silent = true }
local keymap = vim.keymap.set
-- Modes
-- normal_mode = "n",
-- insert_mode = "i",
-- visual_mode = "v",
-- visual_block_mode = "x",
-- term_mode = "t",
-- command_mode = "c",
-- Normal --
-- Better window navigation
keymap("n", "<C-h>", "<C-w>h", opts)
keymap("n", "<C-j>", "<C-w>j", opts)
keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)
-- Resize with arrows
keymap("n", "-", ":resize -2<CR>", opts)
keymap("n", "=", ":resize +2<CR>", opts)
keymap("n", "<C-->", ":vertical resize -2<CR>", opts)
keymap("n", "<C-=>", ":vertical resize +2<CR>", opts)
-- Navigate buffers
keymap("n", "<S-l>", ":bnext<CR>", opts)
keymap("n", "<S-h>", ":bprevious<CR>", opts)
-- use U for redo :))
keymap("n", "U", "<C-r>", opts)
-- terminal
-- keymap("t", "<C-h>", "<cmd>wincmd h<CR>", opts)
-- keymap("t", "<C-j>", "<cmd>wincmd j<CR>", opts)
-- keymap("t", "<C-k>", "<cmd>wincmd k<CR>", opts)
-- keymap("t", "<C-l>", "<cmd>wincmd l<CR>", opts)
-- Insert --
-- Press jk fast to exit insert mode
keymap("i", "jk", "<ESC>", opts)
keymap("i", "kj", "<ESC>", opts)
-- Visual --
-- Stay in indent mode
keymap("v", "<", "<gv^", opts)
keymap("v", ">", ">gv^", opts)
keymap("v", "/", "gc", opts)