initial commit
Signed-off-by: Soc Virnyl Estela <contact@uncomfyhalomacro.pl>
This commit is contained in:
commit
cf5a881d66
85
init.lua
Normal file
85
init.lua
Normal file
|
@ -0,0 +1,85 @@
|
|||
require("bootstrap")
|
||||
require("plugins")
|
||||
vim.cmd([[colorscheme gruvbox]])
|
||||
-- Settings Start Here --
|
||||
|
||||
-- Main
|
||||
vim.g.filetype = "plugin on"
|
||||
vim.o.foldenable = true
|
||||
vim.o.foldmethod = "indent"
|
||||
vim.o.foldlevel = 2
|
||||
vim.o.splitright = true
|
||||
vim.o.compatible = false
|
||||
vim.o.autochdir = true
|
||||
vim.bo.autoindent = true
|
||||
vim.bo.expandtab = true
|
||||
vim.bo.smartindent = true
|
||||
vim.o.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"
|
||||
vim.cmd("let &t_ut=''")
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.o.ts = 8
|
||||
vim.o.sw = 4
|
||||
vim.o.wrap = "smoothscroll"
|
||||
vim.o.softtabstop = 0
|
||||
vim.o.smarttab = true
|
||||
vim.o.cmdheight = 2
|
||||
vim.o.completeopt = "menuone,noinsert,noselect"
|
||||
vim.o.hidden = true
|
||||
vim.o.mouse = "a"
|
||||
vim.o.showtabline = 1
|
||||
vim.o.splitbelow = true
|
||||
vim.opt.termguicolors = true
|
||||
vim.o.updatetime = 100
|
||||
vim.wo.cursorline = true
|
||||
vim.o.cursorcolumn = true
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.timeoutlen = 1000
|
||||
vim.o.timeout = true
|
||||
vim.g.neovide_cursor_vfx_mode = "torpedo"
|
||||
|
||||
-- Diagnostics
|
||||
vim.g.diagnostic_enable_popup_while_jump = 1
|
||||
vim.g.diagnostic_enable_virtual_text = 0
|
||||
|
||||
-- SLIME
|
||||
|
||||
-- Why use more than two multiplexing utilities lmao
|
||||
if os.getenv("ZELLIJ_SESSION_NAME") ~= nil then
|
||||
vim.g.slime_target = "zellij"
|
||||
elseif os.getenv("TERM") == "xterm-kitty" or os.getenv("TERM_PROGRAM") ~= "tmux" then
|
||||
vim.g.slime_target = "kitty"
|
||||
elseif os.getenv("TERM_PROGRAM") == "tmux" or os.getenv("TERM") ~= "xterm-kitty" then
|
||||
vim.g.slime_target = "tmux"
|
||||
else
|
||||
-- Assume only neovim terminal is the only way
|
||||
vim.g.slime_target = "neovim"
|
||||
end
|
||||
|
||||
-- Python
|
||||
if vim.fn.getenv("OS") == "Windows_NT" then
|
||||
-- set shell in windows
|
||||
vim.o.shell = "pwsh-preview.cmd" -- I use powershell-preview so you might want to edit this
|
||||
local python3_path = vim.fn.system({
|
||||
vim.o.shell,
|
||||
"-Command",
|
||||
'"(Get-Command',
|
||||
'python3).path"',
|
||||
})
|
||||
local python2_path = vim.fn.system({
|
||||
vim.o.shell,
|
||||
"-Command",
|
||||
'"(Get-Command',
|
||||
'python2).path"',
|
||||
})
|
||||
vim.g.python3_host_prog = python3_path
|
||||
vim.g.python_host_prog = python2_path
|
||||
vim.opt.clipboard = vim.opt.clipboard + "unnamedplus"
|
||||
vim.opt.autowrite = true
|
||||
else
|
||||
vim.o.shell = vim.fn.getenv("SHELL")
|
||||
vim.g.python3_host_prog = vim.fn.exepath("python3")
|
||||
vim.g.python_host_prog = vim.fn.exepath("python") -- python2 is dead dream on bro
|
||||
vim.g.ruby_host_prog = vim.fn.exepath("ruby")
|
||||
end
|
||||
|
25
lua/bootstrap.lua
Normal file
25
lua/bootstrap.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(install_path) then
|
||||
local bootstrap = vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
install_path,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(install_path)
|
||||
|
||||
-- initializing lazy
|
||||
vim.g.mapleader = " "
|
||||
|
||||
local plugins = require("plugins")
|
||||
local lazy_status, lazy = pcall(require, "lazy")
|
||||
if not lazy_status then
|
||||
return
|
||||
end
|
||||
|
||||
lazy.setup(plugins, opts)
|
309
lua/lsp.lua
Normal file
309
lua/lsp.lua
Normal file
|
@ -0,0 +1,309 @@
|
|||
local nvim_lsp = require("lspconfig")
|
||||
local config_path = vim.fn.stdpath("config")
|
||||
|
||||
-- For weird LSP with weird configuration such as Julia
|
||||
local script_path = config_path .. "/scripts"
|
||||
function get_current_line()
|
||||
return vim.api.nvim_win_get_cursor(0)[1]
|
||||
end
|
||||
|
||||
function searchForwardArgs()
|
||||
return get_current_line() .. ":1:" .. vim.fn.expand("%:p")
|
||||
end
|
||||
|
||||
function LatexBuildCurrentFileOrBuffer()
|
||||
vim.cmd("cd " .. vim.fn.expand("%:p:h"))
|
||||
vim.fn.system({
|
||||
"setsid",
|
||||
"tectonic",
|
||||
"-X",
|
||||
"compile",
|
||||
"--outdir=" .. vim.fn.expand("%:p:h"),
|
||||
"--synctex",
|
||||
"--keep-logs",
|
||||
"--keep-intermediates",
|
||||
vim.fn.expand("%:p"),
|
||||
})
|
||||
if vim.v.shell_error ~= 0 then
|
||||
print("Build Error")
|
||||
else
|
||||
print("Build Success")
|
||||
end
|
||||
end
|
||||
|
||||
function LatexForwardSearch()
|
||||
vim.fn.system({
|
||||
"setsid",
|
||||
"zathura",
|
||||
"--synctex-forward",
|
||||
searchForwardArgs(),
|
||||
vim.fn.expand("%:p:r") .. ".pdf",
|
||||
})
|
||||
if vim.v.shell_error ~= 0 then
|
||||
print("Build Error")
|
||||
else
|
||||
print("Build Success")
|
||||
end
|
||||
end
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
-- Mappings.
|
||||
---- Set autocommands conditional on server_capabilities
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
augroup lsp_auto
|
||||
autocmd! * <buffer>
|
||||
autocmd CursorHold <buffer> :lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved <buffer> :lua vim.lsp.buf.clear_references()
|
||||
augroup END
|
||||
]],
|
||||
true
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- enable snippets
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- Use a loop to conveniently both setup defined servers
|
||||
-- and map buffer local keybindings when the language server attaches
|
||||
local servers = {
|
||||
pyright = {},
|
||||
rust_analyzer = {
|
||||
cmd = {
|
||||
"rust-analyzer",
|
||||
},
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
check = {
|
||||
OnSave = true,
|
||||
command = "clippy",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
bashls = {},
|
||||
clangd = {},
|
||||
jsonls = {},
|
||||
gopls = {},
|
||||
ocamllsp = {},
|
||||
crystalline = {},
|
||||
zk = {
|
||||
cmd = { "zk" },
|
||||
},
|
||||
hls = {},
|
||||
zls = {
|
||||
cmd = { "/home/uncomfy/Projects/zls-0.9.0/zig-out/bin/zls" },
|
||||
filetypes = { "zig", "zir" },
|
||||
},
|
||||
julials = {
|
||||
cmd = {
|
||||
"julia",
|
||||
"--project=@nvim-lspconfig",
|
||||
-- Use Julia's homedir() instead of using vim.fn.getenv("HOME") or os.getenv("HOME")
|
||||
-- The rationale is that if someone uses distrobox. I do use distrobox
|
||||
-- So using the latter two will give me the false path to the DEPOT_PATHs
|
||||
"--sysimage="
|
||||
.. vim.fn.system({ "julia", "--startup-file=no", "-q", "-e", "print(homedir())" })
|
||||
.. "/.julia/environments/nvim-lspconfig/languageserver.so",
|
||||
"--sysimage-native-code=yes",
|
||||
"--startup-file=no",
|
||||
"--history-file=no",
|
||||
script_path .. "/julials.jl",
|
||||
vim.fn.expand("%:p:h"),
|
||||
},
|
||||
settings = {
|
||||
julia = {
|
||||
symbolCacheDownload = true,
|
||||
lint = {
|
||||
missingrefs = "all",
|
||||
iter = true,
|
||||
lazy = true,
|
||||
modname = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
solidity_ls_nomicfoundation = {},
|
||||
biome = {},
|
||||
tsserver = {},
|
||||
gleam = {},
|
||||
lua_ls = {
|
||||
cmd = {
|
||||
"lua-language-server",
|
||||
},
|
||||
settings = {
|
||||
Lua = {
|
||||
format = {
|
||||
enable = true,
|
||||
defaultConfig = {
|
||||
indent_style = "space",
|
||||
indent_size = "4",
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
texlab = {
|
||||
cmd = { "texlab" },
|
||||
filetypes = { "tex", "bib", "plaintex" },
|
||||
settings = {
|
||||
texlab = {
|
||||
auxDirectory = ".",
|
||||
bibtexFormatter = "texlab",
|
||||
build = {
|
||||
args = { "-verbose", "-pdflua", "-interaction=nonstopmode", "-synctex=1", vim.fn.expand("%:p") },
|
||||
executable = "latexmk",
|
||||
forwardSearchAfter = false,
|
||||
onSave = true,
|
||||
},
|
||||
forwardSearch = {
|
||||
executable = "zathura",
|
||||
args = {
|
||||
"--synctex-forward",
|
||||
searchForwardArgs(),
|
||||
vim.fn.expand("%:p:r") .. ".pdf",
|
||||
},
|
||||
},
|
||||
lint = {
|
||||
onChange = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
TexlabBuild = {
|
||||
function()
|
||||
LatexBuildCurrentFileOrBuffer()
|
||||
end,
|
||||
description = "Build the current buffer",
|
||||
},
|
||||
TexlabForward = {
|
||||
function()
|
||||
LatexForwardSearch()
|
||||
end,
|
||||
description = "Forward search from current position",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- linters + formatters
|
||||
efm = {
|
||||
cmd = { "efm-langserver" },
|
||||
init_options = { documentFormatting = true },
|
||||
filetypes = {
|
||||
"lua",
|
||||
"python",
|
||||
"markdown",
|
||||
"sh",
|
||||
"json",
|
||||
},
|
||||
settings = {
|
||||
rootMarkers = { ".git/" },
|
||||
languages = {
|
||||
lua = {
|
||||
{
|
||||
formatCommand = "stylua --color Never",
|
||||
formatStdin = true,
|
||||
rootMarkers = { "stylua.toml", ".stylua.toml" },
|
||||
},
|
||||
},
|
||||
markdown = {
|
||||
{
|
||||
lintCommand = "markdownlint -s",
|
||||
lintStdin = true,
|
||||
lintFormats = { "%f: %l: %m" },
|
||||
},
|
||||
},
|
||||
python = {
|
||||
lintCommand = "ruff",
|
||||
lintStdin = true,
|
||||
lintFormats = { "%f:%l:%c %m" },
|
||||
formatCommand = "ruff --stdin-filename %",
|
||||
formatStdin = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for lsp, setup in pairs(servers) do
|
||||
local lsp_status = require("lsp-status")
|
||||
lsp_status.register_progress()
|
||||
lsp_status.messages()
|
||||
setup.capabilities = vim.tbl_extend("keep", setup.capabilities or {}, lsp_status.capabilities)
|
||||
setup.on_attach = lsp_status.on_attach
|
||||
setup.on_attach = on_attach
|
||||
lsp_status.register_client(setup.on_attach)
|
||||
setup.capabilities = lsp_status.capabilities
|
||||
setup.capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||
if lsp == "julials" then
|
||||
capabilities.textDocument.completion.completionItem.preselectSupport = true
|
||||
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
|
||||
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
|
||||
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
|
||||
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
|
||||
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
|
||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = { "documentation", "detail", "additionalTextEdits" },
|
||||
}
|
||||
capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown" }
|
||||
capabilities.textDocument.codeAction = {
|
||||
dynamicRegistration = true,
|
||||
codeActionLiteralSupport = {
|
||||
codeActionKind = {
|
||||
valueSet = (function()
|
||||
local res = vim.tbl_values(vim.lsp.protocol.CodeActionKind)
|
||||
table.sort(res)
|
||||
return res
|
||||
end)(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = false,
|
||||
underline = false,
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
})
|
||||
end
|
||||
nvim_lsp[lsp].setup(setup)
|
||||
end
|
||||
|
||||
-- TODO move elsewhere?
|
||||
vim.cmd("highlight! link LspDiagnosticsDefaultError WarningMsg")
|
||||
vim.fn.sign_define("LspDiagnosticsSignError", {
|
||||
texthl = "LspDiagnosticsSignError",
|
||||
text = "",
|
||||
numhl = "LspDiagnosticsSignError",
|
||||
})
|
||||
vim.fn.sign_define("LspDiagnosticsSignWarning", {
|
||||
texthl = "LspDiagnosticsSignWarning",
|
||||
text = "",
|
||||
numhl = "LspDiagnosticsSignWarning",
|
||||
})
|
||||
vim.fn.sign_define("LspDiagnosticsSignInformation", {
|
||||
texthl = "LspDiagnosticsSignInformation",
|
||||
text = "",
|
||||
numhl = "LspDiagnosticsSignInformation",
|
||||
})
|
||||
vim.fn.sign_define("LspDiagnosticsSignHint", {
|
||||
texthl = "LspDiagnosticsSignHint",
|
||||
text = "",
|
||||
numhl = "LspDiagnosticsSignHint",
|
||||
})
|
458
lua/plugins.lua
Normal file
458
lua/plugins.lua
Normal file
|
@ -0,0 +1,458 @@
|
|||
local config_path = vim.fn.stdpath("config")
|
||||
|
||||
-- For weird LSP with weird configuration such as Julia
|
||||
local script_path = config_path .. "/scripts"
|
||||
|
||||
return {
|
||||
{ "ellisonleao/gruvbox.nvim", priority = 1000, config = true },
|
||||
|
||||
{
|
||||
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"kyazdani42/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
|
||||
-- If you want icons for diagnostic errors, you'll need to define them somewhere:
|
||||
vim.fn.sign_define("DiagnosticSignError", { text = " ", texthl = "DiagnosticSignError" })
|
||||
vim.fn.sign_define("DiagnosticSignWarn", { text = " ", texthl = "DiagnosticSignWarn" })
|
||||
vim.fn.sign_define("DiagnosticSignInfo", { text = " ", texthl = "DiagnosticSignInfo" })
|
||||
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||
-- NOTE: this is changed from v1.x, which used the old style of highlight groups
|
||||
-- in the form "LspDiagnosticsSignWarning"
|
||||
|
||||
require("neo-tree").setup({
|
||||
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
|
||||
popup_border_style = "rounded",
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
sort_case_insensitive = false, -- used when sorting files and directories in the tree
|
||||
sort_function = nil, -- use a custom function for sorting files and directories in the tree
|
||||
-- sort_function = function (a,b)
|
||||
-- if a.type == b.type then
|
||||
-- return a.path > b.path
|
||||
-- else
|
||||
-- return a.type > b.type
|
||||
-- end
|
||||
-- end , -- this sorts files and directories descendantly
|
||||
default_component_configs = {
|
||||
container = {
|
||||
enable_character_fade = true,
|
||||
},
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 1, -- extra padding on left hand side
|
||||
-- indent guides
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
-- expander config, needed for nesting files
|
||||
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
folder_empty = "ﰊ",
|
||||
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||
-- then these will never be used.
|
||||
default = "*",
|
||||
highlight = "NeoTreeFileIcon",
|
||||
},
|
||||
modified = {
|
||||
symbol = "[+]",
|
||||
highlight = "NeoTreeModified",
|
||||
},
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
highlight = "NeoTreeFileName",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
-- Change type
|
||||
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
|
||||
deleted = "✖", -- this can only be used in the git_status source
|
||||
renamed = "", -- this can only be used in the git_status source
|
||||
-- Status type
|
||||
untracked = "",
|
||||
ignored = "",
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
window = {
|
||||
position = "left",
|
||||
width = 40,
|
||||
mapping_options = {
|
||||
noremap = true,
|
||||
nowait = true,
|
||||
},
|
||||
mappings = {
|
||||
["N"] = {
|
||||
"toggle_node",
|
||||
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
|
||||
},
|
||||
["<2-LeftMouse>"] = "open",
|
||||
["<cr>"] = "open",
|
||||
["<esc>"] = "revert_preview",
|
||||
["P"] = { "toggle_preview", config = { use_float = true } },
|
||||
["l"] = "focus_preview",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
-- ["S"] = "split_with_window_picker",
|
||||
-- ["s"] = "vsplit_with_window_picker",
|
||||
["t"] = "open_tabnew",
|
||||
-- ["<cr>"] = "open_drop",
|
||||
-- ["t"] = "open_tab_drop",
|
||||
["w"] = "open_with_window_picker",
|
||||
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
|
||||
["C"] = "close_node",
|
||||
["z"] = "close_all_nodes",
|
||||
--["Z"] = "expand_all_nodes",
|
||||
["a"] = {
|
||||
"add",
|
||||
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
|
||||
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
|
||||
config = {
|
||||
show_path = "none", -- "none", "relative", "absolute"
|
||||
},
|
||||
},
|
||||
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
|
||||
["d"] = "delete",
|
||||
["r"] = "rename",
|
||||
["y"] = "copy_to_clipboard",
|
||||
["x"] = "cut_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
|
||||
-- ["c"] = {
|
||||
-- "copy",
|
||||
-- config = {
|
||||
-- show_path = "none" -- "none", "relative", "absolute"
|
||||
-- }
|
||||
--}
|
||||
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
|
||||
["q"] = "close_window",
|
||||
["R"] = "refresh",
|
||||
["?"] = "show_help",
|
||||
["<"] = "prev_source",
|
||||
[">"] = "next_source",
|
||||
},
|
||||
},
|
||||
nesting_rules = {},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false, -- when true, they will just be displayed differently than normal items
|
||||
hide_dotfiles = true,
|
||||
hide_gitignored = true,
|
||||
hide_hidden = true, -- only works on Windows for hidden files/directories
|
||||
hide_by_name = {
|
||||
--"node_modules"
|
||||
},
|
||||
hide_by_pattern = { -- uses glob style patterns
|
||||
--"*.meta",
|
||||
--"*/src/*/tsconfig.json",
|
||||
},
|
||||
always_show = { -- remains visible even if other settings would normally hide it
|
||||
--".gitignored",
|
||||
},
|
||||
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||
--".DS_Store",
|
||||
--"thumbs.db"
|
||||
},
|
||||
never_show_by_pattern = { -- uses glob style patterns
|
||||
--".null-ls_*",
|
||||
},
|
||||
},
|
||||
follow_current_file = false, -- This will find and focus the file in the active buffer every
|
||||
-- time the current file is changed while the tree is open.
|
||||
group_empty_dirs = false, -- when true, empty folders will be grouped together
|
||||
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
|
||||
-- in whatever position is specified in window.position
|
||||
-- "open_current", -- netrw disabled, opening a directory opens within the
|
||||
-- window like netrw would, regardless of window.position
|
||||
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
|
||||
-- instead of relying on nvim autocmd events.
|
||||
window = {
|
||||
mappings = {
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["H"] = "toggle_hidden",
|
||||
["/"] = "fuzzy_finder",
|
||||
["D"] = "fuzzy_finder_directory",
|
||||
["f"] = "filter_on_submit",
|
||||
["<c-x>"] = "clear_filter",
|
||||
["[g"] = "prev_git_modified",
|
||||
["]g"] = "next_git_modified",
|
||||
},
|
||||
},
|
||||
},
|
||||
buffers = {
|
||||
follow_current_file = true, -- This will find and focus the file in the active buffer every
|
||||
-- time the current file is changed while the tree is open.
|
||||
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
||||
show_unloaded = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["bd"] = "buffer_delete",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
},
|
||||
},
|
||||
},
|
||||
git_status = {
|
||||
window = {
|
||||
position = "float",
|
||||
mappings = {
|
||||
["A"] = "git_add_all",
|
||||
["gu"] = "git_unstage_file",
|
||||
["ga"] = "git_add_file",
|
||||
["gr"] = "git_revert_file",
|
||||
["gc"] = "git_commit",
|
||||
["gp"] = "git_push",
|
||||
["gg"] = "git_commit_and_push",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
lazy = true,
|
||||
config = function()
|
||||
local lsp_status = require("lsp-status")
|
||||
lsp_status.register_progress()
|
||||
local function filesize_custom()
|
||||
local file = vim.fn.expand("%:p")
|
||||
if file == nil or #file == 0 then
|
||||
return ""
|
||||
end
|
||||
local size = vim.fn.getfsize(file)
|
||||
if size <= 0 then
|
||||
return "0KiB"
|
||||
end
|
||||
return string.format("%.2f", size / 1024) .. "KiB"
|
||||
end
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = { left = "|", right = "|" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch" },
|
||||
lualine_c = {
|
||||
"buffers",
|
||||
"filename",
|
||||
"filesize_custom()",
|
||||
"diff",
|
||||
},
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
"diagnostics",
|
||||
},
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "searchcount", "selectioncount", "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = { "windows" },
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = { "nvim-tree" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
branch = "master",
|
||||
build = "julia --project=@nvim-lspconfig --startup-file=no --history-file=no " .. script_path .. "/julia-install-lsp.jl",
|
||||
dependencies = {
|
||||
{ "nvim-lua/lsp-status.nvim", dependencies = { "nvim-lspconfig", "lualine.nvim" } },
|
||||
{ "onsails/lspkind.nvim" },
|
||||
{ "kosayoda/nvim-lightbulb" },
|
||||
},
|
||||
config = function()
|
||||
require("lsp")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "hrsh7th/cmp-nvim-lsp", branch = "main" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-vsnip" },
|
||||
{ "hrsh7th/vim-vsnip", dependencies = "hrsh7th/vim-vsnip-integ" },
|
||||
{ "uncomfyhalomacro/cmp-latex-symbols", build = "cargo run --release" },
|
||||
{ "hrsh7th/cmp-calc" },
|
||||
-- { "lukas-reineke/cmp-rg" },
|
||||
{ "windwp/nvim-autopairs", enabled = true },
|
||||
-- { "lukas-reineke/cmp-under-comparator" },
|
||||
{ "hrsh7th/cmp-emoji" },
|
||||
{ "hrsh7th/cmp-cmdline" },
|
||||
-- disabled for now
|
||||
{
|
||||
"uga-rosa/cmp-dictionary",
|
||||
enable = false,
|
||||
config = function() end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
local status_ok, npairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
local lspkind_ok, lsp_kind = pcall(require, "lspkind")
|
||||
if not lspkind_ok then
|
||||
return
|
||||
end
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
julia = { "string", "argument_list" },
|
||||
},
|
||||
})
|
||||
local cmp_autopairs_status_ok, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
if not cmp_autopairs_status_ok then
|
||||
return
|
||||
end
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
-- For `vsnip` user.
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
|
||||
-- For `luasnip` user.
|
||||
-- require("luasnip").lsp_expand(args.body)
|
||||
|
||||
-- For `ultisnips` user.
|
||||
--vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
},
|
||||
sorting = {
|
||||
priority_weight = 1,
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
-- require("cmp-under-comparator").under,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp", group_index = 1, priority = 2 },
|
||||
|
||||
-- For vsnip user.
|
||||
{ name = "vsnip", group_index = 1, priority = 1 },
|
||||
|
||||
-- For luasnip user.
|
||||
--{ name = "cmp_luasnip", group_index = 1 },
|
||||
|
||||
-- For ultisnips user.
|
||||
--{ name = "ultisnips", group_index = 1 },
|
||||
|
||||
{ name = "buffer", group_index = 2 },
|
||||
|
||||
-- emojis
|
||||
{ name = "emoji", group_index = 2 },
|
||||
{ name = "rg", group_index = 2, priority = 3 },
|
||||
{ name = "calc" },
|
||||
{ name = "latex_symbols", group_index = 2, priority = 98 },
|
||||
{ name = "path" },
|
||||
},
|
||||
formatting = {
|
||||
format = lsp_kind.cmp_format({
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
-- dictionary = "[Dictionary]",
|
||||
calc = "[Calc]",
|
||||
vsnip = "[Vsnip]",
|
||||
latex_symbols = "[LaTeX]",
|
||||
emoji = "[Emoji]",
|
||||
rg = "[RipGrep]",
|
||||
path = "[Path]",
|
||||
cmdline = "[Cmdline]",
|
||||
},
|
||||
}),
|
||||
},
|
||||
})
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp_document_symbol" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}, { {
|
||||
name = "path",
|
||||
} }),
|
||||
})
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "cmdline", max_item_count = 5 },
|
||||
{ name = "buffer", max_item_count = 5 },
|
||||
{ name = "path", max_item_count = 5 },
|
||||
}),
|
||||
})
|
||||
|
||||
vim.api.nvim_command(
|
||||
[[autocmd FileType sql,mysql,plsql lua require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} })]]
|
||||
)
|
||||
end,
|
||||
},
|
||||
}
|
5
scripts/julia-install-lsp.jl
Normal file
5
scripts/julia-install-lsp.jl
Normal file
|
@ -0,0 +1,5 @@
|
|||
import Pkg; Pkg.add("PackageCompiler");
|
||||
Pkg.add(url="https://github.com/julia-vscode/LanguageServer.jl", rev="master");
|
||||
Pkg.update();
|
||||
using PackageCompiler; create_sysimage(:LanguageServer, sysimage_path=dirname(Pkg.Types.Context().env.project_file) * "/languageserver.so")
|
||||
|
46
scripts/julials.jl
Normal file
46
scripts/julials.jl
Normal file
|
@ -0,0 +1,46 @@
|
|||
import Pkg;
|
||||
|
||||
function recurse_project_paths(path::AbstractString)
|
||||
isnothing(Base.current_project(path)) && return
|
||||
tmp = path
|
||||
CUSTOM_LOAD_PATH = []
|
||||
while !isnothing(Base.current_project(tmp))
|
||||
pushfirst!(CUSTOM_LOAD_PATH, tmp)
|
||||
tmp = dirname(tmp)
|
||||
end
|
||||
# push all to LOAD_PATHs
|
||||
pushfirst!(Base.LOAD_PATH, CUSTOM_LOAD_PATH...)
|
||||
return joinpath(CUSTOM_LOAD_PATH[1], "Project.toml")
|
||||
end
|
||||
|
||||
buffer_file_path = ARGS[1]
|
||||
project_path = let
|
||||
dirname(something(
|
||||
# 1. Check if there is an explicitly set project
|
||||
# 2. Check for Project.toml in current working directory
|
||||
# 3. Check for Project.toml from buffer's full file path exluding the file name
|
||||
# 4. Fallback to global environment
|
||||
Base.load_path_expand((
|
||||
p = get(ENV, "JULIA_PROJECT", nothing);
|
||||
p === nothing ? nothing : isempty(p) ? nothing : p
|
||||
)),
|
||||
Base.current_project(strip(buffer_file_path)),
|
||||
Base.current_project(pwd()),
|
||||
Pkg.Types.Context().env.project_file,
|
||||
Base.active_project()
|
||||
))
|
||||
end
|
||||
|
||||
|
||||
ls_install_path = joinpath(get(DEPOT_PATH, 1, joinpath(homedir(), ".julia")), "environments", "nvim-lspconfig");
|
||||
pushfirst!(LOAD_PATH, ls_install_path);
|
||||
using LanguageServer;
|
||||
popfirst!(LOAD_PATH);
|
||||
@info "LOAD_PATHS: $(Base.load_path())"
|
||||
depot_path = get(ENV, "JULIA_DEPOT_PATH", "");
|
||||
symbol_server_path = joinpath(homedir(), ".cache", "nvim", "julia_lsp_symbol_store")
|
||||
mkpath(symbol_server_path)
|
||||
@info "LanguageServer has started with buffer $project_path or $(pwd())"
|
||||
server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path, nothing, symbol_server_path, true);
|
||||
server.runlinter = true;
|
||||
run(server);
|
Loading…
Reference in a new issue