-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
71 lines (56 loc) · 1.93 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
local user_icons = require("const.user_icons")
-------------
-- OPTIONS --
-------------
-- map the leader key
vim.g.mapleader = " "
-- make all copy/paste operations use the system clipboard
vim.opt.clipboard = "unnamedplus"
-- ignore case when searching
vim.opt.ignorecase = true
-- mouse support
vim.opt.mouse = "a"
-- show line numbers
vim.opt.number = true
-- always open vertical splits on the right side
vim.opt.splitright = true
-- set the display width for tab characters
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
-- ensure that status-line and other things are aligned
-- see https://www.reddit.com/r/neovim/comments/ra7cbn/why_barbar_and_lualine_doesnt_align_with_nvimtree/
vim.opt.fillchars:append({ vert = user_icons.ui.VertSeparator })
-- ensure colors are displayed properly
vim.opt.termguicolors = true
------------------
-- AUTOCOMMANDS --
------------------
-- automatically detect file changes
vim.opt.updatetime = 250
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
pattern = { "*" },
command = "checktime",
})
-- disable the auto-insertion of comments
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "*" },
callback = function() vim.opt_local.formatoptions:remove({ "c", "r", "o" }) end,
})
------------------------
-- KEYBOARD SHORTCUTS --
------------------------
-- use semicolon to ender cmdline mode
vim.keymap.set("", ";", ":", { noremap = true })
-- set the keyboard shortcut ctrl+a to select all
vim.keymap.set("", "<C-a>", "<esc>ggVG<CR>", { noremap = true })
-- re-map keys to navigate through splits
vim.keymap.set("", "<C-J>", "<C-W><C-J>", { noremap = true })
vim.keymap.set("", "<C-K>", "<C-W><C-K>", { noremap = true })
vim.keymap.set("", "<C-L>", "<C-W><C-L>", { noremap = true })
vim.keymap.set("", "<C-H>", "<C-W><C-H>", { noremap = true })
-------------
-- PLUGINS --
-------------
require("plugins").configure()