init
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
lua << EOF
|
||||
|
||||
vim.o.termguicolors = true
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "lua" },
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "lua_ls",
|
||||
cmd = { "lua-language-server" },
|
||||
on_attach = on_attach,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "python" },
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "pyright",
|
||||
cmd = { "pyright-langserver", "--stdio" },
|
||||
on_attach = on_attach,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "c", "cpp" },
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "clangd",
|
||||
cmd = { "clangd" },
|
||||
on_attach = on_attach,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
|
||||
float = {
|
||||
border = "rounded",
|
||||
source = true,
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd([[
|
||||
highlight clear
|
||||
syntax reset
|
||||
highlight Normal guibg=NONE
|
||||
highlight NormalNC guibg=NONE
|
||||
highlight SignColumn guibg=NONE
|
||||
highlight FoldColumn guibg=NONE
|
||||
highlight VertSplit guibg=NONE
|
||||
highlight StatusLine guibg=NONE
|
||||
highlight StatusLineNC guibg=NONE
|
||||
highlight LineNr guibg=NONE
|
||||
highlight CursorLine guibg=#151515
|
||||
highlight CursorLineNr guibg=NONE gui=bold
|
||||
highlight Pmenu guibg=#121212
|
||||
highlight PmenuSel guibg=#2a2a2a
|
||||
highlight PmenuSbar guibg=#121212
|
||||
highlight PmenuThumb guibg=#4a4a4a
|
||||
highlight NormalFloat guibg=NONE
|
||||
highlight FloatBorder guibg=NONE
|
||||
highlight DiagnosticError guifg=#ff6b6b
|
||||
highlight DiagnosticWarn guifg=#ffd08a
|
||||
highlight DiagnosticInfo guifg=#9fe7ff
|
||||
highlight DiagnosticHint guifg=#7dff9a
|
||||
highlight DiagnosticVirtualTextError guifg=#ff6b6b guibg=NONE
|
||||
highlight DiagnosticVirtualTextWarn guifg=#ffd08a guibg=NONE
|
||||
highlight DiagnosticVirtualTextInfo guifg=#9fe7ff guibg=NONE
|
||||
highlight DiagnosticVirtualTextHint guifg=#7dff7a guibg=NONE
|
||||
highlight DiagnosticUnderlineError gui=undercurl guisp=#ff6b6b
|
||||
highlight DiagnosticUnderlineWarn gui=undercurl guisp=#ffd08a
|
||||
highlight DiagnosticUnderlineInfo gui=undercurl guisp=#9fe7ff
|
||||
highlight DiagnosticUnderlineHint gui=undercurl guisp=#7dff7a
|
||||
highlight LspReferenceText guibg=#1f1f1f
|
||||
highlight LspReferenceRead guibg=#1f1f1f
|
||||
highlight LspReferenceWrite guibg=#1f1f1f
|
||||
]])
|
||||
|
||||
--autopairs?
|
||||
require("nvim-autopairs").setup()
|
||||
|
||||
EOF
|
||||
Reference in New Issue
Block a user