Vista just doesn't work
matteouni opened this issue · comments
matteouni commented
Usually I use nvim-lsp. I've installed coc.nvim as doc prescribes, and yet no result when I run ":Vista"
- OS: xubuntu
- Vim/Neovim version: NVIM v0.8.1
Build type: Release - This plugin version:latest
- I'm using universal-ctags
- Ctags version: Exuberant Ctags 5.9~svn20110310
- I'm using some LSP client:
- Related Vim LSP client: nvim-lsp
- The Vim LSP client version: latest
local lfs = require("lfs")
require('packer').startup(function(use)
use "neoclide/coc.nvim" --installed for vista.vim
use "liuchengxu/vista.vim"
use "hrsh7th/cmp-nvim-lsp"
use "hrsh7th/nvim-cmp"
use "ray-x/lsp_signature.nvim"
use "https://gitlab.com/yorickpeterse/nvim-window.git"
use "folke/trouble.nvim"
use "williamboman/mason.nvim"
use "neovim/nvim-lspconfig"
use "nvim-tree/nvim-tree.lua"
use "nvim-treesitter/nvim-treesitter"
use "easymotion/vim-easymotion"
use "github/copilot.vim"
use "wbthomason/packer.nvim"
use "preservim/tagbar" -- exuberant-ctags
use "L3MON4D3/LuaSnip"
end)
local luasnip = require("luasnip")
local cmp = require("cmp")
cmp.setup({
snippet = {
--https://github.com/hrsh7th/nvim-cmp/blob/bb95d975ff2e2c57acf5a005f5c5c9bc94522319/lua/cmp/core.lua 472
expand = function(SnippetExpansionParams) --how nvim-cmp interacts with a particular snippet engine -- cmp.SnippetExpansionParams
luasnip.lsp_expand(SnippetExpansionParams.body)
end
},
mapping = {
["<C-Space>"] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace}), --If you didn't select any item and the option table contains `select = true`, nvim-cmp will automatically select the first item. Plus see https://github.com/hrsh7th/nvim-cmp/issues/1320
},
sources = {
{name = "nvim_lsp"},
{name = "buffer"},
}
})
require("lsp_signature").setup({
fix_pos = true, -- do not auto-close floating window until I've filled all parameters
hint_enable = false, -- do not show virtual hint text alongisde signature window
hint_prefix = "->", -- point at paramater to be filled
floating_window_above_cur_line = true, -- obviously when it's feasible
})
require("trouble").setup({
icons = false,
fold_open = "",
fold_closed = "",
indent_lines = true,
signs = {
error = "E",
warning = "W",
hint = "H",
information = "I",
other = "O",
},
}) --TODO refresh
local lspconfig = require("lspconfig")
local servers = {"pyright", "sumneko_lua", "clangd", "gopls"}
for _, v in pairs(servers) do
lspconfig[v].setup({
-- update_capabilities is deprecated https://github.com/hrsh7th/cmp-nvim-lsp/issues/38
capabilities = vim.tbl_deep_extend("force", lspconfig.util.default_config.capabilities, require('cmp_nvim_lsp').default_capabilities()) -- vim.tbl_deep_extend merges recursively two or more map-like tables. The first param decides what to do if a key is found in more than one table. In this case we may use value from the rightmost map. In this way we do not throw away neovim built-in's LSP capabilities.
})
end
require("mason").setup()
require("nvim-treesitter.configs").setup({
ensure_installed = {"lua"}, --parsers
indent = {enable = true},
highlight = {enable = true}, --"I get query error: invalid node type at position" paragraph. Syntax highlighting
})
require("nvim-tree").setup({ --TODO sync tab option
open_on_setup_file = true, -- focus on file window rather than nvim-tree
view = {
relativenumber = true,
number = true,
},
renderer = {
highlight_opened_files = "names",
icons = {-- To disable the display of icons see |renderer.icons.show|
show = {
git = true,
folder = false,
file = false,
folder_arrow = false,
},
},
},
diagnostics = {
enable = true,
icons = {
hint = "H",
info = "I",
warning = "W",
error = "E",
},
},
})
-- config centered on github copilot
local options = {
filetype = "on", --turned on filetype detection
foldmethod = "expr",
foldexpr = "nvim_treesitter#foldexpr()",
foldnestmax = 1,
clipboard = vim.opt.clipboard + "unnamedplus" + "unnamed", --TOFIX from repeat.vim page
expandtab = true,
hlsearch = false,
iskeyword = vim.opt.iskeyword + "-" + "_",
number = true,
pumheight = 7,
relativenumber = true,
scrolloff = 999,
shiftwidth = 4, -- Number of spaces to use for each step of (auto)indent
showmode = false,
smartindent = true, -- Do smart autoindenting when starting a new line
-- softtabstop = 4, -- Number of spaces that a <Tab> counts for while performing editing operations
tabstop = 4, -- Number of spaces that a <Tab> in the file counts for
updatetime = 200,
cursorline = true,
cursorline=true,
cursorlineopt = "screenline",
}
for k, v in pairs(options) do
vim.opt[k] = v
end
local globals = {
tagbar_show_linenumbers = 2, -- show relative line numbers in tagbar window
copilot_no_tab_map = true, -- do not accept copilot suggestion with tab
}
for k, v in pairs(globals) do
vim.g[k] = v
end
local speed_coding = {"w", "wq", "wq!", "q", "q!", "qa", "qa!"}
local function partiallyAccept()
local _ = vim.fn['copilot#Accept']("")
local suggestion = vim.fn['copilot#TextQueuedForInsertion']()
return vim.fn.split(suggestion, [[[ .]\zs]])[1] -- the word can be separated by space or by the dot char
end
local function smartIndent()
local currLine, currCol = unpack(vim.api.nvim_win_get_cursor(0))
--! => nore
vim.api.nvim_command("normal! gg=G")
vim.api.nvim_command("normal! " .. currLine .. "G")
end
-- TODO indent mode
local keymaps = { -- :h modes
{"i", "<c-c>", 'copilot#Accept("<CR>")', {expr=true}},
{"nv", "<c-w>", "<cmd>:lua require('nvim-window').pick()<CR>", {}},
{"nv", "<leader>p", '"+p', {noremap=true}}, --REQUIRES xclip on X11!
{"nv", "<leader>y", '"+y', {noremap=true}},
{"nv", "c", '"_c', {noremap=true}},
{"nv", "d", '"_d', {noremap=true}},
{"nv", "x", '"_x', {noremap=true}},
{"i", "<c-l>", partiallyAccept, {expr=true}},
{"n", "<c-f>", smartIndent, {}},
{"n", "<c-d>", function()
updateLSP(lfs.currentdir(), 1)
vim.api.nvim_command("Trouble")
end, {}},
{"nov", "F" , "<Plug>(easymotion-Fl)", {}},
{"nov", "T" , "<Plug>(easymotion-Tl)", {}},
{"nov", "t" , "<Plug>(easymotion-tl)", {}},
{"nov", "f" , "<Plug>(easymotion-fl)", {}},
}
local function keymap(modes, key, value, opts)
for i=1, string.len(modes) do
local mode = string.sub(modes, i, i)
vim.keymap.set(mode, key, value, opts)
end
end
for _, v in pairs(keymaps) do
keymap(unpack(v))
end
function updateLSP(path, depth) --TODO see :help vim.lsp.start_client
if depth == 0 then
return
end
for file in lfs.dir(path) do
local f = path..'/'..file
if file ~= "." and file ~= ".." and lfs.attributes(f).mode ~= "directory" then
vim.cmd("vs " .. file)
vim.cmd("close")
end
end
vim.cmd("NvimTreeRefresh")
end
local all_files = {"*.lua", "*.py", "*.c", "*.cpp", "*.h", "*.hpp"}
local autocmds = { -- TOSEE https://stackoverflow.com/questions/3837933/autowrite-when-changing-tab-in-vim
--TODO NERDTree like, add commenter and system clipboard
{{"TabNew"}, {pattern = all_files, command=":TagbarOpen"}},
{{"TabNew"}, {pattern = all_files, command=":NvimTreeOpen"}},
{{"VimEnter"}, {pattern = all_files, command=":NvimTreeOpen"}},
{{"VimEnter"}, {pattern = all_files, command=":TagbarOpen"}},
{{"CursorHoldI"}, {pattern = all_files, command=":TagbarForceUpdate"}},
}
for _, v in pairs(autocmds) do
vim.api.nvim_create_autocmd(unpack(v))
end
Liu-Cheng Xu commented
You have to use https://github.com/universal-ctags/ctags instead of Exuberant Ctags. Feel free to reopen if this does not help.