afterft
This commit is contained in:
parent
f105dd521b
commit
c01eb77972
6 changed files with 24 additions and 216 deletions
|
@ -4,10 +4,6 @@
|
|||
-- Forum: https://www.reddit.com/r/lunarvim/
|
||||
-- Discord: https://discord.com/invite/Xb9B4Ny
|
||||
|
||||
-- require("config.go")
|
||||
-- require("config.py")
|
||||
-- require("config.c")
|
||||
|
||||
lvim.plugins = {
|
||||
"askfiy/visual_studio_code",
|
||||
"sainnhe/gruvbox-material",
|
||||
|
@ -18,4 +14,6 @@ lvim.plugins = {
|
|||
lvim.colorscheme = "everforest"
|
||||
vim.g.everforest_background = "hard"
|
||||
|
||||
lvim.builtin.lualine.style = "default"
|
||||
require("config.go")
|
||||
require("config.c")
|
||||
-- require("config.py")
|
||||
|
|
|
@ -1,115 +1,8 @@
|
|||
lvim.format_on_save = false
|
||||
lvim.lsp.diagnostics.virtual_text = true
|
||||
|
||||
lvim.builtin.treesitter.highlight.enable = true
|
||||
|
||||
-- auto install treesitter parsers
|
||||
lvim.builtin.treesitter.ensure_installed = { "cpp", "c" }
|
||||
|
||||
-- Additional Plugins
|
||||
table.insert(lvim.plugins, {
|
||||
"p00f/clangd_extensions.nvim",
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { "c", "cpp" },
|
||||
callback = function()
|
||||
vim.opt.colorcolumn = "81"
|
||||
vim.opt.shiftwidth = 8
|
||||
vim.opt.expandtab = false
|
||||
end
|
||||
})
|
||||
|
||||
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "clangd" })
|
||||
|
||||
-- some settings can only passed as commandline flags, see `clangd --help`
|
||||
local clangd_flags = {
|
||||
"--background-index",
|
||||
"--fallback-style=Google",
|
||||
"--all-scopes-completion",
|
||||
"--clang-tidy",
|
||||
"--log=error",
|
||||
"--suggest-missing-includes",
|
||||
"--cross-file-rename",
|
||||
"--completion-style=detailed",
|
||||
"--pch-storage=memory", -- could also be disk
|
||||
"--folding-ranges",
|
||||
"--enable-config", -- clangd 11+ supports reading from .clangd configuration file
|
||||
"--offset-encoding=utf-16", --temporary fix for null-ls
|
||||
-- "--limit-references=1000",
|
||||
-- "--limit-resutls=1000",
|
||||
-- "--malloc-trim",
|
||||
-- "--clang-tidy-checks=-*,llvm-*,clang-analyzer-*,modernize-*,-modernize-use-trailing-return-type",
|
||||
-- "--header-insertion=never",
|
||||
-- "--query-driver=<list-of-white-listed-complers>"
|
||||
}
|
||||
|
||||
local provider = "clangd"
|
||||
|
||||
local custom_on_attach = function(client, bufnr)
|
||||
require("lvim.lsp").common_on_attach(client, bufnr)
|
||||
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set("n", "<leader>lh", "<cmd>ClangdSwitchSourceHeader<cr>", opts)
|
||||
vim.keymap.set("x", "<leader>lA", "<cmd>ClangdAST<cr>", opts)
|
||||
vim.keymap.set("n", "<leader>lH", "<cmd>ClangdTypeHierarchy<cr>", opts)
|
||||
vim.keymap.set("n", "<leader>lt", "<cmd>ClangdSymbolInfo<cr>", opts)
|
||||
vim.keymap.set("n", "<leader>lm", "<cmd>ClangdMemoryUsage<cr>", opts)
|
||||
|
||||
require("clangd_extensions.inlay_hints").setup_autocmd()
|
||||
require("clangd_extensions.inlay_hints").set_inlay_hints()
|
||||
end
|
||||
|
||||
local status_ok, project_config = pcall(require, "rhel.clangd_wrl")
|
||||
if status_ok then
|
||||
clangd_flags = vim.tbl_deep_extend("keep", project_config, clangd_flags)
|
||||
end
|
||||
|
||||
local custom_on_init = function(client, bufnr)
|
||||
require("lvim.lsp").common_on_init(client, bufnr)
|
||||
require("clangd_extensions.config").setup {}
|
||||
require("clangd_extensions.ast").init()
|
||||
vim.cmd [[
|
||||
command ClangdToggleInlayHints lua require('clangd_extensions.inlay_hints').toggle_inlay_hints()
|
||||
command -range ClangdAST lua require('clangd_extensions.ast').display_ast(<line1>, <line2>)
|
||||
command ClangdTypeHierarchy lua require('clangd_extensions.type_hierarchy').show_hierarchy()
|
||||
command ClangdSymbolInfo lua require('clangd_extensions.symbol_info').show_symbol_info()
|
||||
command -nargs=? -complete=customlist,s:memuse_compl ClangdMemoryUsage lua require('clangd_extensions.memory_usage').show_memory_usage('<args>' == 'expand_preamble')
|
||||
]]
|
||||
end
|
||||
|
||||
local opts = {
|
||||
cmd = { provider, unpack(clangd_flags) },
|
||||
on_attach = custom_on_attach,
|
||||
on_init = custom_on_init,
|
||||
}
|
||||
|
||||
require("lvim.lsp.manager").setup("clangd", opts)
|
||||
|
||||
-- install codelldb with :MasonInstall codelldb
|
||||
-- configure nvim-dap (codelldb)
|
||||
lvim.builtin.dap.on_config_done = function(dap)
|
||||
dap.adapters.codelldb = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
-- provide the absolute path for `codelldb` command if not using the one installed using `mason.nvim`
|
||||
command = "codelldb",
|
||||
args = { "--port", "${port}" },
|
||||
|
||||
-- On windows you may have to uncomment this:
|
||||
-- detached = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "Launch file",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
local path
|
||||
vim.ui.input({ prompt = "Path to executable: ", default = vim.loop.cwd() .. "/build/" }, function(input)
|
||||
path = input
|
||||
end)
|
||||
vim.cmd [[redraw]]
|
||||
return path
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
end
|
||||
|
|
|
@ -1,97 +1,8 @@
|
|||
------------------------
|
||||
-- Treesitter
|
||||
------------------------
|
||||
lvim.builtin.treesitter.ensure_installed = {
|
||||
"go",
|
||||
"gomod",
|
||||
}
|
||||
|
||||
------------------------
|
||||
-- Plugins
|
||||
------------------------
|
||||
lvim.plugins = {
|
||||
"olexsmir/gopher.nvim",
|
||||
"leoluz/nvim-dap-go",
|
||||
}
|
||||
|
||||
------------------------
|
||||
-- Formatting
|
||||
------------------------
|
||||
local formatters = require "lvim.lsp.null-ls.formatters"
|
||||
formatters.setup {
|
||||
{ command = "goimports", filetypes = { "go" } },
|
||||
{ command = "gofumpt", filetypes = { "go" } },
|
||||
}
|
||||
|
||||
lvim.format_on_save = {
|
||||
pattern = { "*.go" },
|
||||
}
|
||||
|
||||
------------------------
|
||||
-- Dap
|
||||
------------------------
|
||||
local dap_ok, dapgo = pcall(require, "dap-go")
|
||||
if not dap_ok then
|
||||
return
|
||||
end
|
||||
|
||||
dapgo.setup()
|
||||
|
||||
------------------------
|
||||
-- LSP
|
||||
------------------------
|
||||
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "gopls" })
|
||||
|
||||
local lsp_manager = require "lvim.lsp.manager"
|
||||
|
||||
lsp_manager.setup("gopls", {
|
||||
on_attach = function(client, bufnr)
|
||||
require("lvim.lsp").common_on_attach(client, bufnr)
|
||||
local _, _ = pcall(vim.lsp.codelens.refresh)
|
||||
local map = function(mode, lhs, rhs, desc)
|
||||
if desc then
|
||||
desc = desc
|
||||
end
|
||||
|
||||
vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc, buffer = bufnr, noremap = true })
|
||||
end
|
||||
map("n", "<leader>Ci", "<cmd>GoInstallDeps<Cr>", "Install Go Dependencies")
|
||||
map("n", "<leader>Ct", "<cmd>GoMod tidy<cr>", "Tidy")
|
||||
map("n", "<leader>Ca", "<cmd>GoTestAdd<Cr>", "Add Test")
|
||||
map("n", "<leader>CA", "<cmd>GoTestsAll<Cr>", "Add All Tests")
|
||||
map("n", "<leader>Ce", "<cmd>GoTestsExp<Cr>", "Add Exported Tests")
|
||||
map("n", "<leader>Cg", "<cmd>GoGenerate<Cr>", "Go Generate")
|
||||
map("n", "<leader>Cf", "<cmd>GoGenerate %<Cr>", "Go Generate File")
|
||||
map("n", "<leader>Cc", "<cmd>GoCmt<Cr>", "Generate Comment")
|
||||
map("n", "<leader>DT", "<cmd>lua require('dap-go').debug_test()<cr>", "Debug Test")
|
||||
end,
|
||||
on_init = require("lvim.lsp").common_on_init,
|
||||
capabilities = require("lvim.lsp").common_capabilities(),
|
||||
settings = {
|
||||
gopls = {
|
||||
usePlaceholders = true,
|
||||
gofumpt = true,
|
||||
codelenses = {
|
||||
generate = false,
|
||||
gc_details = true,
|
||||
test = true,
|
||||
tidy = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { "go" },
|
||||
callback = function()
|
||||
vim.opt.colorcolumn = "81"
|
||||
vim.opt.shiftwidth = 8
|
||||
vim.opt.expandtab = false
|
||||
end
|
||||
})
|
||||
|
||||
local status_ok, gopher = pcall(require, "gopher")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
gopher.setup {
|
||||
commands = {
|
||||
go = "go",
|
||||
gomodifytags = "gomodifytags",
|
||||
gotests = "gotests",
|
||||
impl = "impl",
|
||||
iferr = "iferr",
|
||||
},
|
||||
}
|
||||
|
|
4
npm/npmrc
Normal file
4
npm/npmrc
Normal file
|
@ -0,0 +1,4 @@
|
|||
prefix=${XDG_DATA_HOME}/npm
|
||||
cache=${XDG_CACHE_HOME}/npm
|
||||
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
|
||||
logs-dir=${XDG_STATE_HOME}/npm/logs
|
|
@ -8,3 +8,4 @@ PATH="$HOME/.config/scripts${PATH:+:${PATH}}"
|
|||
PATH="$HOME/.local/bin${PATH:+:${PATH}}"
|
||||
PATH="$HOME/.local/state/nix/profile/bin${PATH:+:${PATH}}"
|
||||
PATH="$HOME/.config/emacs/bin${PATH:+:${PATH}}"
|
||||
PATH="$HOME/.local/share/go/bin${PATH:+:${PATH}}"
|
||||
|
|
|
@ -27,4 +27,5 @@ export \
|
|||
GOPATH="$XDG_DATA_HOME/go" \
|
||||
SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config" \
|
||||
GIT_SSH_COMMAND="ssh -F ${XDG_CONFIG_HOME}/ssh/config" \
|
||||
ZDOTDIR="$XDG_CONFIG_HOME/shell"
|
||||
ZDOTDIR="$XDG_CONFIG_HOME/shell" \
|
||||
NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
|
||||
|
|
Loading…
Reference in a new issue