Closed Froziph closed 9 years ago
I made Athame more configurable so that people can use it with powerline/whatever else they want.
I created a proof-of-concept powerline setup that shows that it works. It's just a patch to the powerline config rather than an actual powerline module, because right now I'm more interested in making sure that it is possible for Athame to be configured than maintaining specific configurations for it.
To try it out:
1) Add export ATHAME_SHOW_MODE=0
to your ~/.zshrc (This will hide the mode at the bottom of the screen)
2) Patch the default powerline config:
diff --git a/powerline/config_files/colorschemes/shell/default.json b/powerline/config_files/colorschemes/shell/default.json
index 1126feb..50d35cb 100644
--- a/powerline/config_files/colorschemes/shell/default.json
+++ b/powerline/config_files/colorschemes/shell/default.json
@@ -4,7 +4,11 @@
"hostname": { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] },
"environment": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
"mode": { "fg": "darkestgreen", "bg": "brightgreen", "attrs": ["bold"] },
- "attached_clients": { "fg": "white", "bg": "darkestgreen", "attrs": [] }
+ "attached_clients": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
+ "athame_mode_INSERT": { "fg": "darkestcyan", "bg": "white", "attrs": ["bold"] },
+ "athame_mode_NORMAL": { "fg": "darkestgreen", "bg": "brightgreen", "attrs": ["bold"] },
+ "athame_mode_VISUAL": { "fg": "darkorange", "bg": "brightestorange", "attrs": ["bold"] },
+ "athame_mode_REPLACE": { "fg": "white", "bg": "brightred", "attrs": ["bold"] }
},
"mode_translations": {
"vicmd": {
diff --git a/powerline/segments/shell.py b/powerline/segments/shell.py
index 57847e4..9f36b08 100644
--- a/powerline/segments/shell.py
+++ b/powerline/segments/shell.py
@@ -65,6 +65,9 @@ def mode(pl, segment_info, override={'vicmd': 'COMMND', 'viins': 'INSERT'}, defa
``$POWERLINE_DEFAULT_MODE`` variable. This variable is set by zsh
bindings for any mode that does not start from ``vi``.
'''
+ mode = segment_info['environ'].get('ATHAME_VIM_MODE', None)
+ if mode:
+ return [{'contents':mode, 'highlight_groups': ['athame_mode_%s' % mode.split(" ")[0], 'mode']}]
mode = segment_info.get('mode', None)
if not mode:
pl.debug('No mode specified')
Actually, you might need export ATHME_SHOW_MODE=0
in your ~/.zshrc. You don't need the export for bash, but it looks like you do for zsh.
I haven't tried this yet, as the "blinking" issue keeps me from using athame fulltime and since i dont use it (yet), i didnt want to fuck up my current zsh theme settings.
This isn't an athame issue, but i'm a bit of a git noob here, i basically use it as SVN.
How exactly do i patch this in :P? I know where the mentioned files are located, but thats it :P.. Or does this just show the diff and i manually put this stuff in?
git apply. You can also use patch.
Unfortunately this doesn't work, it does add something saying INSERT
of NORMAL
, but it adds it to the shell prompt, which is not updated as we switch mode. I've tried to add the ATHAME_VIM_MODE to the tmux-themepack to no avail, every other env variable gets displayed but not the athame one. I'm trying to add it to the original powerline for tmux, but I'm struggling a bit. @ardagnir if you want to have a look at the tmux files in the segments and colorschemes of the powerline config I'd be grateful to have some insight, given that you did it with the shell :)
Zsh can update the shell prompt when switching modes (you can see it in the gif in the readme), though there’s a chance I broke this somehow in a new version. I don’t think bash allows this. If you’re using zsh and having problems, you might be able to look at when powerline updates the mode for zsh’s built in vi-mode and have it use the athame env var instead.
Tmux probably can’t see athame’s env var because it’s set at the shell level, not the tmux level. Not sure how to fix that.
It would be awesome if the mode of athame would work with the ZSH powerline theme. Currently it doesn't change depending on mode at all, i believe. And it is just the "Arrow" way of showing things. (User, Host, Git-status, time etc). If it would work like in Vim, where it changes color (and INSERT/NORMAL upfront the bar), it would be awesome!
I might try to look into this myself if i manage to find the time as i am pretty swarmed, not sure i'l be able to figure it out though.
https://github.com/powerline/powerline
tl;dr Athame meets ZSH meets Powerline == Awesomeness!