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
|
---@diagnostic disable: undefined-global
vim.o.termguicolors = true
vim.o.relativenumber = true
vim.o.number = true
vim.o.cc = "80"
vim.o.updatetime = 1000
vim.o.splitright = true
vim.o.splitbelow = true
vim.o.winborder = "bold"
vim.o.signcolumn = "no"
vim.o.ignorecase = true
vim.o.tabstop = 2
vim.o.shiftwidth = 0
vim.o.expandtab = true
vim.o.completeopt = "menu,menuone,noselect"
vim.o.undofile = true
vim.opt.path:append("**")
vim.g.mapleader = " "
vim.g.qs_highlight_on_keys = {"f", "F", "t", "T"}
vim.pack.add({
"https://github.com/neovim/nvim-lspconfig",
"https://github.com/WTFox/jellybeans.nvim",
})
for _, plugin in ipairs(vim.pack.get()) do
if not plugin.active then
vim.pack.del({plugin.path:match(".*/(.*)$")})
end
end
-- Switch between semantically related files easily :)
local exts = {{"c", "h"}, {"cc", "hh"}, {"frag", "vert"}}
vim.keymap.set("n", "<leader>s", function()
local bufpath = vim.api.nvim_buf_get_name(0)
for _, pair in ipairs(exts) do
for i, ext in ipairs(pair) do
if bufpath:match("%." .. ext .. "$") then
local other = pair[i % #pair + 1]
vim.cmd("e " .. bufpath:gsub("%." .. ext .. "$", "." .. other))
return
end
end
end
print("no files to swap to")
end)
-- I accidentally hit this when I'm incrementing and decrementing numbers
-- vim.keymap.set("n", "<C-z>", "<Nop>")
vim.keymap.set("n", "<C-p>", ":find ")
vim.keymap.set("n", "<C-f>", ":grep ")
vim.lsp.enable({"lua_ls", "clangd"})
vim.diagnostic.config({virtual_text=true, severity_sort=true})
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(ev)
local opts = {silent=true, buffer=ev.buf}
vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts)
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
local client = vim.lsp.get_client_by_id(ev.data.client_id)
local chars = {}
for i = 32, 126 do
table.insert(chars, string.char(i))
end
client.server_capabilities.completionProvider.triggerCharacters = chars
if client:supports_method("textDocument/completion") then
vim.lsp.completion.enable(true, client.id, ev.buf, {autotrigger=true})
end
end,
})
vim.cmd.colorscheme("jellybeans")
vim.api.nvim_set_hl(0, "ColorColumn", {bg="#222222"})
vim.api.nvim_set_hl(0, "NormalFloat", {link="Normal"})
|