-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
125 lines (104 loc) · 3.72 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
vim.opt.termguicolors=true
vim.cmd "set background=dark"
require("config.lazy")
-- Open to config everytime
vim.cmd "cd ~/.config/"
-- Options
-- Tabset
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4 -- insert 2 spaces for a tab
vim.opt.softtabstop = 4 -- insert 2 spaces for a tab
vim.opt.expandtab = true -- convert tabs to spaces
-- Scroll options
vim.opt.scrolloff = 12
vim.opt.sidescrolloff = 6
vim.opt.fillchars = vim.opt.fillchars + "eob: "
vim.opt.fillchars:append {
stl = " ",
}
vim.opt.shortmess:append "c"
vim.opt.laststatus = 3 -- sets a global statusbar
vim.opt.ruler = false
vim.opt.updatetime = 50 -- faster completion (4000ms default)
vim.opt.smartindent = true -- make indenting smarter again
vim.opt.splitbelow = true -- force all horizontal splits to go below current window
vim.opt.splitright = true -- force all vertical splits to go to the right of current window
vim.opt.undofile = true -- enable persistent undo
vim.opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
vim.opt.pumblend = 8
vim.opt.pumheight = 8 -- pop up menu height
vim.opt.conceallevel = 0 -- so that `` is visible in markdown files
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
-- Pasting
vim.opt.clipboard = "unnamedplus"
-- Line numbering
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true -- highlight the current line
vim.opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time
-- Line wrapping
vim.opt.wrap = false
vim.cmd "set whichwrap+=h,l"
-- File management
vim.opt.backup = false
vim.opt.swapfile = false
-- Search
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.keymap.set("n", "<space><space>x", "<cmd>source %<CR>")
vim.keymap.set("n", "<space>x", ":.lua<CR>")
vim.keymap.set("v", "<space>x", ":lua<CR>")
vim.keymap.set("n", "<Leader>bn", "<cmd>bnext <CR>")
vim.keymap.set("n", "<Leader>bp", "<cmd>bprevious <CR>")
vim.keymap.set("n", "<Leader>h", "<cmd>Dashboard <CR>")
vim.keymap.set("n", "<Up>", "<Nop>")
vim.keymap.set("n", "<Down>", "<Nop>")
vim.keymap.set("n", "<Left>", "<Nop>")
vim.keymap.set("n", "<Right>", "<Nop>")
vim.keymap.set("n", "<Esc><Esc>", ":q<CR>")
-- vim.keymap.set("n", "<M-j>", "<cmd>cnext<CR>")
-- vim.keymap.set("n", "<M-k>", "<cmd>cprev<CR>")
-- Autocommands
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- Set textwrap on and spell check for markdown and git files.
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "gitcommit", "markdown", "NeogitCommitMessage" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- vim.api.nvim_create_autocmd("TermOpen", {
-- group = vim.api.nvim_create_augroup("custom-term-open", { clear = true }),
-- callback = function()
-- vim.opt.number = false
-- vim.opt.relativenumber = false
-- end,
-- })
-- local job_id = 0
-- vim.keymap.set("n", "<space>to", function()
-- vim.cmd.vnew()
-- vim.cmd.term()
-- vim.cmd.wincmd("J")
-- vim.api.nvim_win_set_height(0, 5)
-- job_id = vim.bo.channel
-- end)
-- local current_command = ""
-- vim.keymap.set("n", "<space>te", function()
-- current_command = vim.fn.input("Command: ")
-- end)
-- vim.keymap.set("n", "<space>tr", function()
-- if current_command == "" then
-- current_command = vim.fn.input("Command: ")
-- end
-- vim.fn.chansend(job_id, { current_command .. "\r\n" })
-- end)