render.py:
bind command line editor to ^E add mouse support to editor add wt-prefix64 add command line history completion dotfiles: fix getlogin bug in some terminals
This commit is contained in:
parent
850d43bf28
commit
5704fafe4d
2 changed files with 19 additions and 4 deletions
|
@ -24,9 +24,10 @@ alias Yall="youtube-dl -o \"%(autonumber)s-%(title)s.%(ext)s\""
|
||||||
alias units="units -v"
|
alias units="units -v"
|
||||||
|
|
||||||
# Edit the current command line in $EDITOR
|
# Edit the current command line in $EDITOR
|
||||||
|
export VISUAL="nano -m" # enable mouse cursor
|
||||||
autoload -U edit-command-line
|
autoload -U edit-command-line
|
||||||
zle -N edit-command-line
|
zle -N edit-command-line
|
||||||
bindkey '\C-x\C-e' edit-command-line
|
bindkey '\C-e' edit-command-line
|
||||||
|
|
||||||
mkcd () {
|
mkcd () {
|
||||||
mkdir -p "$1" && cd "$1"
|
mkdir -p "$1" && cd "$1"
|
||||||
|
@ -66,8 +67,13 @@ zres () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# winetricks tools
|
# winetricks tools
|
||||||
wt-prefix() {
|
wt-prefix64() {
|
||||||
export WINEPREFIX="$HOME/.local/share/wineprefixes/$1"
|
export WINEPREFIX="$HOME/.local/share/wineprefixes/$1"
|
||||||
|
unset WINEARCH
|
||||||
|
}
|
||||||
|
|
||||||
|
wt-prefix() {
|
||||||
|
wt-prefix64 "$1"
|
||||||
export WINEARCH="win32"
|
export WINEARCH="win32"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +135,8 @@ bindkey "\eOH" beginning-of-line
|
||||||
bindkey "\eOF" end-of-line
|
bindkey "\eOF" end-of-line
|
||||||
bindkey "\eOd" backward-word
|
bindkey "\eOd" backward-word
|
||||||
bindkey "\eOc" forward-word
|
bindkey "\eOc" forward-word
|
||||||
|
bindkey '\e[A' history-beginning-search-backward
|
||||||
|
bindkey '\e[B' history-beginning-search-forward
|
||||||
|
|
||||||
# paludis default options
|
# paludis default options
|
||||||
export CAVE_OPTIONS="--log-level warning"
|
export CAVE_OPTIONS="--log-level warning"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
import pwd
|
||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
@ -45,6 +46,12 @@ MOUNT_IGNORE_DIR = ["/dev", "/proc", "/sys"]
|
||||||
|
|
||||||
GIT_BLACKLIST = ["/var/paludis/repositories"]
|
GIT_BLACKLIST = ["/var/paludis/repositories"]
|
||||||
|
|
||||||
|
def get_username():
|
||||||
|
try:
|
||||||
|
return os.getlogin()
|
||||||
|
except FileNotFoundError:
|
||||||
|
return pwd.getpwuid(os.geteuid())[0]
|
||||||
|
|
||||||
def style_color(fg):
|
def style_color(fg):
|
||||||
return "\033[38;5;%dm" %(fg)
|
return "\033[38;5;%dm" %(fg)
|
||||||
|
|
||||||
|
@ -179,7 +186,7 @@ class LoginPart(Part):
|
||||||
self.fragments.append(style_color(COLOR_USER_USER))
|
self.fragments.append(style_color(COLOR_USER_USER))
|
||||||
|
|
||||||
self.fragments.append(style_bold())
|
self.fragments.append(style_bold())
|
||||||
user = os.getlogin()
|
user = get_username()
|
||||||
self.fragments.append(user)
|
self.fragments.append(user)
|
||||||
self.fragments.append(style_reset())
|
self.fragments.append(style_reset())
|
||||||
|
|
||||||
|
@ -276,7 +283,7 @@ class PathPart(Part):
|
||||||
if path in homes:
|
if path in homes:
|
||||||
self.dirs = []
|
self.dirs = []
|
||||||
|
|
||||||
if homes[path] == os.getlogin():
|
if homes[path] == get_username():
|
||||||
self.dirs.append(Dir(path, "", "~"))
|
self.dirs.append(Dir(path, "", "~"))
|
||||||
else:
|
else:
|
||||||
self.dirs.append(Dir(path, homes[path], "~"))
|
self.dirs.append(Dir(path, homes[path], "~"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue