tcsh support

Adds basic supported for tcsh in response to
https://github.com/banga/powerline-shell/issues/299
This commit is contained in:
Buck Ryan 2017-10-05 13:44:28 -04:00
parent 365a6d9a02
commit 51e5dd14c2
4 changed files with 17 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# A Powerline style prompt for your shell
A [Powerline](https://github.com/Lokaltog/vim-powerline) like prompt for Bash,
ZSH and Fish:
ZSH, Fish, and tcsh:
![MacVim+Solarized+Powerline+CtrlP](https://raw.github.com/banga/powerline-shell/master/bash-powerline-screenshot.png)
@ -132,6 +132,14 @@ function fish_prompt
end
```
### tcsh
Add the following to your `.tcshrc`:
```
alias precmd 'set prompt="`powerline-shell --shell tcsh $?`"'
```
## Customization
### Config File

View file

@ -63,7 +63,8 @@ class Powerline(object):
}
color_templates = {
'bash': '\\[\\e%s\\]',
'bash': r'\[\e%s\]',
'tcsh': r'%%{\e%s%%}',
'zsh': '%%{%s%%}',
'bare': '%s',
}
@ -159,7 +160,7 @@ def main():
help='Generate the default config and print it to stdout')
arg_parser.add_argument('--shell', action='store', default='bash',
help='Set this to your shell type',
choices=['bash', 'zsh', 'bare'])
choices=['bash', 'tcsh', 'zsh', 'bare'])
arg_parser.add_argument('prev_error', nargs='?', type=int, default=0,
help='Error code returned by the last command')
args = arg_parser.parse_args()

View file

@ -1,8 +1,11 @@
from ..utils import BasicSegment
from ..utils import BasicSegment, warn
class Segment(BasicSegment):
def add_to_powerline(self):
if self.powerline.args.shell == "tcsh":
warn("newline segment not supported for tcsh (yet?)")
return
self.powerline.append("\n",
self.powerline.theme.RESET,
self.powerline.theme.RESET,

View file

@ -6,6 +6,7 @@ class Segment(BasicSegment):
powerline = self.powerline
root_indicators = {
'bash': ' \\$ ',
'tcsh': ' %# ',
'zsh': ' %# ',
'bare': ' $ ',
}