个人配置
常用配置
- .bashrc配置 (PS1变量的\w小写为全路径)
function git_branch {
branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
if [ "${branch}" != "" ];then
if [ "${branch}" = "(no branch)" ];then
branch="(`git rev-parse --short HEAD`...)"
fi
echo " ($branch)"
fi
}
export PS1='\u@\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ '
- 其它配置
#!/bin/sh
echo "export GREP_OPTIONS='--color=auto' GREP_COLOR='31'" >> ~/.bashrc
echo "export LANG='en_US.UTF-8'" >> ~/.bashrc
if [ ! -f ~/.vimrc ]; then
touch ~/.vimrc
fi
cat >> ~/.vimrc << EOF
set nu
set autoindent
set tabstop=4
set shiftwidth=4
set history=10000
set encoding=utf-8
set background=dark
set showcmd
set cursorline
set expandtab
set showmatch
set nocompatible
set cindent
set smartindent
set ai!
filetype on
filetype indent on
syntax on
syntax enable
set magic
set ruler
set hlsearch
set ignorecase
set title
set completeopt=longest,menu
set laststatus=2
" 保存时自动删除行尾多余的空白字符
function! RemoveTrailingSpace()
if $VIM_HATE_SPACE_ERRORS != '0'
normal m`
silent! :%s/\s\+$//e
normal ``
endif
endfunction
autocmd BufWritePre * nested call RemoveTrailingSpace()
" 修复不一致的换行符,统一采用 Unix 换行符(\n)
function! FixInconsistFileFormat()
if &fileformat == 'unix'
silent! :%s/\r$//e
endif
endfunction
autocmd BufWritePre * nested call FixInconsistFileFormat()
EOF
cat > ~/.ssh/config << EOF
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOF
cat > ~/.gitconfig << EOF
[user]
name = haochenglin
email = haochenglin@tencent.com
[core]
editor = vim
autocrlf = input
safecrlf = warn
[pull]
rebase = true
[fetch]
prune = true
[diff]
colorMoved = zebra
tool = vimdiff
submodule = log
[difftool]
prompt = false
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset'
lp = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset'
myswitch = "!bash -c 'changes=$(git status -uno -s); if [[ -z $changes ]];then git switch $0 $@; else git status; fi'"
[url "ssh://linhaocheng@git.byted.org/"]
insteadOf = https://git.byted.org/
[url "git@code.byted.org:"]
insteadOf = https://code.byted.org/
EOF
vscode
打开设置( ctrl + , )
files.trimTrailingWhitespace
files.insertFinalNewline
files.autoGuessEncoding
本地扩展:
Remote - SSH
Remote - SSH: Editing Configuration Files
Markdown All in One
Markdown Preview
Paste Image
远程扩展:
C/C++
C++ Intellisense
vscode-proto3
Local History
GitLens
Git Graph
诸神对凡人心生艳羡,厌倦天堂。