commit 45b2f4350fdc18f0851537c332721768dea7a853 parent 118e6c7d6065a702038b4c1af9c3daa256a100c3 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Tue, 10 Sep 2019 09:44:59 +0200 Clean up profile and autostart X on tty1 Diffstat:
M | .profile | | | 89 | ++++++++++++++++++++++++++++++++++++------------------------------------------- |
1 file changed, 40 insertions(+), 49 deletions(-)
diff --git a/.profile b/.profile @@ -1,66 +1,57 @@ -# shellcheck source=/dev/null -[ -f ~/.locale ] && . ~/.locale +#!/bin/sh + export EDITOR=vis export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 -export MAILDIR="$HOME/mail" export TERMINAL=st export FILE=nnn export BROWSER=surf-open.sh export BIB="$HOME/articles/own/BIBnew.bib" export SXHKD_SHELL=/bin/sh - -# nnn settings -NNN_BMS="a:$HOME/articles;b:$HOME/books;c:$HOME/code;d:$HOME/doc;g:$HOME/articles/glaciology_sedimentology;m:/mnt;s:$HOME/uni/postdoc/stanford-sigma;t:$HOME/tmp;u:$HOME/uni;v:$HOME/videos" -NNN_PLUG="o:fzf-open;e:fzf-edit;u:upload;m:movie-info;c:copy-selection-to-clipboard" -export NNN_BMS # bookmarks (max 10) -export NNN_PLUG # x-key binds (max 10) -export NNN_USE_EDITOR=1 # always open text files in $EDITOR -export NNN_OPENER="$HOME/.config/nnn/xdg-open" -export NNN_OPENER_DETACH=1 # do not block nnn with file opener -export NNN_NOTE="$HOME/doc/todo.md" - -# shellcheck source=/dev/null -[ -f ~/.secret_env_vars ] && . ~/.secret_env_vars - -#### PATH AND MACHINE SPECIFIC CONFIGS - -[ -d /usr/local/bin ] && export PATH=/usr/local/bin:$PATH -[ -d ~/.local/bin ] && export PATH=~/.local/bin:$PATH -[ -d ~/bin ] && export PATH=~/bin:$PATH - export GOPATH=$HOME/code/golang export PATH=$PATH:$GOPATH/bin - GPG_TTY=$(tty) export GPG_TTY +[ -f ~/.locale ] && . ~/.locale +[ -f ~/.secret_env_vars ] && . ~/.secret_env_vars -if [ -x "$(command -v fzf)" ]; then - - export FZF_DEFAULT_OPTS="--exit-0 --select-1 - --preview '(highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -100' - " - - # fzf can be launched with ctrl-t or alt-c - export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" - export FZF_ALT_C_COMMAND="$FZF_DEFAULT_COMMAND" - - # hide preview for searching history - export FZF_CTRL_R_OPTS="--exit-0 --select-1 --preview-window=up:0" +[ -d /usr/local/bin ] && export PATH=/usr/local/bin:$PATH +[ -d ~/.local/bin ] && export PATH=~/.local/bin:$PATH +[ -d ~/bin ] && export PATH=~/bin:$PATH - # use ripgrep if available - if [ -x "$(command -v rg)" ]; then - # --files: List files that would be searched but do not search - # --no-ignore: Do not respect .gitignore, etc... - # --hidden: Search hidden files and folders - # --follow: Follow symlinks - # --glob: (in this case ignore everything in the .git/ folder) - export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --glob "!.git/*"' +NNN_BMS="a:$HOME/articles" +NNN_BMS+=";b:$HOME/books" +NNN_BMS+=";c:$HOME/code" +NNN_BMS+=";d:$HOME/doc" +NNN_BMS+=";g:$HOME/articles/glaciology_sedimentology" +NNN_BMS+=";m:/mnt" +NNN_BMS+=";s:$HOME/uni/postdoc/stanford-sigma" +NNN_BMS+=";t:$HOME/tmp" +NNN_BMS+=";u:$HOME/uni" +NNN_BMS+=";v:$HOME/videos" +NNN_PLUG="o:fzf-open" +NNN_PLUG+=";e:fzf-edit" +NNN_PLUG+=";u:upload" +NNN_PLUG+=";m:movie-info" +NNN_PLUG+=";c:copy-selection-to-clipboard" +export NNN_BMS # bookmarks (max 10) +export NNN_PLUG # x-key binds (max 10) +export NNN_USE_EDITOR=1 # always open text files in $EDITOR +export NNN_OPENER="$HOME/.config/nnn/xdg-open" +export NNN_OPENER_DETACH=1 # do not block nnn with file opener +export NNN_NOTE="$HOME/doc/todo.md" - # use the_silver_searcher if available - elif [ -x "$(command -v ag)" ]; then - export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -f --nocolor -g ""' - fi +export FZF_DEFAULT_OPTS="--exit-0 --select-1 --preview 'cat {} 2>/dev/null'" +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_CTRL_R_OPTS="--exit-0 --select-1 --preview-window=up:0" +if [ -x "$(command -v rg)" ]; then + export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --glob "!.git/*"' +elif [ -x "$(command -v ag)" ]; then + export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -f --nocolor -g ""' fi -[ -f /etc/pki/tls/certs/ca-bundle.crt ] && export CURL_CA_BUNDLE=/etc/pki/tls/certs/ca-bundle.crt +# start x on tty1 +xsession() { + startx 2>&1 || vlock +} +if tty | grep -q /dev/tty1; then xsession; fi