Add: automatic configuration script
This commit is contained in:
24
auto/auto.sh
Executable file
24
auto/auto.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
cd bash
|
||||
./bash.sh
|
||||
cd ..
|
||||
|
||||
cd git
|
||||
./git.sh
|
||||
cd ..
|
||||
|
||||
cd ssh
|
||||
./ssh.sh
|
||||
cd ..
|
||||
|
||||
cd vim
|
||||
./vim.sh
|
||||
cd ..
|
||||
|
||||
cd gnome
|
||||
./gnome.sh
|
||||
cd ..
|
||||
|
||||
cd home-chmod
|
||||
./home-chmod.sh
|
||||
cd ..
|
||||
43
auto/bash/.bashrc.append
Normal file
43
auto/bash/.bashrc.append
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
# custom
|
||||
|
||||
umask 007
|
||||
|
||||
export EDITOR='vim'
|
||||
export VISUAL='vim'
|
||||
|
||||
# cool colored command prompt
|
||||
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\e[01;38;5;11m\]\u\[\e[00;38;5;208m\]@\[\e[01;38;5;27m\]\h\[\e[00m\]:\[\e[00;38;5;45m\]\w\[\e[0m\]\$ '
|
||||
PROMPT_DIRTRIM=3
|
||||
|
||||
alias ls='ls --color'
|
||||
|
||||
# Shows a oneline preview of all files under the folder after changing directory.
|
||||
|
||||
cd() {
|
||||
builtin cd "$@" && ls -v -w $COLUMNS --color=always --format=commas --group-directories-first | head -n 1
|
||||
}
|
||||
|
||||
pushd() {
|
||||
builtin pushd "$@"
|
||||
cd .
|
||||
}
|
||||
|
||||
popd() {
|
||||
builtin popd "$@"
|
||||
cd .
|
||||
}
|
||||
|
||||
if [ -z "$TMUX" ] && [ -n "$SSH_TTY" ]; then
|
||||
tput sc
|
||||
tput smso
|
||||
echo -n 'tmux: space - shell: any key'
|
||||
tput sgr0
|
||||
read -rsN1 input
|
||||
tput rc
|
||||
tput el
|
||||
if [ "$input" = ' ' ]; then
|
||||
tmux new -As default
|
||||
fi
|
||||
fi
|
||||
2
auto/bash/bash.sh
Executable file
2
auto/bash/bash.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
cat .bashrc.append >> ~/.bashrc
|
||||
11
auto/git/git.sh
Executable file
11
auto/git/git.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
git config --global alias.logtree 'log --graph --oneline --decorate --all'
|
||||
git config --global alias.tree 'log --graph --oneline --decorate'
|
||||
git config --global commit.gpgSign true
|
||||
git config --global core.pager 'less -x1,5'
|
||||
git config --global core.quotePath false
|
||||
git config --global credential.helper 'cache --timeout=7200'
|
||||
git config --global init.defaultBranch main
|
||||
git config --global pull.ff only
|
||||
git config --global rerere.enabled true
|
||||
git config --global tag.gpgSign true
|
||||
3
auto/gnome/gnome.sh
Executable file
3
auto/gnome/gnome.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
gsettings set org.gnome.desktop.wm.keybindings switch-group "['<Super>Above_Tab']"
|
||||
gsettings set org.gnome.desktop.wm.keybindings switch-group-backward "['<Shift><Super>Above_Tab']"
|
||||
2
auto/home-chmod/home-chmod.sh
Executable file
2
auto/home-chmod/home-chmod.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
chmod o-rwx -R ~
|
||||
2
auto/readline/.inputrc
Normal file
2
auto/readline/.inputrc
Normal file
@@ -0,0 +1,2 @@
|
||||
$include /etc/inputrc
|
||||
"\e[Z": menu-complete
|
||||
2
auto/readline/readline.sh
Executable file
2
auto/readline/readline.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
cp -i .inputrc ~
|
||||
2
auto/ssh/authorized_keys
Normal file
2
auto/ssh/authorized_keys
Normal file
@@ -0,0 +1,2 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPclu8pJC3f2MGIx/8cS/ssl7KnJB/tfmUpFRdtM7TAU DuckDuckWhale
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ+TiOFdNZVEgF0dU82CJfa9KlVNMJsgnPX0RItfNnIZ DuckDUckWhale Phone
|
||||
3
auto/ssh/config
Normal file
3
auto/ssh/config
Normal file
@@ -0,0 +1,3 @@
|
||||
Host *
|
||||
ForwardX11Trusted no
|
||||
IdentitiesOnly yes
|
||||
5
auto/ssh/ssh.sh
Executable file
5
auto/ssh/ssh.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
cp -i authorized_keys config ~/.ssh/
|
||||
chmod 600 ~/.ssh/authorized_keys ~/.ssh/config
|
||||
31
auto/tmux/.tmux.conf
Normal file
31
auto/tmux/.tmux.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
set -g clock-mode-style 12
|
||||
set -g default-command "${SHELL}"
|
||||
set -g default-terminal "xterm-256color"
|
||||
set -g history-limit 5000
|
||||
set -g prefix C-q
|
||||
set -sg escape-time 25
|
||||
set -wg mode-keys vi
|
||||
set -wg mouse on
|
||||
|
||||
unbind Up
|
||||
unbind Down
|
||||
unbind Left
|
||||
unbind Right
|
||||
|
||||
bind C-q send-prefix
|
||||
bind S set status
|
||||
bind r source-file ~/.tmux.conf \; display "Reloaded tmux config."
|
||||
bind s setw synchronize-panes
|
||||
|
||||
bind h split-window -h
|
||||
bind v split-window -v
|
||||
bind H split-window -f -h
|
||||
bind V split-window -f -v
|
||||
|
||||
bind -r C-h select-pane -L
|
||||
bind -r C-j select-pane -D
|
||||
bind -r C-k select-pane -U
|
||||
bind -r C-l select-pane -R
|
||||
|
||||
bind -r Left swap-window -dt -1
|
||||
bind -r Right swap-window -dt +1
|
||||
2
auto/tmux/tmux.sh
Executable file
2
auto/tmux/tmux.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
cp -i .tmux.conf ~
|
||||
86
auto/vim/.vimrc
Normal file
86
auto/vim/.vimrc
Normal file
@@ -0,0 +1,86 @@
|
||||
" vim-plug
|
||||
call plug#begin()
|
||||
Plug 'chriskempson/base16-vim'
|
||||
Plug 'dhruvasagar/vim-table-mode'
|
||||
call plug#end()
|
||||
|
||||
colorscheme base16-default-dark
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
|
||||
autocmd CmdwinEnter * noremap <buffer> <CR> <CR>
|
||||
autocmd FileType rust,c,cpp,java,python,sh,tex set noexpandtab colorcolumn=101 textwidth=100
|
||||
autocmd FileType markdown set noexpandtab colorcolumn=81 textwidth=80
|
||||
autocmd FileType markdown,tex set ai spell
|
||||
|
||||
set encoding=utf-8
|
||||
set termencoding=utf-8
|
||||
set fileencodings=ucs-bom,utf-8,chinese
|
||||
|
||||
let mapleader=" "
|
||||
nnoremap <space> <nop>
|
||||
nnoremap Y y$
|
||||
nnoremap <CR> :
|
||||
vnoremap <CR> :
|
||||
|
||||
nnoremap <silent> <leader>f 1z=
|
||||
nnoremap <silent> <leader>h :noh<CR>:echo "Stopped search highlighting."<CR>
|
||||
nnoremap <silent> <leader>i :call ToggleIntuitiveLineMovement()<CR>
|
||||
nnoremap <silent> <leader>l :set list!<CR>
|
||||
nnoremap <silent> <leader>q gwap
|
||||
nnoremap <silent> <leader>r :set relativenumber!<CR>
|
||||
nnoremap <silent> <leader>s :call ToggleSpellCheck()<CR>
|
||||
nnoremap <silent> <leader>w :update<CR>
|
||||
|
||||
set backspace=indent,eol,start " powerful backspace
|
||||
set complete+=kspell " dictionary completion
|
||||
set cpo+=J " sentences are separated by two spaces
|
||||
set display=lastline " show as much as possible when it doesn't fit
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set listchars=eol:$,tab:>-,trail:·
|
||||
set mouse=a
|
||||
set number
|
||||
set relativenumber
|
||||
set showcmd
|
||||
set spelllang=en_us,cjk
|
||||
|
||||
hi Normal ctermfg=white ctermbg=none
|
||||
hi Search ctermfg=yellow ctermbg=black
|
||||
hi IncSearch ctermfg=black ctermbg=yellow
|
||||
hi LineNr ctermfg=10 ctermbg=0
|
||||
hi CursorLineNr ctermfg=12 ctermbg=0
|
||||
hi Visual ctermfg=16 ctermbg=yellow
|
||||
|
||||
hi Pmenu ctermfg=NONE ctermbg=236
|
||||
hi PmenuSel ctermfg=0 ctermbg=10
|
||||
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
|
||||
set timeout ttimeoutlen=25
|
||||
|
||||
function! ToggleSpellCheck()
|
||||
set spell!
|
||||
if &spell
|
||||
echo "Spell check is now on."
|
||||
else
|
||||
echo "Spell check is now off."
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ToggleIntuitiveLineMovement()
|
||||
if mapcheck("jk")==""
|
||||
echo "Intuitive line movement is now on."
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
inoremap <down> <C-o>gj
|
||||
inoremap <up> <C-o>gk
|
||||
else
|
||||
echo "Intuitive line movement is now off."
|
||||
nunmap j
|
||||
nunmap k
|
||||
iunmap <down>
|
||||
iunmap <up>
|
||||
endif
|
||||
endfunction
|
||||
4
auto/vim/vim.sh
Executable file
4
auto/vim/vim.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
cp -i .vimrc ~
|
||||
curl -Lo ~/.vim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
Reference in New Issue
Block a user