-
Notifications
You must be signed in to change notification settings - Fork 0
/
repro.lua
93 lines (83 loc) · 2.48 KB
/
repro.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
-- Taken from: https://github.com/stevearc/oil.nvim
--
-- ```sh
-- nvim -u repro.lua
-- ```
--
-- Set stdpaths to use $DOTFILES/.repro/
local root = vim.fn.resolve(vim.env.DOTFILES .. "/.repro")
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- Bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.runtimepath:prepend(lazypath)
-- Opts
vim.g.mapleader = " "
vim.o.cursorline = true
vim.o.inccommand = "split"
vim.o.mouse = "a"
vim.o.number = true
vim.o.relativenumber = true
vim.o.signcolumn = "yes"
vim.o.smartcase = true
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.swapfile = false
vim.o.wrap = false
-- Keymap
vim.keymap.set("i", "kj", "<esc>")
vim.keymap.set("n", "-", "<cmd>Ex<cr>")
vim.keymap.set("n", "<leader>e", ":e!<space>")
vim.keymap.set("n", "<leader>c", "<cmd>close<cr>")
vim.keymap.set("n", "<leader>h", "<c-w>s")
vim.keymap.set("n", "<leader>v", "<c-w>v")
vim.keymap.set("n", "<leader>w", "<cmd>w<cr>")
vim.keymap.set("n", "<leader>x", "<cmd>qa<cr>")
vim.keymap.set("n", "<leader>;", "<cmd>noh<cr><cmd>echon<cr>")
vim.keymap.set("n", "<c-j>", "<c-w>j")
vim.keymap.set("n", "<c-h>", "<c-w>h")
vim.keymap.set("n", "<c-k>", "<c-w>k")
vim.keymap.set("n", "<c-l>", "<c-w>l")
vim.keymap.set("n", "M", "<c-w>o")
vim.keymap.set("n", "<bs>", "<c-^>")
vim.keymap.set({ "n", "x" }, ";", ":")
vim.keymap.set({ "n", "x" }, ":", ";")
vim.keymap.set({ "n", "x", "o" }, "H", "^")
vim.keymap.set({ "n", "x", "o" }, "L", "$")
-- Install plugins
local plugins = {
{
"ibhagwan/fzf-lua",
config = function()
local fzf = require("fzf-lua")
fzf.setup({})
vim.keymap.set("n", "<leader>o", fzf.files)
vim.keymap.set("n", "<leader>fk", function()
fzf.grep({ no_esc = true, search = "\\w" })
end)
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
install = {
colorscheme = { "default" },
},
dev = {
path = vim.fn.resolve(vim.env.PROJECT_HOME .. "/vim"),
},
})