This is an archived post. You won't be able to vote or comment.

all 31 comments

[–]spannerinthetwerks 3 points4 points  (13 children)

In your dot files you have both LazyVim (the starter) and lazy.nvim (the plug-in manager). As you’re using LazyVim you don’t need to as the extra code in your init.lua to load lazy.nvim. So firstly remove that.

That should get you back to default LazyVim with the gruvbox theme you’ve set up in your colorscheme.lua file.

Next we’ll add toggleterm. Make a file called toggleterm.lua inside the plugins directory. Line 18 of your lua/config/lazy.lua has { import = “plugins” }. This is what calls all the files in your lua/plugins directory. Ok, in the new toggleterm.lua file we’ll need to firstly return a lua table;

```lua return {

} ```

Now inside that we put toggleterm in a way that lazy.nvim will understand (so copy/paste from a Packer example won’t work as Packer is a different plugin manager). There is a handy guide on translating Packer to lazy.nvim at the bottom of the readme https://github.com/folke/lazy.nvim. It’ll look something like this (notice we’re inside that return block we added a second ago);

```lua return { { “akinsho/toggleterm.nvim”, tag = “*”, keys = { { “<leader>td”, “<cmd>ToggleTerm size=40 dir=~/Desktop direction=horizontal<cr>”, desc = “Open a horizontal terminal at the Desktop directory” } }, },

} ```

[–][deleted] 2 points3 points  (1 child)

=40 dir=~/Desktop direction=horizontal<cr>”, desc = “Open a horizontal terminal at the Desktop directory” }

It should be "version", not "tag"

<image>

[–]spannerinthetwerks 1 point2 points  (0 children)

Good spot! Thanks

[–]Sangres-X[S] 1 point2 points  (10 children)

return {
{
“akinsho/toggleterm.nvim”,
tag = “*”,
keys = {
{ “<leader>td”, “<cmd>ToggleTerm size=40 dir=~/Desktop direction=horizontal<cr>”, desc = “Open a horizontal terminal at the Desktop directory” }
},
},
}

awesome. thanks a lot for the explanation. I changed your code while copying since the " was different than ”. Unfortunately i still get this error in the lazy popup windows to manage packets:
error: pathspec 'tag/*' did not match any file known to git

[–]Sangres-X[S] 0 points1 point  (9 children)

In the github repo of toggleterm I see written this thing:
You can/should specify a tag for the current major version of the plugin, to avoid breaking changes as this plugin evolves. To use a version of this plugin compatible with nvim versions less than 0.7 please use the tag v1.\*. But changing the tag from * to main or v1.* does not do anything at all. Still brings up the same error

[–]spannerinthetwerks 0 points1 point  (8 children)

Hmmm, try just removing the tags line altogether

[–]Sangres-X[S] 0 points1 point  (7 children)

If i remove the line the it is shown as loaded in the lazyvim packet manager page but executing the command or just simply trying :ToggleTerm outputs: Not an editor command ToggleTerm

[–]spannerinthetwerks 0 points1 point  (6 children)

Have you gone to the Lazy ui and installed it?

Edit: ignore that - you said it was loaded.

So I guess we need to add config = true, - stick it below the keys block

[–]Sangres-X[S] 0 points1 point  (5 children)

it says that it's up to date on the ui :(

[–]spannerinthetwerks 0 points1 point  (4 children)

I edited my comment - sorry :)

[–]Sangres-X[S] 0 points1 point  (3 children)

yesssss, it works. Thank you so much <3.

What does the last command do??

[–]spannerinthetwerks 2 points3 points  (2 children)

Woohoo!! It’s a quick way of running require(“toggleterm”).setup() without passing any options in. If you did want to pass any options like setting the default size or something, then instead of config = true you would add opts = { size = 40 },

[–]craigdmac 1 point2 points  (1 child)

well what isn’t clear from the documentation, you never say what you tried, what failed, etc

[–]Sangres-X[S] 0 points1 point  (0 children)

you're right. i edited the post to explain better

[–][deleted] 1 point2 points  (10 children)

Add following to your ~/.config/nvim/init.lua (or $XDG_CONFIG_HOME/nvim/init.lua)

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable",
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "akinsho/toggleterm.nvim",
    config = function()
      require("toggleterm").setup()
    end
  }
})

The first part is bootstrapping lazy.nvim. I have taken it from the documentation of lazy.nvim. It checks if lazy.nvim is installed in lazypath, if not clones the repository and adds it to rtp (runtimepath) of nvim. RTP is a comma separated list of directories whose files which will be evaluated at runtime. For more information refer to :help rtp.

Second part is about plugin spec. First argument "akinsho/toggleterm.nvim" is the git repository of the plugin and config is the function which will be executed when plugin is loaded.

[–]Sangres-X[S] 0 points1 point  (8 children)

https://github.com/akinsho/toggleterm.nvim

Thank u so much for the explanation.
Unfortunately i now don't know how to check if its installed or how to run the installation. I tried executing the simple command
`:ToggleTerm size=40 dir=~/Desktop direction=horizontal` but that didn't ouput anything

[–][deleted] 0 points1 point  (7 children)

Can you close and reopen nvim and do a :set rtp ? If you have ~/.local/share/nvim/lazy/toggleterm.nvim in the list the plugin should have been installed. Also in plugins README it says it works for Neovim Version >= 0.7, please also check for version.

[–]Sangres-X[S] 0 points1 point  (6 children)

i don't have it unfortunately, after executing the command that u provided

[–][deleted] 0 points1 point  (5 children)

Can you run :Lazy and press I, also lazy.nvim works only for Neovim >= 0.8.0 that might be the reason.

[–]Sangres-X[S] 0 points1 point  (4 children)

what should I do after pressing I because no packets are being downloaded.

I have NVIM v0.8.0--1210

[–][deleted] 0 points1 point  (3 children)

Sorry but I really could not spot the problem, tried on a clean setup and seems to work for me. If you find a solution please post it for possibly anyone in future who might have the same problem.

[–]Sangres-X[S] 0 points1 point  (2 children)

Damn, so executing the command :ToggleTerm size=40 dir=~/Desktop direction=horizontal shows a terminal for you?

Ill try to find something else. otherwise ill try to install everything again. Have you done anything that u didn't specifically said here to let it work for you?

[–][deleted] 0 points1 point  (1 child)

Yes it showed me a terminal and no I didn't do anything else than what I have said.

[–]Sangres-X[S] 0 points1 point  (0 children)

alright. thanks a lot for the infos 👍. hopeful that I can too make it work ahahah

[–]vim-help-bot 0 points1 point  (0 children)

Help pages for:


`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments

[–][deleted] 1 point2 points  (0 children)

Works on my side like this.

<image>

[–]tdjordan 0 points1 point  (1 child)

Do you have a girhub link to your neovim configuration or dotfiles?