-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
117 lines (99 loc) · 2.84 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
vim.loader.enable() -- enable experimental lua module loader
vim.cmd [[ set guifont=CaskaydiaCove\ Nerd\ Font:h10 ]]
if vim.fn.executable("fish") == 1 then
vim.opt.shell = "fish"
elseif vim.fn.executable("pwsh.exe") == 1 then
vim.opt.shell = "pwsh.exe"
vim.o.shellxquote = ''
vim.o.shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command '
vim.o.shellquote = ''
vim.o.shellpipe = '| Out-File -Encoding UTF8 %s'
vim.o.shellredir = '| Out-File -Encoding UTF8 %s'
end
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release
lazypath
})
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = ','
vim.g.maplocalleader = ','
-- Disable netrw because we have nvim-tree.
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
require("lazy").setup({
spec = {
{ import = "plugins" },
{ import = "plugins.lsp" },
{ import = "plugins.extras.lang" }
},
ui = {
border = "rounded",
},
change_detection = {
notify = false,
},
})
vim.o.background = "dark"
vim.cmd [[colorscheme catppuccin-mocha]]
vim.cmd [[set tabstop=4]]
vim.cmd [[set shiftwidth=4]]
vim.cmd [[set scrolloff=4]]
vim.cmd [[
set wrap
set linebreak
]]
vim.cmd [[set spelllang=en]]
vim.cmd [[set spelloptions=camel]]
vim.wo.number = true
vim.wo.relativenumber = true
vim.cmd [[
augroup LineNumbers
autocmd!
autocmd TermEnter * setlocal nonu nornu
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END
]]
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("AutoFmt", { clear = true }),
callback = function()
local client = vim.lsp.get_clients()[1]
if client and client.supports_method("textDocument/formatting") then
vim.lsp.buf.format()
end
end
})
if vim.fn.has("wsl") == 1 then
if vim.fn.executable("wl-copy") == 0 then
print("wl-clipboard is not installed, clipboard integration will not work")
else
vim.g.clipboard = {
name = "wl-clipboard (WSL)",
copy = {
["+"] = "wl-copy --type text/plain",
["*"] = "wl-copy --type text/plain --primary"
},
paste = {
["+"] = function()
return vim.fn.systemlist('wl-paste --no-newline|sed -e \"s/\r\\$//\"', { '' }, 1) -- '1' keeps empty lines
end,
["*"] = function()
return vim.fn.systemlist('wl-paste --primary --no-newline|sed -e \"s/\r\\$//\"', { '' }, 1)
end,
}
}
end
end
vim.cmd [[
aunmenu PopUp.How-to\ disable\ mouse
aunmenu PopUp.-1-
]]
vim.cmd [[ set modeline ]]
-- Redefine j and k to be more intuitive for soft-wrapped lines.
vim.keymap.set({ "n", "x" }, "j", "gj")
vim.keymap.set({ "n", "x" }, "k", "gk")