It is not clear how I am supposed to install sad on unbuntu
wakywayne opened this issue · comments
I am on ubuntu and I am unable to figure out what steps I need to take to install sad.
I am not a ubuntu user
on arch I install it with yay -Sy sad
On debian and ubuntu you can download the deb
file from https://github.com/ms-jpq/sad/releases/tag/v0.4.22
and install deb file with
sudo dpkg -i sadxxxx.deb
do i copy it to my root folder and then run this command? Sorry if this is a dumb question I am new to neovim
I am not sure where I need to install this file is basically my question.
It is more a question on how to install deb package on Ubuntu.
You can download latest version of sad here: https://github.com/ms-jpq/sad/releases/download/v0.4.22/x86_64-unknown-linux-gnu.deb
and run sudo dpkg -i x86_64-unknown-linux-gnu.deb
I moved the file into my .config/nvim folder and ran your command. When I try and start nvim I get the following error message: Error while calling lua chunk: ...e/nvim/site/pack/packer/start/sad.nvim/lua/sad/utils.lua:26: Vim(packadd):E919: Directory not found in 'packpath': "pack/*/opt/guihua.lua" stack traceback: in function cmd & in function 'load_plugin'
How does my linux know where this file is located when I rin the sudo dpkg -i x86_64-unknown-linux-gnu.deb
command? And is it really safe to download random files that I can't even read from the internet? When I try to read the file it is a bunch of random characters.
Seems the guihua.lua did not installed for your nvim. Did you install that plugin as well?
I hadn't. I installed guihua and the lua-language-server, but now when I try to use sad it goes to open the gui for a microsecond and then diapears. When I run checkhealth I get nothing mentioning sad. I also globally isnstalled the fd package as well
I post a minium init.lua for your reference
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
print("load plugins")
require("packer").startup({
function(use)
use({ "wbthomason/packer.nvim" })
use({
"ray-x/sad.nvim",
requires = { "ray-x/guihua.lua", run = "cd lua/fzy && make" },
config = function()
require("sad").setup({})
end,
})
end,
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({
"git",
"clone",
"https://github.com/wbthomason/packer.nvim",
install_path,
})
load_plugins()
require("packer").sync()
else
load_plugins()
end
vim.cmd("colorscheme murphy")
I do not think it relates to ubuntu.
I really REALLY appreciate you taking the time to help me. I tried updating my packer file and I am still getting the same behavior. I have posted my nvim to github if it isn't way out of line for me to ask could you take a quick look at it?
heres the link
My set up is as follows:
- Every configuration for my plugins is in it's cooresponding file in
lua/user/
- Every Plugin is imported in my plugin file
lua/users/plugins.lua
- Lastly I have my root
init.lua
file that requires all of my other files
Once again I really appreciate you taking the time to help me and I hope we can get this working it looks like an awesome plugin.
Ugh... Could there be anything you have installed on your local computer that I don't? I would assume it is something to do with npm install -g fd-find
command? I ran previous commands with sudo apt install
but it wasn't working. I thought I uninstalled it via apt, but if I didn't could they be conflicting and causing an issue? Is there anyway to check what I have installed via apt and globally with npm?
I think my problem is with my delta installation, however there docs really isn't clear on how to install it. I am using WSL's unbuntu so I have sudo apt install, but I try that and it doesn't work.
I am also getting two error message:
&termguicolors must be set
please install delta e.g brew installdelta
- I have ran this command to try and install it
sudo apt install delta
, but the message doesn't go away and the docs are not clear on how to install git-delta
- I have ran this command to try and install it
Please Note I was getting the
&termguicolors
error before I tried to install this package
Thank you again for helping me the fact that you took the time to clone my repo means a lot.
It seems delta is not in your path. You can symbol link it to /usr/bin/delta.
Btw, the plugin does not require delta, you can use diff
or diff-so-fancy
I managed to install delta by downloading a .deb file and running dpkg -i filename
. I did this in my .config/nvim folder and I am able to use the delta comand in the console, but still not working. Should I have downloaded the .deb file in a different folder? I also pushed my latest version to git hub in case the issue is now with my code and not the packages I need to install.
What is the location of delta? If it not in your /usr/bin, you can try to put it to /usr/bin dir.
If delta installed. You can run
:!delta
in vim command line to check if you get a
command not found: delta
error
I do not get this error it seems that I have delta installed globally as it works in my root directory as well
I thought maybe it was my sad installation that was the problem so I went to their git hub and installed this deb file for unbuntu:
x86_64-unknown-linux-musl.deb
I have the sad command but the same behaviore is happening with the gui just apearing for a microsecond and then leaving. Could it be the &termguicolors must be set
error?
What was the error massage when you run sad?
A quick way to test, in one of your folder run:
fd | sad 'from_string' 'to_string'
Do you see any error messages?
when I run fd | sad 'from_string' 'to_string'
?
No I get no error messages I also get no error messages when I run :Sad
I think I made some progress I was able to get rid of the GUI colors error and I now have a different behavior. It seems to only be working in the current
2023-01-03.09-36-03.mp4
file
May it be delta setup?
Could you check https://github.com/dandavison/delta on git diff
and pager
setup?
Also please set sad like this:
require('sad').setup(
{
debug = true,
autoclose = false,
}
)
This is what I get after adding those to the settings
"export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';
export FZF_PREVIEW_COLUMNS=234;
export FZF_PREVIEW_LINES=33;
fd | sad --pager delta 'onomatopoeia' 'onono'"
9
if i manually input the text:
"export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';
export FZF_PREVIEW_COLUMNS=234;export FZF_PREVIEW_LINES=33;
fd | sad --pager delta 'onomat' 'ono'"
17
I made sure my setup was the same as what they say in the GitHub link you said to check and the behavior was the same
Could you update to the latest version and setup
require('sad').setup(
{
debug = true,
vsplit = false,
autoclose = false,
}
)
When you stay update to the latest version you mean your sad wrapper or the actual sad package? Sorry if I am being dumb here
no worries.
You need to update the sad.nvim plugin.
this is how I install it :
-- Sad find and replace
use { "ray-x/guihua.lua" }
use({
"ray-x/sad.nvim",
requires = { "ray-x/guihua.lua", run = "cd lua/fzy && make" },
})
after adding the above to my config file
"export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';export FZF_PREVIEW_COLUMNS=140;export FZF_PREVIEW_LINES=33;fd | sad --pager 'delta -w 140' 'onomato' 'ono'"
{
autoclose = true,
cmd = "export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';export FZF_PREVIEW_COLUMNS=140;export FZF_PREVIEW_LINES=33;fd | sad --pager 'delta -w 140' 'onomato' 'ono'",
height_ratio = 0.6,
term_name = "sad_floaterm",
vsplit = false,
width_ratio = 0.6
}
I also can't get the GUI to pop up at all again. It is back to disappearing write away no matter what.
You only need this in your setup:
require('sad').setup(
{
debug = true,
autoclose = false,
}
)
What are the error messages you see?
I think the only thing may matter is:
vsplit = true,
setting. You can set that to vsplit = false
to see does it make any difference.
When I change the config to the above all my console logs is this:
"export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';export FZF_PREVIEW_COLUMNS=124;export FZF_PREVIEW_LINES=33;fd | sad --pager 'delta -w 124' 'require' 'require'"
{
autoclose = true,
cmd = "export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';export FZF_PREVIEW_COLUMNS=124;export FZF_PREVIEW_LINES=33;fd | sad --pager 'delta -w 124' 'requir
e' 'require'",
height_ratio = 0.6,
term_name = "sad_floaterm",
vsplit = false,
width_ratio = 0.6
}
4
notice that it says auto close is true even tho I set it to false? I have pushed the latest code to my git hub.
linked here
Ok, seems there is an error related to autoclose setup. I've updated it. Could you try again and see what is the error on your terminal, thanks!
When I run :packerUpdate
it says already up to date it seems the error message has changed though:
"export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';export FZF_PREVIEW_COLUMNS=160;export FZF_PREVIEW_LINES=33;fd | sad --pager 'delta -w 160' 'require' 'require'"
{
autoclose = false,
cmd = "export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';export FZF_PREVIEW_COLUMNS=160;export FZF_PREVIEW_LINES=33;fd | sad --pager 'delta -w 160' 'require' 'require'"
}
It does seem that we are closer though I can consistently get this screen:
In the popup floating windows of sad, can you move your cursor to the beginning of
Would you also attach the screenshot what you got when you run following command in bash/zsh
export FZF_DEFAULT_OPTS='--height 90% --layout=reverse --border --multi --bind=ctrl-a:toggle-all';export FZF_PREVIEW_COLUMNS=160;export FZF_PREVIEW_LINES=33;fd | sad --pager 'delta -w 160' 'require' 'require'
Also what is the delta
setup in .gitconfig
Would you check if your delta
is setup in .gitconfig?
Please check this for details:
https://dandavison.github.io/delta/configuration.html
Also please set
[delta]
side-by-side = true
To enable side-by-side preview
I can not seem to move the cursor to reveal more of the screen ( I think that is what you were asking)
Here is my git config in the same directory as my init.lua file :
[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # use n and N to move between diff sections
light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal)
side-by-side = true
[merge]
conflictstyle = diff3
[diff]
colorMoved = default
I changed my .gitconfig to match the link you sent me with the addition of side-by-side = true
The behavior seemed to be the same
Image when I run your command:
It should do the job. But you can also use what I have now:
[core]
pager = delta --side-by-side -w ${FZF_PREVIEW_COLUMNS:-$COLUMNS}
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
[pager]
log = delta --side-by-side -w ${FZF_PREVIEW_COLUMNS:-$COLUMNS}
reflog = delta --side-by-side -w ${FZF_PREVIEW_COLUMNS:-$COLUMNS}
show = delta --side-by-side -w ${FZF_PREVIEW_COLUMNS:-$COLUMNS}
; diff = delta --side-by-side --width ${FZF_PREVIEW_COLUMNS:-$COLUMNS} ;; this override core.pager
[interactive]
diffFilter = delta --color-only
[delta]
features = line-numbers decorations collared-trogon
whitespace-error-style = 22 reverse
side-by-side = true
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
Isn't my code still not working as expected though?
Another thing to check, did you have fzf installed?
https://github.com/junegunn/fzf
It seems to be working pretty well 😄 however it isn't returning all of the matches. I have attached a video with the word require
as an example.
Please Note:
My video is way too long you only need to see that it only returns three results.
2023-01-12.20-44-12.mp4
it looks to me that your fd
does not list all files
what is the output if you run following command in your nvim command line input
!fd
also you can change the sad setup:
ls_file = 'fd',
option to
ls_file = 'git ls-file',
to see if it makes any difference.
essentially, the plugin is trying to run
fd | sad 'from-string' 'to-string'
for you, so you can run the above command in your terminal emulator.
-
When I write
!fd
it seems to write every possible file path. -
When I try to use
git ls-file
it doesen't work did you meangit ls-files
? That seems to have the same problem of not listing all the instances of matching. As require obviously turns up more than 3 times in my code.
Thank you again for helping me so much I really appreciate it
I think I figured it out:
Worth watching the whole thing with audio on
4github.mp4
Thanks for sharing the videos. It makes sense.
In your previous video, you are doing this:
Sad 'require' 'require'
In fact all require
in your init.lua
will NOT be replaced. So you do not need to select and confirm the replacement in init.lua
, so the file list will not show in the pop-up windows.
If you are replacing string with e.g.
Sad 'require' 'REQUIRE'
as the init.lua will be modified so it will be shown in your pop-up windows.
Awesome, It works better than vs codes find and replace LOL. Thanks again for all your help I really appreciate it. Happy coding!