From 44bef82d301a1e5a0464e0fd820656a752fdb7c0 Mon Sep 17 00:00:00 2001 From: DuckDuckWhale Date: Mon, 28 Sep 2020 06:45:49 +0000 Subject: [PATCH] Initial commit --- README.md | 3 ++ bash/.bashrc.append | 31 +++++++++++++++++ git/git.sh | 2 ++ permissions.sh | 1 + readline/.inputrc | 2 ++ tmux/.tmux.conf | 30 ++++++++++++++++ vim/.vimrc | 84 +++++++++++++++++++++++++++++++++++++++++++++ vim/vim-plug.sh | 3 ++ 8 files changed, 156 insertions(+) create mode 100644 README.md create mode 100644 bash/.bashrc.append create mode 100755 git/git.sh create mode 100755 permissions.sh create mode 100644 readline/.inputrc create mode 100644 tmux/.tmux.conf create mode 100644 vim/.vimrc create mode 100755 vim/vim-plug.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..c432133 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# linux-config + +My collection of useful Linux configuration files. diff --git a/bash/.bashrc.append b/bash/.bashrc.append new file mode 100644 index 0000000..a514255 --- /dev/null +++ b/bash/.bashrc.append @@ -0,0 +1,31 @@ + +# customized + +umask 077 + +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\]\$ ' + +# 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" ] && [ "$PWD" == ~ ]; then + tmux new -As default +fi diff --git a/git/git.sh b/git/git.sh new file mode 100755 index 0000000..1f87212 --- /dev/null +++ b/git/git.sh @@ -0,0 +1,2 @@ +git config --global alias.logtree 'log --all --graph --oneline --decorate' +git config --global core.pager 'less -x1,5' diff --git a/permissions.sh b/permissions.sh new file mode 100755 index 0000000..2f24031 --- /dev/null +++ b/permissions.sh @@ -0,0 +1 @@ +chmod go-rwx -R ~ diff --git a/readline/.inputrc b/readline/.inputrc new file mode 100644 index 0000000..4f722a6 --- /dev/null +++ b/readline/.inputrc @@ -0,0 +1,2 @@ +$include /etc/inputrc +"\e[Z": menu-complete diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf new file mode 100644 index 0000000..5668f8f --- /dev/null +++ b/tmux/.tmux.conf @@ -0,0 +1,30 @@ +set -g default-terminal "xterm-256color" +set-window-option -g mode-keys vi +set -g prefix C-q +setw -g mouse on +set -g clock-mode-style 12 + +set-option -g history-limit 5000 +set -sg escape-time 25 + +unbind Up +unbind Down +unbind Left +unbind Right + +bind C-q send-prefix +bind S set status +# Reload with ctrl-r +bind r source-file ~/.tmux.conf \; display "Reloaded tmux config." +bind s setw synchronize-panes + +bind _ split-window -v +bind | split-window -h + +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 diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000..a979aa2 --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,84 @@ +" vim-plug +call plug#begin() +Plug 'chriskempson/base16-vim' +call plug#end() + +colorscheme base16-default-dark +filetype plugin indent on +syntax on + +autocmd CmdwinEnter * noremap +autocmd FileType c,java set colorcolumn=81 textwidth=80 +autocmd FileType markdown set ai spell colorcolumn=81 textwidth=80 +autocmd FileType rust set noexpandtab + +set encoding=utf-8 +set termencoding=utf-8 +set fileencodings=ucs-bom,utf-8,chinese + +let mapleader=" " +nnoremap +nnoremap Y y$ +nnoremap : +vnoremap : + +nnoremap f 1z= +nnoremap h :noh:echo "Stopped search highlighting." +nnoremap i :call ToggleIntuitiveLineMovement() +nnoremap l :set list! +nnoremap q gwap +nnoremap s :call ToggleSpellCheck() +nnoremap w :update + +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 gj + inoremap gk + else + echo "Intuitive line movement is now off." + nunmap j + nunmap k + iunmap + iunmap + endif +endfunction diff --git a/vim/vim-plug.sh b/vim/vim-plug.sh new file mode 100755 index 0000000..9a81469 --- /dev/null +++ b/vim/vim-plug.sh @@ -0,0 +1,3 @@ +#!/bin/sh +curl -Lo ~/.vim/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim