-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
69 lines (62 loc) · 2.12 KB
/
Copy pathinit.lua
File metadata and controls
69 lines (62 loc) · 2.12 KB
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
-- bootstrap lazy.nvim
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",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
vim.opt.termguicolors = true
vim.o.background = "dark"
vim.g.mapleader = " "
vim.g.maplocalleader = " "
require("lsp.handlers")
require("config")
require("keymaps")
vim.opt.relativenumber = true
vim.opt.clipboard = "unnamedplus"
vim.opt.number = true
vim.opt.breakindent = true
vim.opt.undofile = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.updatetime = 250
vim.opt.signcolumn = 'yes'
vim.opt.scrolloff = 5
vim.opt.hlsearch = false
vim.opt.tabstop = 2 -- number of spaces that a <Tab> in the file counts for
vim.opt.shiftwidth = 2 -- number of spaces to use for each step of (auto)indent
vim.opt.expandtab = false -- convert tabs to spaces
vim.opt.smartindent = true -- smart autoindenting when starting a new line
vim.o.winbar = "%f" -- show file path in the window bar
vim.opt.splitright = true -- vertical splits will automatically be to the right
local on_attach = require("lsp.on_attach").setup
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(ev)
on_attach(nil, ev.buf) -- client is ev.data.client_id if you need it
end,
})
local group = vim.api.nvim_create_augroup("ForceLineNumbersEverywhere", { clear = true })
-- Whenever a window becomes active (or a terminal opens) turn numbers back on.
vim.api.nvim_create_autocmd({ "WinEnter", "BufWinEnter", "TermOpen", "CmdwinEnter" }, {
group = group,
callback = function() -- no args needed
vim.wo.number = true
vim.wo.relativenumber = true
end,
})
-- Optional: if any script/plugin toggles the options later, flip them back.
vim.api.nvim_create_autocmd("OptionSet", {
group = group,
pattern = { "number", "relativenumber" },
callback = function()
-- guard against endless recursion by changing only when off
if not vim.wo.number then vim.wo.number = true end
if not vim.wo.relativenumber then vim.wo.relativenumber = true end
end,
})