181 lines
4.7 KiB
Lua
Raw Normal View History

2023-07-14 16:21:54 -04:00
-- theming
-- Default options
2023-07-19 18:23:57 -04:00
vim.opt.termguicolors = true
2023-07-19 18:58:36 -04:00
vim.cmd.colorscheme 'duskfox'
2023-07-14 16:21:54 -04:00
--https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
2023-07-16 22:21:45 -04:00
local lsconfig = require("lspconfig")
2023-07-14 16:21:54 -04:00
-- Nix language server support
2023-07-16 22:21:45 -04:00
lsconfig.nil_ls.setup{}
2023-07-14 16:21:54 -04:00
-- This needs a path to the omnisharp dll provided
2023-07-16 22:21:45 -04:00
lsconfig.omnisharp.setup {}
2023-07-14 16:21:54 -04:00
-- Java language server support
2023-07-16 22:21:45 -04:00
lsconfig.java_language_server.setup{}
2023-07-14 16:21:54 -04:00
-- Typescript language server support
2023-07-16 22:21:45 -04:00
lsconfig.tsserver.setup{}
2023-07-14 16:21:54 -04:00
2023-07-16 22:21:45 -04:00
-- Rust language server support
lsconfig.rust_analyzer.setup{}
-- lsp configuration
2023-07-14 16:21:54 -04:00
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local opts = { buffer = args.buf }
vim.keymap.set("n", '<C-Space>', function()
vim.lsp.buf.hover()
end, opts)
vim.keymap.set({"n", "v"}, "<Leader>a", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "<Leader>f", vim.lsp.buf.format, opts)
2023-07-16 22:21:45 -04:00
-- We use F2 to rename things
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename, opts)
2023-07-14 16:21:54 -04:00
end,
})
-- LSP Diagnostics Options Setup
local sign = function(opts)
vim.fn.sign_define(opts.name, {
texthl = opts.name,
text = opts.text,
numhl = ''
})
end
sign({name = 'DiagnosticSignError', text = '🔥'})
sign({name = 'DiagnosticSignWarn', text = '⚠️'})
sign({name = 'DiagnosticSignHint', text = '➡️'})
sign({name = 'DiagnosticSignInfo', text = '🗒️'})
vim.diagnostic.config({
virtual_text = false,
signs = true,
update_in_insert = true,
underline = true,
severity_sort = false,
float = {
border = 'rounded',
source = 'always',
header = '',
prefix = '',
},
})
vim.cmd([[
set signcolumn=yes
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
]])
2023-07-19 18:23:57 -04:00
vim.cmd([[
let g:coq_settings = { 'auto_start': 'shut-up', 'display.icons.mode': "none" }
]])
require("coq")
2023-07-19 18:58:36 -04:00
2023-07-14 16:21:54 -04:00
--Set completeopt to have a better completion experience
-- :help completeopt
-- menuone: popup even when there's only one match
-- noinsert: Do not insert text until a selection is made
-- noselect: Do not select, force to select one from the menu
-- shortness: avoid showing extra messages when using completion
-- updatetime: set updatetime for CursorHold
vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'}
vim.opt.shortmess = vim.opt.shortmess + { c = true}
vim.api.nvim_set_option('updatetime', 300)
-- Fixed column for diagnostics to appear
-- Show autodiagnostic popup on cursor hover_range
-- Goto previous / next diagnostic warning / error
-- Show inlay_hints more frequently
vim.cmd([[
set signcolumn=yes
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
]])
-- Treesitter Plugin Setup
require('nvim-treesitter.configs').setup {
highlight = {
enable = true,
additional_vim_regex_highlighting=false,
},
ident = { enable = true },
rainbow = {
enable = true,
extended_mode = true,
max_file_lines = nil,
}
}
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
2023-07-16 22:21:45 -04:00
-- setup nvim-tree
2023-07-19 18:58:36 -04:00
require("nvim-tree").setup{
hijack_unnamed_buffer_when_opening = true,
update_focused_file = {
enable = true,
},
renderer = {
icons = {
show = {
file = false,
},
glyphs = {
default = "-",
symlink = "S",
bookmark = "🎗",
modified = "",
folder = {
arrow_closed = "",
arrow_open = "",
default = "📁",
open = "📂",
empty = "📁",
empty_open = "📂",
symlink = "S",
symlink_open = "S",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "X",
ignored = "",
},
},
},
},
diagnostics = {
enable = true,
show_on_dirs = true,
icons = {
hint = "➡️",
info = "🗒️",
warning = "⚠️",
error = "🔥",
},
},
}
2023-07-16 21:20:15 -04:00
vim.keymap.set("n", "<C-p>", function()
require("nvim-tree.api").tree.toggle()
end)
2023-07-16 22:21:45 -04:00
vim.keymap.set("i", "<C-j>", function()
print("Handling C-J")
vim.notify("Handling C-J")
end)
2023-07-19 18:58:36 -04:00
-- Show whatever errors we have in our trouble pane
vim.keymap.set("n", "<Leader>se", "<cmd>TroubleToggle<cr>", { silent = true, noremap = true })