Comments (4)
Try to cut empty line here:
xontrib-prompt-starship/xontrib/prompt_starship.py
Lines 11 to 16 in 00e7c8b
i.e. "Using starship cross-shell prompt to rendering right sections" in xontrib-prompt-bar
from xontrib-prompt-starship.
Oh so simple, thanks!
I came up with a naive solution:
_FIRST_PROMPT = True
def _starship_prompt(cfg=None):
global _FIRST_PROMPT
with __xonsh__.env.swap({'STARSHIP_CONFIG': cfg} if cfg else {}):
prompt = __xonsh__.subproc_captured_stdout([
'starship', 'prompt',
'--status', str(int( __xonsh__.history[-1].rtn)) if len(__xonsh__.history) > 0 else '0',
'--cmd-duration' , str(int((__xonsh__.history[-1].ts[1] - __xonsh__.history[-1].ts[0])*1000)) if len(__xonsh__.history) > 0 else '0',
'--jobs', str(len(__xonsh__.all_jobs))
])
if _FIRST_PROMPT:
_FIRST_PROMPT = False
return prompt.lstrip()
return prompt
Works fine unless the screen is cleared (Ctrl + L). Is there a way how to detect execution of the clear
command, so I could add one more condition for the left strip?
Thanks!
from xontrib-prompt-starship.
I think you're using prompt toolkit for $SHELL
and the first way is to search there.
from xontrib-prompt-starship.
Hmm, I didn't even know that prompt toolkit provides shell functionality, because I don't have any experience with this library. Is it possible to access ptk
's API somehow from the prompt_starship.py
file please?
from xontrib-prompt-starship.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xontrib-prompt-starship.