some slight changes

This commit is contained in:
Lucy Hochkamp 2024-03-17 09:07:28 +01:00
parent be17bb97d2
commit ff468ca2d7
No known key found for this signature in database
70 changed files with 245 additions and 2131 deletions

View file

@ -0,0 +1,53 @@
local cmp = require 'cmp'
local lspkind = require 'lspkind'
local luasnip = require 'luasnip'
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = {
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = 'nvim_lsp_signature_help' },
{ name = "luasnip" },
}, { name = "buffer" }),
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
})
}),
},
})

View file

@ -0,0 +1,25 @@
local dap = require('dap')
dap.adapters.coreclr = {
type = 'executable',
command = '/nix/var/nix/profiles/per-user/ragon/home-manager/home-path/bin/netcoredbg', -- TODO this is a gross hack, please fix
args = {'--interpreter=vscode'}
}
dap.configurations.cs = {
{
type = "coreclr",
name = "launch - netcoredbg",
request = "launch",
program = function()
return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file')
end,
},
{
type = "coreclr",
name = "attach - netcoredbg",
mode = "local",
request = "attach",
processId = require("dap.utils").pick_process,
},
}
require'dapui'.setup {}

View file

@ -0,0 +1 @@
require('gitsigns').setup {}

View file

@ -0,0 +1,114 @@
local lspconfig = require 'lspconfig'
local util = require 'lspconfig.util'
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- lsp keymaps
local lsp_attach_keymappings = {
['gD'] = 'vim.lsp.buf.declaration()',
['gd'] = 'require\'telescope.builtin\'.lsp_definitions()',
['K'] = 'vim.lsp.buf.hover()',
['gi'] = 'require\'telescope.builtin\'.lsp_implementations()',
['<localleader>k'] = 'vim.lsp.buf.signature_help()',
['<leader>wa'] = 'vim.lsp.buf.add_workspace_folder()',
['<leader>wr'] = 'vim.lsp.buf.remove_workspace_folder()',
['<leader>ws'] = 'require\'telescope.builtin\'.lsp_workspace_symbols()',
['<leader>wl'] = 'print(vim.inspect(vim.lsp.buf.list_workspace_folders()))',
['<leader>D'] = 'require\'telescope.builtin\'.lsp_type_definitions()',
['<leader>rn'] = 'vim.lsp.buf.rename()',
['<leader>ca'] = 'vim.lsp.buf.code_action()',
['gr'] = 'require\'telescope.builtin\'.lsp_references()',
['<leader>f'] = 'vim.lsp.buf.format()'
}
local buf_nnoremap_lua = function(bufnr, keys, command)
vim.api.nvim_buf_set_keymap(bufnr, 'n', keys, '<cmd>lua ' .. command .. '<CR>', { noremap = true, silent = true })
end
local on_lsp_attach = function(_, bufnr)
-- Enable completion triggered by <c-x><c-o>:
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
for key, cmd in pairs(lsp_attach_keymappings) do buf_nnoremap_lua(bufnr, key, cmd) end
end
vim.g.markdown_fenced_languages = {
"ts=typescript"
}
lspconfig.denols.setup { capabilities = capabilities, on_attach = on_lsp_attach, root_dir = util.root_pattern("deno.json", "deno.jsonc") }
lspconfig.gopls.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.pyright.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.dartls.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.nil_ls.setup { capabilities = capabilities, on_attach = on_lsp_attach } -- nix
-- lspconfig.rnix.setup { capabilities = capabilities, on_attach = on_lsp_attach } -- nix
lspconfig.terraformls.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.kotlin_language_server.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.sourcekit.setup { capabilities = capabilities, on_attach = on_lsp_attach, cmd = { "xcrun", "sourcekit-lsp" } } -- swift
lspconfig.tsserver.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.vimls.setup {
capabilities = capabilities,
on_attach = on_lsp_attach,
isNeovim = true,
}
lspconfig.csharp_ls.setup {
capabilities = capabilities,
on_attach = on_lsp_attach,
cmd = { vim.env.HOME .. "/.dotnet/tools/csharp-ls" },
}
lspconfig.ltex.setup { capabilities = capabilities, on_attach = on_lsp_attach }
-- start vscode included language servers
lspconfig.eslint.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.html.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.cssls.setup { capabilities = capabilities, on_attach = on_lsp_attach }
lspconfig.jsonls.setup { capabilities = capabilities, on_attach = on_lsp_attach }
-- end vscode included language servers
lspconfig.texlab.setup { capabilities = capabilities, on_attach = on_lsp_attach, settings = { texlab = {
build = {
executable = "tectonic",
args = { "%f", "--keep-logs", "--synctex" },
onSave = true,
forwardSearchAfter = true,
},
chktex = { onOpenAndSave = true, },
forwardSearch = {
executable = "/Applications/Skim.app/Contents/SharedSupport/displayline",
args = { "-r", "-d", "%l", "%p", "%f" },
},
} } }
lspconfig.sumneko_lua.setup {
capabilities = capabilities, on_attach = on_lsp_attach,
settings = {
Lua = {
runtime = {
version = 'LuaJIT'
},
diagnostics = { globals = { 'vim' } },
workspace = {
-- Make the LSP aware of Neovim runtime files:
checkThirdParty = false,
library = vim.api.nvim_get_runtime_file('', true)
},
format = {
enable = true,
defaultConfig = {
indent_style = 'space',
indent_size = '2',
}
},
}
}
}
-- haskell
lspconfig.hls.setup { capabilities = capabilities, on_attach = on_lsp_attach }
local rt = require("rust-tools")
rt.setup({
tools = {
inlay_hints = {
auto = true,
},
},
server = {
capabilities = capabilities, on_attach = on_lsp_attach,
},
})
local ft = require('flutter-tools')
ft.setup {}

View file

@ -0,0 +1,215 @@
-- Eviline config for lualine
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require('lualine')
-- Color table for highlights
-- stylua: ignore
local colors = {
bg = '#202328',
fg = '#bbc2cf',
yellow = '#ECBE7B',
cyan = '#008080',
darkblue = '#081633',
green = '#98be65',
orange = '#FF8800',
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef',
red = '#ec5f67',
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = '',
section_separators = '',
theme = 'gruvbox',
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
-- Inserts a component in lualine_c at left section
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x at right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
function()
return ''
end,
color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this
}
ins_left {
-- mode component
function()
return ''
end,
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.red,
i = colors.green,
v = colors.blue,
[''] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
ins_left {
-- filesize component
'filesize',
cond = conditions.buffer_not_empty,
}
ins_left {
'filename',
cond = conditions.buffer_not_empty,
color = { fg = colors.magenta, gui = 'bold' },
}
ins_left { 'location' }
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_left {
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = '', warn = '', info = '' },
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
},
}
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {
function()
return '%='
end,
}
ins_left {
-- Lsp server name .
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return msg
end,
icon = ' LSP:',
color = { fg = '#ffffff', gui = 'bold' },
}
-- Add components to right sections
ins_right {
'o:encoding', -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'fileformat',
fmt = string.upper,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'branch',
icon = '',
color = { fg = colors.violet, gui = 'bold' },
}
ins_right {
'diff',
-- Is it me or the symbol for modified us really weird
symbols = { added = '', modified = '', removed = '' },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
ins_right {
function()
return ''
end,
color = { fg = colors.blue },
padding = { left = 1 },
}
-- Now don't forget to initialize lualine
lualine.setup(config)

View file

@ -0,0 +1,11 @@
require('nnn').setup({
set_default_mappings = 0,
replace_netrw = 1,
layout = {
window = {
width = 0.9,
height = 0.6,
highlight = 'Debug'
}
}
})

View file

@ -0,0 +1,26 @@
require("noice").setup({
views = {
notify = {
merge = true,
}
},
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
})
require("notify").setup({
-- stages = "static",
-- max_width = 70,
})

View file

@ -0,0 +1,12 @@
local telescope = require('telescope')
telescope.setup {
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
-- even more opts
}
}
}
}
telescope.load_extension('ui-select')

View file

@ -0,0 +1,35 @@
require('toggleterm').setup {
direction = 'window',
open_mapping = [[<c-n>]],
}
local Terminal = require('toggleterm.terminal').Terminal
local lazygit = Terminal:new {
cmd = "lazygit",
hidden = true,
direction = 'float'
}
function _lazygit_toggle()
lazygit:toggle()
end
local glab = Terminal:new {
cmd = "glab ci view",
hidden = true,
direction = 'float'
}
function _glab_toggle()
glab:toggle()
end
local ghub = Terminal:new {
cmd = "gh run view",
hidden = true,
direction = 'float'
}
function _ghub_toggle()
ghub:toggle()
end

View file

@ -0,0 +1,26 @@
local treesitter_parser_install_dir = '/var/tmp/nvim-treesitter/parser'
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
-- use_languagetree = true,
},
parser_install_dir = treesitter_parser_install_dir,
-- indent = {
-- enable = true,
-- },
-- autotag = {
-- enable = true,
-- },
-- context_commentstring = {
-- enable = true,
-- enable_autocmd = false,
-- },
-- refactor = {
-- highlight_definitions = { enable = true },
-- highlight_current_scope = { enable = false },
-- },
}
require'treesitter-context'.setup{
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
}