ldelossa / nvim-ide Goto Github PK
View Code? Open in Web Editor NEWA full featured IDE layer for Neovim. Heavily inspired by VSCode.
License: MIT License
A full featured IDE layer for Neovim. Heavily inspired by VSCode.
License: MIT License
If I comment out the changes
component in my config it stops happening, so it's coming from there. I'll investigate and see if I can do a PR.
Was getting the following when starting neovim in a non-git directory (in this case, home directory):
Error executing vim.schedule lua callback: ...te/pack/packer/start/nvim-ide/lua/ide/lib/git/client.lua:147: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
...te/pack/packer/start/nvim-ide/lua/ide/lib/git/client.lua:147: in function 'callback'
...te/pack/packer/start/nvim-ide/lua/ide/lib/git/client.lua:37: in function 'callback'
.../pack/packer/start/nvim-ide/lua/ide/lib/async_client.lua:137: in function <.../pack/packer/start/nvim-ide/lua/ide/lib/async_client.lua:132>
Error executing vim.schedule lua callback: ...te/pack/packer/start/nvim-ide/lua/ide/lib/git/client.lua:334: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
...te/pack/packer/start/nvim-ide/lua/ide/lib/git/client.lua:334: in function 'parse'
...te/pack/packer/start/nvim-ide/lua/ide/lib/git/client.lua:357: in function 'callback'
...te/pack/packer/start/nvim-ide/lua/ide/lib/git/client.lua:37: in function 'callback'
.../pack/packer/start/nvim-ide/lua/ide/lib/async_client.lua:137: in function <.../pack/packer/start/nvim-ide/lua/ide/lib/async_client.lua:132>
I made a few changes and I think it fixes the issue?:
diff --git a/lua/ide/lib/async_client.lua b/lua/ide/lib/async_client.lua
index 6889afc..6ae7702 100644
--- a/lua/ide/lib/async_client.lua
+++ b/lua/ide/lib/async_client.lua
@@ -127,6 +127,14 @@ Client.new = function(cmd)
if exit_code ~= 0 then
req.error = true
req.reason = "non-zero status code: " .. exit_code
+
+ -- request failed so close pipes and return
+ stdout:read_stop()
+ stderr:read_stop()
+ stdout:close()
+ stderr:close()
+ handle:close()
+ return
end
req.signal = signal
vim.schedule(function()
diff --git a/lua/ide/lib/git/client.lua b/lua/ide/lib/git/client.lua
index 145378d..50445e7 100644
--- a/lua/ide/lib/git/client.lua
+++ b/lua/ide/lib/git/client.lua
@@ -142,7 +142,9 @@ Git.new = function()
function(stdout)
if stdout == nil then
cb(nil)
+ return
end
+
local commits = {}
for _, commit in ipairs(stdout) do
local parts = vim.fn.split(commit, Git.RECORD_SEP)
@@ -330,6 +332,9 @@ Git.new = function()
-- is_head - @bool, whether this branch is the current HEAD.
function self.branch(cb)
local function parse(branches)
+ if branches == nil then
+ return
+ end
local out = {}
for _, b in ipairs(branches) do
local parts = vim.fn.split(b)
If this looks alright to you, I can cut a PR for it.
I've found a few "issues" while testing and i'm adding them individually so as to keep the discussions focused.
t seems to prevent floating terminal windows from opening - I use Toggle Term to add shortcuts for terminal programs like Lazygit that open in a floating window and they seem to immediately close with Nvim-IDE open, but without the terminal panel being open, the floating terminal windows act normally.
Hi, thanks for the great plugin :)
I found this error when I try to edit a file that doesn't belong to the current repository
I (and I think many others) are switching to this from nvim-tree. Could we get an option like keymaps = { preset = 'nvim-tree' }
that makes it easily match nvim-tree's keymaps, instead of user having to override every keymap?
File explorer component should have an option to hide permissions listing
There is a logger package in ide.logger
module.
Currently, its logging all levels unconditionally. We should set a log level in the config and log everything from that level and above. The logger calls should no-op if they are used and the given log level (and higher) is not specified in the config.
Additionally, a logging pass is needed. A logger is setup in a lot of functions, but never used, since I got enticed by adding features ๐
I get this error when opening a lua file. It is not shown when nvim-ide
not loaded or setup not called.
I've found a few "issues" while testing and i'm adding them individually so as to keep the discussions focused.
Is it possible to change the panel text colors highlighted row color? I checked for highlight
in the repo and couldn't see anything and NvimIde
(or similar) didn't popup inside of Telescope highlight group search. It's quite hard to know which panel is currently focused without checking each one for the different title color.
Hi,
I am working a lot with different projects and different languages (bash, python, java, lua, rust...). So it would be awesome to have the ability to change the default panels depending on the filetype being used. and which panels are opened and which are not.
I would probably try to rely on existing features for this functionality, like adding some code to ftplugin-dir.
e.g. when opening bash-scripts, it would open an explorer on the right, but probably not outline (outline does not really work with lua or bash - maybe another feature request).
when opening a java-file (or related), it would show more panels, maybe by default.
It was mentioned to have some kind of named configurations, so it would be great to use those for example in ftplugins or anything alike...
I hope that does make sense...
All components should expose a Component config option which determines if they are "hidden" by default.
Right now, this is a bit hard coded, for instance CallHierarchy is hidden by default, until the CallHierarchy commands are used, in which the Component then "focuses" itself after populating its UI.
The current behavior is somewhat confusing.
When you cursor is over a directory, and you create a new file, if the directory is not expanded, the new file should be created with the parent node as the root.
If the directory under cursor is expanded, only then should it use that directory as the root for the new file.
Per this conversation:
#35 (comment)
Make a way to set some global keymap overrides, such that users do not need to specify the same keybind override for every component.
If you are using bufferline.nvim, by you'll end up with the first tab right above the left hand panel:
There's an option to offset this, but requires a bit of extra configuration:
require("bufferline").setup({
options = {
offsets = {
-- you might already have this if you've used nvim-tree
{
filetype = "NvimTree",
text = "",
highlight = "Directory",
text_align = "left",
},
-- add this
{
filetype = "filetree",
text = "",
highlight = "Explorer",
text_align = "left",
}
},
},
})
Afterwards, it looks like this:
I'm not sure where the boundaries lie between these plugins, if it should account for it, or update the other plugin or what, but wanted to note it as something users may run into.
Components which use git log
related commands experience an error when opening repos with no commits.
If a given filename ends with /
, it should create a directory instead (I know there is a separate keymap but this is what my muscle memory does)
Additionally, given a path like path/with/subdirs/file.txt
, it should create any necessary directories automatically.
when opening the terminal panel, no shell is shown, just an empty editor pane.No error shown.
I do have ToggleTerm
installed - maybe related...
Hello!
It seems if the docs are in nvim-ide/docs
, they are not available within vim, but renaming the docs dir to doc
seems to do the trick. So:
mv docs doc
to clarify.
Do you have them available within nvim while they're under the docs
dir?
I noticed that in most of the modules, you're just doing something like:
Whatever = {}
-- some stuff
return Whatever
This creates a global variable, which isn't really ideal. Unless you have some specific reason they need to be globals, you should do:
local Whatever = {}
-- some stuff
return Whatever
Heyo.
I've started playing with the concept of never leaving vim lol In this, I've found that Explorer doesn't seem to detect when a tab's cwd changes (such as with :tcd /somewhere/else
). Instead it holds on to whatever the cwd was when the tab was created.
Should the Explorer component pick up if the cwd has changed in a tab? Or is this outside of scope of nvim-ide.
Example:
Example code implementing such behavior: https://github.com/mrjones2014/op.nvim/blob/master/lua/op/sidebar/init.lua#L253
When editing my Neovim config, the git root is located at ~
, and the .git
repo directory is at ~/.dotfiles
. With gitsigns
I can do:
require('gisigns').setup({
worktrees = {
{
toplevel = vim.env.HOME,
gitdir = string.format('%s/.dotfiles', vim.env.HOME),
},
}
})
I've found a few "issues" while testing and i'm adding them individually so as to keep the discussions focused.
Is it possible to set a wider default width for the panels?
I'd like to open the right panel by default instead of the left, or have an option to not open either panel automatically when Neovim starts.
If I type :term
to open a new terminal, we should be able to use a BufNew
autocmd or something to automatically add it to the UI
Thoughts @ldelossa ?
If you're into the idea, I can submit a PR and set up checking via GitHub Actions. I can write the workflow.yml
, and then you'd just need to set it as a required workflow to pass for PRs in repo settings.
I am using a nerd font, and icon_set
is set to "nerd"
(I also tried "default"
), but it still shows question marks instead of the proper icons in every panel except for the file icons.
My full config for nvim-ide
:
-- default components
local bufferlist = require('ide.components.bufferlist')
local explorer = require('ide.components.explorer')
local outline = require('ide.components.outline')
local callhierarchy = require('ide.components.callhierarchy')
local timeline = require('ide.components.timeline')
local terminal = require('ide.components.terminal')
local terminalbrowser = require('ide.components.terminal.terminalbrowser')
local changes = require('ide.components.changes')
local commits = require('ide.components.commits')
local branches = require('ide.components.branches')
local bookmarks = require('ide.components.bookmarks')
require('ide').setup({
-- The global icon set to use.
-- values: "nerd", "codicon", "default"
icon_set = "nerd",
-- Component specific configurations and default config overrides.
components = {
-- The global keymap is applied to all Components before construction.
-- It allows common keymaps such as "hide" to be overriden, without having
-- to make an override entry for all Components.
--
-- If a more specific keymap override is defined for a specific Component
-- this takes precedence.
global_keymaps = {
jump = "o",
maximize = "=",
minimize = "-"
},
-- example, prefer "x" for hide only for Explorer component.
-- Explorer = {
-- keymaps = {
-- hide = "x",
-- }
-- }
},
-- default panel groups to display on left and right.
panels = {
left = "explorer",
right = "git",
bottom = "terminal",
},
-- panels defined by groups of components, user is free to redefine the defaults
-- and/or add additional.
panel_groups = {
explorer = { outline.Name, bufferlist.Name, explorer.Name, bookmarks.Name, callhierarchy.Name,
terminalbrowser.Name },
terminal = { terminal.Name },
git = { changes.Name, commits.Name, timeline.Name, branches.Name }
},
-- workspaces config
workspaces = {
-- which panels to open by default, one of: 'left', 'right', 'both', 'none'
auto_open = 'left',
},
-- default panel sizes for the different positions
panel_sizes = {
left = 30,
right = 30,
bottom = 15
}
})
The line below assume the user's operating system is Linux and will cause issues on Windows system because the default Neovim config folder path on Windows is different from Linux
The statement "Get the plugin via your favorite plugin manager" in the README likely makes a lot of sense to advanced neovim users. But if the user is newer to neovim, and doesn't necessarily have a plugin manager, it's not very helpful. It would be great to provide some additional context:
nvim-ide
?I've been noticing this error when trying to quit after using a panel. I end up needing to :qa!
to exit, otherwise new component buffers are created with updates. Here's an example:
Reproduction steps:
:Workspace LeftPanelToggle
:q
in original file:q
in panel:qa
to try to close everything:qa!
to really close everythingI didnโt expect <ESC>
to close the single window, IMO it should toggle the whole sidebar.
anyway, if I accidentally close one or more component windows, is there an easy way to get them back and fully restore the window layout?
I've found a few "issues" while testing and i'm adding them individually so as to keep the discussions focused.
Just noticed :q
on a buffer, which would normally close Nvim, seems to close the buffers, but keeps the left and right panels open, which need to be individually closed.
Closing a buffer, with the panels open, means that the panels take up the entire viewport, then when I try to move to another buffer, it opens inside one of the IDE panels.
The only lazy-loading mechanism that works for nvim-ide is event = 'VimEnter'
which sorta defeats the purpose of lazy-loading.
Here's my current config:
return {
-- localplugin just returns the local path to the cloned repo
-- if it exists on disk
localplugin('ldelossa/nvim-ide'),
event = 'VimEnter',
config = function()
local explorer = require('ide.components.explorer')
local outline = require('ide.components.outline')
local bufferlist = require('ide.components.bufferlist')
local changes = require('ide.components.changes')
local commits = require('ide.components.commits')
require('ide').setup({
components = {
[explorer.Name] = {
list_directories_first = true,
show_file_permissions = false,
keymaps = {
hide = '<NOP>',
},
},
[outline.Name] = {
keymaps = {
hide = '<NOP>',
},
},
},
panel_groups = {
explorer = { bufferlist.Name, explorer.Name, outline.Name },
git = { changes.Name, commits.Name },
},
workspaces = {
auto_close = false,
},
})
end,
}
However if I change event = 'VimEnter'
to cmd = 'Workspace'
, the command doesn't get registered properly and I'm unable to open the panels.
Haven't dug in to it yet, but this keeps happening every time I open a new terminal beyond the first one:
E5108: Error executing lua: Vim:Can only call this function in an unmodified buffer
stack traceback:
[C]: in function 'termopen'
...start/nvim-ide/lua/ide/components/terminal/component.lua:91: in function 'new_term'
...ua/ide/components/terminal/terminalbrowser/component.lua:103: in function 'new_term'
...ua/ide/components/terminal/terminalbrowser/component.lua:49: in function <...ua/ide/components/terminal/terminalbrowser/component.lua:49>
This happens whether I press "n" in the terminal browser, or if I call :Workspace TerminalBrowser New
, or both.
However, the terminal browser shows multiple terminals as though there is more than one, and I can rename them individually, but they all bring up the same terminal if I hit enter on them.
Hoping someone can confirm if this is just a me thing, as this hasn't happened until recently.
Edit: I did just update neovim to the latest nightly. Investigating.
Edit 2: Seems like it's rather not actually creating the new buffer or the nvim_win_set_buf
isn't working correctly for the terminal in new_term()
. Might be a me thing, not sure. I'll play with it tomorrow.
I think the buffer list needs the following options:
{
-- custom function that user can implement to filter buffers out of list
filter = <function>,
-- customize the character indicating current buffer
-- maybe it can also be a highlight?
indicator_current = '*',
-- indicator for when buffer is modified
indicator_modified = '!',
}
I also think the indicators should be placed before the filetype icons, and the rest of the items padded so that the filetype icons remain aligned.
When editing issue templates, CI/CD scripts, etc. under .github/
the file tree also expands .git/
๐๐ป
Reading the docs it looks like I should see a bunch of panels displayed after the .setup()
is executed (that doesn't happen, no errors either), but also that a :Workspace
command should be exposed (but there isn't).
use {
"ldelossa/nvim-ide",
config = function()
require("ide").setup({
icon_set = "default",
panels = {
left = "explorer",
right = "git"
},
})
end
}
I'm not sure how much of an undertaking this would be.
Idea is basically exposing more of the underlying API.
One way to maybe go about this is to just expose a get
and set
for certain options at the top level of the various elements (workspace, panel, and components).
End result being something like:
Workspace.panels.set("left", "git")
or
Workspace.panel[pos].get("is_open")
(not really sure the best way to handle it, but I figure sanitizing user input is probably needed)
This would allow for a much more script-able environment.
Few ideas where this would be nice:
Just thoughts right now! Let me know what you think.
I'm not sure what causes this, but I can't reproduce if I uninstall nvim-ide
so it's coming from this plugin.
When I do :Telescope find_files
it puts me in the file in insert mode instead of normal mode.
This only started happening recently.
trying to use nvim-ide in my wsl
machine(ubuntu20.04), error like below
Error executing vim.schedule lua callback: ...lugged/nvim-ide/lua/ide/components/outline/component.lua:445: unexpected event
stack traceback:
[C]: in function 'nvim_create_autocmd'
...lugged/nvim-ide/lua/ide/components/outline/component.lua:445: in function 'constructor'
...e/nvim/plugged/nvim-ide/lua/ide/workspaces/workspace.lua:152: in function 'init_panels'
...e/nvim/plugged/nvim-ide/lua/ide/workspaces/workspace.lua:161: in function 'init'
...ged/nvim-ide/lua/ide/workspaces/workspace_controller.lua:169: in function 'assign_ws'
...ged/nvim-ide/lua/ide/workspaces/workspace_controller.lua:258: in function 'fn'
vim/_editor.lua:384: in function 'cb'
vim/_editor.lua:256: in function <vim/_editor.lua:256>
my init.lua
local Plug = vim.fn['plug#']
vim.call 'plug#begin'
Plug 'ldelossa/nvim-ide'
vim.call 'plug#end'
-- default components
local explorer = require('ide.components.explorer')
local outline = require('ide.components.outline')
local callhierarchy = require('ide.components.callhierarchy')
local timeline = require('ide.components.timeline')
local terminal = require('ide.components.terminal')
local terminalbrowser = require('ide.components.terminal.terminalbrowser')
local changes = require('ide.components.changes')
local commits = require('ide.components.commits')
local branches = require('ide.components.branches')
local bookmarks = require('ide.components.bookmarks')
local bufferlist = require('ide.components.bufferlist')
require('ide').setup({
-- The global icon set to use.
-- values: "nerd", "codicon", "default"
icon_set = "default",
-- Component specific configurations and default config overrides.
components = {
-- The global keymap is applied to all Components before construction.
-- It allows common keymaps such as "hide" to be overriden, without having
-- to make an override entry for all Components.
--
-- If a more specific keymap override is defined for a specific Component
-- this takes precedence.
global_keymaps = {
-- example, change all Component's hide keymap to "h"
-- hide = h
},
-- example, prefer "x" for hide only for Explorer component.
-- Explorer = {
-- keymaps = {
-- hide = "x",
-- }
-- }
},
-- default panel groups to display on left and right.
panels = {
left = "explorer",
right = "git"
},
-- panels defined by groups of components, user is free to redefine the defaults
-- and/or add additional.
panel_groups = {
explorer = { outline.Name, bufferlist.Name, explorer.Name, bookmarks.Name, callhierarchy.Name, terminalbrowser.Name },
terminal = { terminal.Name },
git = { changes.Name, commits.Name, timeline.Name, branches.Name }
},
-- workspaces config
workspaces = {
-- which panels to open by default, one of: 'left', 'right', 'both', 'none'
auto_open = 'left',
},
-- default panel sizes for the different positions
panel_sizes = {
left = 30,
right = 30,
bottom = 15
}
})
my neovim version info
xx:~$ nvim --version
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
system info
5.15.74.2-microsoft-standard-WSL2 #1 SMP Wed Nov 2 19:50:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
@distek not sure if this was planned for your refactor but we should be able to control the default size of each component within each panel.
This will probably be passed to the component-level config.
I get this error anytime I switch between buffers:
Error executing vim. schedule lua callback:
stack traceback: โข /start/nvim-ide/lua/ide/components/outline/component.lua:161: attempt to index field 'cursor' ( a nil value)
.../start/nvim-ide/lua/ide/components/outline/component lua: 161: in function ' build outline'
./start/nvim-ide/lua/ide/components/outline/component.lua:195: in function 'callback'
.w/Cellar/neovim/0.8.0/share/nvim/runtime/lua/vim/lsp.lua:1958: in function 'handler'
w/Cellar/neovim/0.8.0/share/nvim/runtime/lua/vim/lsp.lua:1390: in function
vim/ editor. lua: in function <vim/ editor. lua:
I'm getting this on Ruby files using ruby-lsp and Lua files using sumoneko. Files without attached LSP seem unaffected.
This happens even if the symbol outline component is not shown. Is there a way to disable it in the meantime?
I've found a few "issues" while testing and i'm adding them individually so as to keep the discussions focused.
:h nvim-ide
doesn't seem to open the help file.
with nvim-tree
when you select a file, it uses the statusline/winbar to set a label (A
/B
/C
etc) on each window, and pressing the key corresponding to each window opens the file in that window.
It would be cool to do something similar with nvim-ide
In file explorer there should be an option to make subdirectories be sorted to the top of the directory listing, above files.
Error detected while processing /home/aditya/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/aditya/.config/nvim/init.lua:40: attempt to index global 'outline' (a nil va
lue)
stack traceback:
/home/aditya/.config/nvim/init.lua:40: in main chunk
Press ENTER or type command to continue
This is what I am getting while opening neovim.
My init.lua file
-- Variables
local Plug = vim.fn["plug#"]
local g = vim.g
local set = vim.opt
vim.call("plug#begin", "~/.config/nvim/plugged")
Plug "ldelossa/nvim-ide" --make nvim like VSCode
Plug "ellisonleao/gruvbox.nvim" --gruvbox theme
Plug "arcticicestudio/nord-vim" --nord theme
Plug "joshdick/onedark.vim" --one dark
Plug "nvim-lualine/lualine.nvim"
Plug "kyazdani42/nvim-web-devicons"
Plug "projekt0n/github-nvim-theme" --github theme
vim.call("plug#end")
-- theming
require('lualine').setup {
options = {
theme = "auto" -- or you can assign github_* themes individually.
-- ... your lualine config
}
}
require('ide').setup({
-- the global icon set to use.
-- values: "nerd", "codicon", "default"
icon_set = "default",
-- place Component config overrides here.
-- they key to this table must be the Component's unique name and the value
-- is a table which overrides any default config values.
components = {},
-- default panel groups to display on left and right.
panels = {
left = "explorer",
right = "git"
},
-- panels defined by groups of components, user is free to redefine these
-- or add more.
panel_groups = {
explorer = { outline.Name, explorer.Name, bookmarks.Name, callhierarchy.Name, terminalbrowser.Name },
terminal = { terminal.Name },
git = { changes.Name, commits.Name, timeline.Name, branches.Name }
}
})
require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
italic = false,
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "hard", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {},
dim_inactive = false,
transparent_mode = false,
})
-- keymaps
function map(mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
end
function nmap(shortcut, command)
map('n', shortcut, command)
end
function imap(shortcut, command)
map('i', shortcut, command)
end
-- common vim options
vim.cmd [[
colorscheme gruvbox
syntax on
filetype plugin indent on
autocmd Filetype cpp setlocal tabstop=2
]]
set.number = true
set.mouse = "a"
set.autoindent = true
set.termguicolors = true
set.showmode = false
set.expandtab = true
set.hlsearch = true
set.ruler = true
set.title = true
set.autoread = true
set.tabstop = 4
set.shiftwidth = 4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.