Git Product home page Git Product logo

Comments (8)

sayanarijit avatar sayanarijit commented on June 5, 2024 1

Hi, you can easily overwrite the default config. See https://xplr.dev/en/configuration

xplr.config.modes.builtin.action.key_bindings.on_key["!"].messages = {
  { Call = { command = "zsh", args = { "-i" } } },
  "ExplorePwdAsync",
  "PopMode",
}

from xplr.

Creator54 avatar Creator54 commented on June 5, 2024 1

Hi, you can easily overwrite the default config. See https://xplr.dev/en/configuration

xplr.config.modes.builtin.action.key_bindings.on_key["!"].messages = {
  { Call = { command = "zsh", args = { "-i" } } },
  "ExplorePwdAsync",
  "PopMode",
}

thanks, I am currently using this. However wouldn't it be better if xplr read the $SHELL and used it by default and have the option like here to change if anyone wanted ?

from xplr.

sayanarijit avatar sayanarijit commented on June 5, 2024

I guess that's the expected behavior. However, I believe a lot of zsh users (like me) are using oh-my-zsh and there's an issue that require some workaround to get xplr play nicely with it.

Though unrelated to xplr and zsh, I thought it'd be better if we solve this issue first before defaulting to $SHELL. Feel free share your thoughts.

from xplr.

Creator54 avatar Creator54 commented on June 5, 2024

I guess that's the expected behavior. However, I believe a lot of zsh users (like me) are using oh-my-zsh and there's an issue that require some workaround to get xplr play nicely with it.

Though unrelated to xplr and zsh, I thought it'd be better if we solve this issue first before defaulting to $SHELL. Feel free share your thoughts.

Yup tried zsh same for me too, hope it gets fixed soon.

from xplr.

SaphiraKai avatar SaphiraKai commented on June 5, 2024

In my opinion, completely ignoring the user's default shell setting just to prevent one edge case with one shell is too broad.

As a much less heavy-handed workaround, you could check for the existence of $HOME/.oh-my-zsh/ and override to bash if it's found.

from xplr.

SaphiraKai avatar SaphiraKai commented on June 5, 2024

Here's a simple implementation of that I whacked together:

--- init.lua
+++ auto-shell-init.lua
@@ -1828,4 +1828,19 @@
 }
 
+-- Workaround https://github.com/ohmyzsh/ohmyzsh/issues/9859
+local function has_ohmyzsh()
+  local path = os.getenv("HOME").."/.oh-my-zsh"
+  local ok, err, code = os.rename(path, path)
+  if not ok then if code == 13 then return true end end
+  return ok, err
+end
+
+local function shell()
+  local shell = os.getenv("SHELL")
+  if shell == "/bin/zsh" and has_ohmyzsh() then
+    return "bash" else return shell
+  end
+end
+
 -- The builtin action mode.
 --
@@ -1839,5 +1854,5 @@
         messages = {
           "PopMode",
-          { Call0 = { command = "bash", args = { "-i" } } },
+          { Call0 = { command = shell(), args = { "-i" } } },
           "ExplorePwdAsync",
         },

When the issue is resolved, both functions can be deleted and the call to shell() can be replaced with os.getenv("SHELL").

from xplr.

sayanarijit avatar sayanarijit commented on June 5, 2024

In my opinion, completely ignoring the user's default shell setting just to prevent one edge case with one shell is too broad.

Good point.

As a much less heavy-handed workaround, you could check for the existence of $HOME/.oh-my-zsh/ and override to bash if it's found.

I wouldn't, because workarounds like this often lead to hacky and unmaintainable code. For e.g. imagine fish, nushell, etc. and countless other shells require workarounds like this too. Since bash is a dependency for xplr, and it is heavily tested, defaulting to bash seemed like a safer option.

However, I think we should try defaulting to $SHELL and see what happens. Maybe users facing this issue will come up with a good solution that we've been missing.

from xplr.

SaphiraKai avatar SaphiraKai commented on June 5, 2024

Sounds like a good idea to me, crowd-sourcing ideas and implementations is one of the main benefits of open-source, after all.

from xplr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.