aliases/editor: split out editor shortcuts

pull/2095/head
John D Pell 2022-02-17 21:52:47 -08:00 committed by John D Pell
parent f36793bf2b
commit 18e27b7b84
4 changed files with 20 additions and 11 deletions

View File

@ -0,0 +1,14 @@
# shellcheck shell=bash
about-alias 'shortcuts for editing'
alias edit='${EDITOR:-${ALTERNATE_EDITOR:-nano}}'
alias e='edit'
# sudo editors
alias svim='sudo ${VISUAL:-vim}'
alias snano='sudo ${ALTERNATE_EDITOR:-nano}'
alias sedit='sudo ${EDITOR:-${ALTERNATE_EDITOR:-nano}}'
# Shortcuts to edit startup files
alias vbrc='${VISUAL:-vim} ~/.bashrc'
alias vbpf='${VISUAL:-vim} ~/.bash_profile'

View File

@ -4,10 +4,6 @@ about-alias 'general aliases'
alias _='sudo' alias _='sudo'
# Shortcuts to edit startup files
alias vbrc='"${VISUAL:-vim}" ~/.bashrc'
alias vbpf='"${VISUAL:-vim}" ~/.bash_profile'
# colored grep # colored grep
# Need to check an existing file for a pattern that will be found to ensure # Need to check an existing file for a pattern that will be found to ensure
# that the check works when on an OS that supports the color option # that the check works when on an OS that supports the color option
@ -22,7 +18,6 @@ fi
alias c='clear' alias c='clear'
alias cls='clear' alias cls='clear'
alias edit='${EDITOR:-${ALTERNATE_EDITOR?}}'
alias pager='${PAGER:-less}' alias pager='${PAGER:-less}'
alias q='exit' alias q='exit'
@ -50,10 +45,6 @@ fi
# Shorten extract # Shorten extract
alias xt='extract' alias xt='extract'
# sudo editors
alias svim='sudo "${VISUAL:-vim}"'
alias snano='sudo "${ALTERNATE_EDITOR:-nano}"'
# Display whatever file is regular file or folder # Display whatever file is regular file or folder
function catt() { function catt() {
for i in "$@"; do for i in "$@"; do
@ -73,3 +64,4 @@ function catt() {
# bash-it enable alias bash-it # bash-it enable alias bash-it
source "$BASH_IT/aliases/available/bash-it.aliases.bash" source "$BASH_IT/aliases/available/bash-it.aliases.bash"
source "$BASH_IT/aliases/available/directory.aliases.bash" source "$BASH_IT/aliases/available/directory.aliases.bash"
source "$BASH_IT/aliases/available/editor.aliases.bash"

View File

@ -1,9 +1,11 @@
# shellcheck shell=bash # shellcheck shell=bash
about-alias 'vim abbreviations' about-alias 'vim abbreviations'
_command_exists vim || return alias v='${VISUAL:-vim}'
alias v='vim' if ! _command_exists vim; then
_log_warning "Without 'vim', these aliases just aren't that useful..."
fi
# open the vim help in fullscreen incorporated from # open the vim help in fullscreen incorporated from
# https://stackoverflow.com/a/4687513 # https://stackoverflow.com/a/4687513
alias vimh='vim -c ":h | only"' alias vimh='vim -c ":h | only"'

View File

@ -12,3 +12,4 @@ completion system
aliases general aliases general
aliases bash-it aliases bash-it
aliases directory aliases directory
aliases editor