Closed fithurriague closed 2 years ago
A bit strange. what is your $PATH setup and is the binaries installed in your path? Also your operation system? Last, what is the output of following command:
echo executable('dlv')
The operating system is Arch Linux kernel 5.16.3
This is the output of $PATH: /usr/local/bin /usr/bin /bin /usr/local/sbin /usr/lib/jvm/default/bin /usr/bin/site_perl /usr/bin/vendor_perl /usr/bin/core_perl
Output from echo executable('dlv')
: 0
Now that is installed is 1
I think the go binary should be installed in GOBIN dir, in my setup it is ~/go/bin
The above folder you mentioned require root privilege. I am not sure will it works out of the box in linux.
Delve and all binaries are actually installed in GOBIN dir, also the dir itself and all subdirs have execution privilege for all root user and group
When trying to run any command this is the output
Nevermind, i added the GOBIN env variable to the PATH and now it works well
please forgive my bad english
I have a similar problem,after exec GoInstallBinaries,the checkhealth always is
my os is wsl ubuntu 22.04, I have added GOBIN,and the PATH output is
it also has root privilege
and Output from echo executable('dlv') is 0
It will be automatically installed on every save
i had exec cmd GoFmt and the output is
and my lua config is
-- general
lvim.log.level = "warn"
lvim.format_on_save = true
lvim.colorscheme = "onedarker"
-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false
-- 剪切板
vim.opt.clipboard = "unnamedplus"
vim.api.nvim_set_keymap("v", "y", '"+y', { noremap = true })
-- leader 键
lvim.leader = "space"
-- 保存文件
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
vim.api.nvim_set_keymap("i", "<C-s>", "<ESC>:w<cr>", {})
vim.api.nvim_set_keymap("", "<A-s>", "<ESC>:w<cr>", {})
-- 按 esc 消除上一次的高亮
lvim.keys.normal_mode["<esc>"] = ":noh<cr>"
-- 注释
vim.api.nvim_set_keymap("", "<C-_>", "<Space>/", {})
-- vim.api.nvim_set_keymap("i", "<C-_>", "<Space>/", {})
-- 目录
vim.api.nvim_set_keymap("", "<A-1>", "<Space>e", {})
-- 终端
vim.api.nvim_set_keymap("", "<A-8>", "<ESC><Cmd>ToggleTerm<CR>", {})
-- 关闭 tab
vim.api.nvim_set_keymap("", "x", "<Space>c", {})
-- VIM 空格数设置
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
-- tab 移动
vim.api.nvim_set_keymap('n', '<TAB>', ':bnext<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<S-TAB>', ':bprevious<CR>', { noremap = true, silent = true })
-- hop.nvim 跳转搜索,类似于 acejump
vim.api.nvim_set_keymap('', '<A-m>', '<ESC><Cmd>HopPattern<CR>', {})
-- 分屏
vim.api.nvim_set_keymap('n', 'sv', ':vsp<CR>', {}) -- 水平分屏
vim.api.nvim_set_keymap('n', 'sh', ':sp<CR>', {}) -- 锤子分屏
vim.api.nvim_set_keymap('n', 'sc', '<C-w>c', {}) -- 关闭当前屏幕
vim.api.nvim_set_keymap('n', 'so', '<C-w>o', {}) -- 关闭其它屏幕
vim.api.nvim_set_keymap('n', 's,', ':vertical resize +20<CR>', {}) -- 向右移动屏幕
vim.api.nvim_set_keymap('n', 's.', ':vertical resize -20<CR>', {}) -- 向左移动屏幕
vim.api.nvim_set_keymap('n', 'sj', ':resize -20<CR>', {}) -- 向左移动屏幕
vim.api.nvim_set_keymap('n', 'sk', ':resize +20<CR>', {}) -- 向左移动屏幕
-- 运行代码
vim.api.nvim_set_keymap('', '<A-r>', ':SnipRun<CR>', {})
-- 查找文件
vim.api.nvim_set_keymap('', '<C-f>', '<Space>f', {})
-- 查找代码
vim.api.nvim_set_keymap('', '<S-f>', '<Space>st', {})
-- 类似 jb 家 ctrl+w 实现,选中单词
vim.api.nvim_set_keymap('', '<C-w>', 'bve', {})
-- 类似于 jb 家 ctrl+d 实现,复制一行
vim.api.nvim_set_keymap('', '<C-d>', 'yyp', {})
-- lsp 代码跳转
-- vim.api.nvim_set_keymap('', 'gd', '<Space>lpi', {})
-- vim.api.nvim_set_keymap('', 'gd', '<Space>lpt', {})
-- 去掉默认的 J
vim.api.nvim_set_keymap('', 'J', '', {})
-- alt-e 打开最近打开文件
vim.api.nvim_set_keymap('', '<A-e>', '<Space>sr', {})
-- 按 enter 开新行
-- vim.api.nvim_set_keymap('', '<s-cr>', 'i<cr><esc>', {})
-- 参数提示
vim.api.nvim_set_keymap('i', '<C-p>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', {})
vim.api.nvim_set_keymap("n", "gk", "<cmd>lua vim.lsp.buf.signature_help()<CR>", {})
-- 格式化
vim.api.nvim_set_keymap('', '<c-a-l>', '<space>lf', {})
-- enter 自动换新行
vim.keymap.set("n", '<CR>', '<Esc>o<Esc>', {})
-- enter 自动换新行
-- vim.keymap.set("n", '<s><CR>', '<Esc>O<Esc>', {})
-- vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
-- vim.lsp.handlers['signature_help'], {
-- border = 'single',
-- close_events = { "CursorMoved", "BufHidden", "InsertCharPre" },
-- }
-- )
-- unmap a default keymapping
-- vim.keymap.del("n", "<C-Up>")
-- override a default keymapping
-- lvim.keys.normal_mode["<C-q>"] = ":q<cr>" -- or vim.keymap.set("n", "<C-q>", ":q<cr>" )
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
-- local _, actions = pcall(require, "telescope.actions")
-- lvim.builtin.telescope.defaults.mappings = {
-- -- for input mode
-- i = {
-- ["<C-j>"] = actions.move_selection_next,
-- ["<C-k>"] = actions.move_selection_previous,
-- ["<C-n>"] = actions.cycle_history_next,
-- ["<C-p>"] = actions.cycle_history_prev,
-- },
-- -- for normal mode
-- n = {
-- ["<C-j>"] = actions.move_selection_next,
-- ["<C-k>"] = actions.move_selection_previous,
-- },
-- }
-- Use which-key to add extra bindings with the leader-key prefix
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
-- lvim.builtin.which_key.mappings["t"] = {
-- name = "+Trouble",
-- r = { "<cmd>Trouble lsp_references<cr>", "References" },
-- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
-- d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
-- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
-- l = { "<cmd>Trouble loclist<cr>", "LocationList" },
-- w = { "<cmd>Trouble workspace_diagnostics<cr>", "Wordspace Diagnostics" },
-- }
-- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.notify.active = true
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
"bash",
"c",
"javascript",
"json",
"lua",
"python",
"typescript",
"tsx",
"css",
"rust",
"java",
"yaml",
"go",
}
lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enabled = true
-- generic LSP settings
-- ---@usage disable automatic installation of servers
-- lvim.lsp.automatic_servers_installation = false
-- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
-- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
-- require("lvim.lsp.manager").setup("pyright", opts)
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
-- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype
-- vim.tbl_map(function(server)
-- return server ~= "emmet_ls"
-- end, lvim.lsp.automatic_configuration.skipped_servers)
-- -- you can set a custom on_attach function that will be used for all the language servers
-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
-- lvim.lsp.on_attach_callback = function(client, bufnr)
-- local function buf_set_option(...)
-- vim.api.nvim_buf_set_option(bufnr, ...)
-- end
-- --Enable completion triggered by <c-x><c-o>
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- end
-- -- set a formatter, this will override the language server formatting capabilities (if it exists)
-- local formatters = require "lvim.lsp.null-ls.formatters"
-- formatters.setup {
-- { command = "black", filetypes = { "python" } },
-- { command = "isort", filetypes = { "python" } },
-- {
-- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
-- command = "prettier",
-- ---@usage arguments to pass to the formatter
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
-- extra_args = { "--print-with", "100" },
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
-- filetypes = { "typescript", "typescriptreact" },
-- },
-- }
-- -- set additional linters
-- local linters = require "lvim.lsp.null-ls.linters"
-- linters.setup {
-- { command = "flake8", filetypes = { "python" } },
-- {
-- -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
-- command = "shellcheck",
-- ---@usage arguments to pass to the formatter
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
-- extra_args = { "--severity", "warning" },
-- },
-- {
-- command = "codespell",
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
-- filetypes = { "javascript", "python" },
-- },
-- }
-- 插件管理
-- Additional Plugins
lvim.plugins = {
{ "folke/tokyonight.nvim" },
{
"folke/trouble.nvim",
cmd = "TroubleToggle",
},
{
"ethanholz/nvim-lastplace",
event = "BufRead",
config = function()
require("nvim-lastplace").setup({
lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
lastplace_ignore_filetype = {
"gitcommit", "gitrebase", "svn", "hgcommit",
},
lastplace_open_folds = true,
})
end,
},
{
"karb94/neoscroll.nvim",
event = "WinScrolled",
config = function()
require('neoscroll').setup({
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = { '<C-u>', '<C-d>', '<C-b>', '<C-f>',
'<C-y>', '<C-e>', 'zt', 'zz', 'zb' },
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends
})
end
},
-- {
-- "iamcco/markdown-preview.nvim",
-- run = "cd app && npm install",
-- ft = "markdown",
-- config = function()
-- vim.g.mkdp_auto_start = 1
-- end,
-- },
-- { "iamcco/markdown-preview.nvim", run = "cd app && npm install",
-- setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, },
-- {
-- "iamcco/markdown-preview.nvim",
-- run = function() vim.fn["mkdp#util#install"]() end,
-- },
{
"lukas-reineke/indent-blankline.nvim",
event = "BufRead",
setup = function()
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = "▏"
vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard" }
vim.g.indent_blankline_buftype_exclude = { "terminal" }
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = false
end
},
-- { "zbirenbaum/copilot.lua",
-- event = { "VimEnter" },
-- config = function()
-- vim.defer_fn(function()
-- require("copilot").setup {
-- plugin_manager_path = get_runtime_dir() .. "/site/pack/packer",
-- }
-- end, 100)
-- end,
-- },
-- { "zbirenbaum/copilot-cmp",
-- after = { "copilot.lua", "nvim-cmp" },
-- },
-- {
-- 'github/copilot.vim',
-- },
{
"Pocco81/AutoSave.nvim",
config = function()
require("autosave").setup()
end,
},
{
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function() require "lsp_signature".on_attach() end,
},
{
"ahmedkhalf/lsp-rooter.nvim",
event = "BufRead",
config = function()
require("lsp-rooter").setup()
end,
},
{
"rmagatti/goto-preview",
config = function()
require('goto-preview').setup {
width = 120; -- Width of the floating window
height = 25; -- Height of the floating window
default_mappings = false; -- Bind default mappings
debug = false; -- Print debug information
opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent.
post_open_hook = nil -- A function taking two arguments, a buffer and a window to be ran as a hook.
-- You can use "default_mappings = true" setup option
-- Or explicitly set keybindings
-- vim.cmd("nnoremap gpd <cmd>lua require('goto-preview').goto_preview_definition()<CR>")
-- vim.cmd("nnoremap gpi <cmd>lua require('goto-preview').goto_preview_implementation()<CR>")
-- vim.cmd("nnoremap gP <cmd>lua require('goto-preview').close_all_win()<CR>")
}
end
},
{
"folke/lsp-colors.nvim",
event = "BufRead",
},
{
"nvim-telescope/telescope-project.nvim",
event = "BufWinEnter",
setup = function()
vim.cmd [[packadd telescope.nvim]]
end,
},
-- {
-- "nvim-telescope/telescope.nvim",
-- requires = {
-- { "nvim-telescope/telescope-live-grep-args.nvim" }
-- }
-- },
{
"romgrk/nvim-treesitter-context",
config = function()
require("treesitter-context").setup {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
throttle = true, -- Throttles plugin updates (may improve performance)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
-- For all filetypes
-- Note that setting an entry here replaces all other patterns for this entry.
-- By setting the 'default' entry below, you can control which nodes you want to
-- appear in the context window.
default = {
'class',
'function',
'method',
},
},
}
end
},
{
"sindrets/diffview.nvim",
event = "BufRead",
},
-- {
-- "f-person/git-blame.nvim",
-- event = "BufRead",
-- config = function()
-- vim.cmd "highlight default link gitblame SpecialComment"
-- vim.g.gitblame_enabled = 0
-- end,
-- },
{
"ruifm/gitlinker.nvim",
event = "BufRead",
config = function()
require("gitlinker").setup {
opts = {
-- remote = 'github', -- force the use of a specific remote
-- adds current line nr in the url for normal mode
add_current_line_on_normal_mode = true,
-- callback for what to do with the url
action_callback = require("gitlinker.actions").open_in_browser,
-- print the url after performing the action
print_url = false,
-- mapping to call url generation
mappings = "<leader>gy",
},
}
end,
requires = "nvim-lua/plenary.nvim",
},
{
"pwntester/octo.nvim",
event = "BufRead",
},
{
"tpope/vim-fugitive",
cmd = {
"G",
"Git",
"Gdiffsplit",
"Gread",
"Gwrite",
"Ggrep",
"GMove",
"GDelete",
"GBrowse",
"GRemove",
"GRename",
"Glgrep",
"Gedit"
},
ft = { "fugitive" }
},
{
"andymass/vim-matchup",
event = "CursorMoved",
config = function()
vim.g.matchup_matchparen_offscreen = { method = "popup" }
end,
},
-- {
-- "camspiers/snap",
-- rocks = "fzy",
-- config = function()
-- local snap = require "snap"
-- local layout = snap.get("layout").bottom
-- local file = snap.config.file:with { consumer = "fzy", layout = layout }
-- local vimgrep = snap.config.vimgrep:with { layout = layout }
-- snap.register.command("find_files", file { producer = "ripgrep.file" })
-- snap.register.command("buffers", file { producer = "vim.buffer" })
-- snap.register.command("oldfiles", file { producer = "vim.oldfile" })
-- snap.register.command("live_grep", vimgrep {})
-- end,
-- },
{
'camspiers/snap'
},
{
"windwp/nvim-spectre",
event = "BufRead",
config = function()
require("spectre").setup()
end,
},
{
"kevinhwang91/nvim-bqf",
event = { "BufRead", "BufNew" },
config = function()
require("bqf").setup({
auto_enable = true,
preview = {
win_height = 12,
win_vheight = 12,
delay_syntax = 80,
border_chars = { "┃", "┃", "━", "━", "┏", "┓", "┗", "┛", "█" },
},
func_map = {
vsplit = "",
ptogglemode = "z,",
stoggleup = "",
},
filter = {
fzf = {
action_for = { ["ctrl-s"] = "split" },
extra_opts = { "--bind", "ctrl-o:toggle-all", "--prompt", "> " },
},
},
})
end,
},
{
'phaazon/hop.nvim',
branch = 'v1', -- optional but strongly recommended
config = function()
-- you can configure Hop the way you like here; see :h hop-config
require 'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
end
},
{
'michaelb/sniprun', run = 'bash ./install.sh',
},
{
'ray-x/go.nvim',
},
{
'ray-x/guihua.lua',
},
{
'theHamsta/nvim-dap-virtual-text',
},
-- {
-- 'mfussenegger/nvim-dap',
-- },
}
-- require("nvim-dap-virtual-text").setup()
-- vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').gofmt() ]], false)
-- vim.api.nvim_exec(false, [[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]])
-- Run gofmt + goimport on save
-- vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]], false)
-- lvim.builtin.cmp.formatting.source_names["copilot"] = "(Copilot)"
-- table.insert(lvim.builtin.cmp.sources, 1, { name = "copilot" })
-- require("go.format").gofmt() -- gofmt only
-- require("go.format").goimport() -- goimport + gofmt
require 'hop'.setup()
require('go').setup()
require("go").setup({
goimport = "goimports"
})
vim.api.nvim_exec(
[[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]],
false
)
From the screenshot you shared. The plugin installed those tools, but it failed to identify the location. I think it is an issue with your PATH setup.
By default, if you install go binaries with go install
it installs to $GOBIN, in my environment, $GOBIN is /home/ray-x/go/bin . You might need to add $GOBIN to your PATH.
Push an update to append GOBIN to PATH (GOBIN needs to be defined in your shell)
This caused a problem in my case.
I don't have GOBIN
in my shell and that caused this error. I think it would be better to handle this error when there is no GOBIN inside the shell.
@ray-x
Sorry guys. I did not think the possibility GOBIN
can be empty. There is a PR addressing this. Should be all good now.
I found it was indeed GOBIN set error, after re-reading and setting it up, now it's works ok, thanks
When trying to run a command it fails, so it try to pull the missing binary without success. My attempt to solve the problem was installing all the binaries with the command
GoInstallBinaries
, so once installed I tried again but it didn't work either. This is the output ofcheckhealth
: