154 lines
4.1 KiB
Lua
Raw Normal View History

2023-07-14 16:21:54 -04:00
-- theming
-- Default options
require('nightfox').setup({
options = {
-- Compiled file's destination location
compile_path = vim.fn.stdpath("cache") .. "/nightfox",
compile_file_suffix = "_compiled", -- Compiled file suffix
transparent = false, -- Disable setting background
terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
dim_inactive = false, -- Non focused panes set to alternative background
module_default = true, -- Default enable value for modules
},
})
vim.cmd("colorscheme carbonfox")
--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.notify("triggering hover")
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
--vim.keymap.set("n", "", vim.lsp.buf.implementation, { buffer = args.buf })
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 })
]])
--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
-- Ensure nvim-web-deicons is loaded
require'nvim-web-devicons'.setup{}
-- setup nvim-tree
require("nvim-tree").setup{}
--({
-- sort_by = "case_sensitive",
-- view = {
-- width = 30,
-- },
-- renderer = {
-- group_empty = true,
-- },
-- filters = {
-- dotfiles = false,
-- },
--})
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)
--require("nvim-tree.api").tree.toggle()