1:介绍vim
vim是用于Linux下编译代码的工具,具备肯定的补全性能,然而与咱们配置的相比就要差商许多了。在这里、我首先介绍如何配置vimplus(是一款十分好用的vim配置)。之后我再介绍zsh的配置,zsh是一种shell脚本,是咱们和Linux交互的工具。 vimplus的装置只须要执行几个命令就能够,非常简单。 cd ~。 sudo git clone https://github.com/chxuan/vimplus.git ~/.vimplus. cd ~/.vimplus ./install.sh 这样,弱小的vim配置就装置实现了。在这里须要留神的是,如果你没有git这个工具,能够应用sudo apt install git 命令进行装置。如果你的apt源配置谬误,也就是在保障你能够失常连贯网络的状况下不可能下载这个工具,请关上这个链接[https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11vU4mtw]() 这是一个阿里源的地址,点击就能够下载。好了对于vim的配置我这里就介绍这么多。
2:介绍zsh的相干配置。
在这里介绍我的zsh配置,之前说过了,zsh是咱们和Linux交互的命令工具。 首先、第一点须要确定的是你有没有zsh这个工具,如果你没有zsh这个工具请应用sudo apt install zsh进行装置。 第二点就是咱们的zsh配置了,咱们能够在本人的家目录下进行配置,首先咱们创立一个.zshrc这个文件,此文件是咱们这个用户登陆的时候zsh读取的配置文件。 最初一点,我将zsh配置连贯放到这里,间接应用下述命令装置即可。 git clone https://github.com/spicycode/ze-best-zsh-config.git 目录 如果下载下来的是压缩包,请解压,而后将其中的暗藏文件拷贝到家目录下,也就是~目录下。 最初我将我改过的.zshrc文件贴到这里,我改的文件是依据这个下载内容进行更改整合的,因为下载的货色不可能齐全应用。 之后在家目录创立.zshrc文件,将下述内容增加到.zshrc文件中,之后应用命令sourc .zshrc就能够失效了,如果还没有失效的话,请退出Linux从新登录。 if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi export PATH=bin:script:.bin:$PATH precmd() { if [[ -n "$TMUX" ]]; then tmux setenv "$(tmux display -p 'TMUX_PWD_#D')" "$PWD" fi } # 别名局部,这部分依据本人的爱好进行甚至 alias la='ls -a' alias lc='ls *.c' alias sl='ls' alias ll='ls -l' alias grepn='grep -nrE ./' alias findn='find ./ -name' alias rm='rm -i' alias cpr='cp -r' alias rmd='rm -r' alias v.z='vim ~/.zshrc' alias s.z='source ~/.zshrc' # color 局部内容 autoload colors; colors # The variables are wrapped in %{%}. This should be the case for every # variable that does not contain space. for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do eval PR_$COLOR='%{$fg_no_bold[${(L)COLOR}]%}' eval PR_BOLD_$COLOR='%{$fg_bold[${(L)COLOR}]%}' done eval RESET='$reset_color' export PR_RED PR_GREEN PR_YELLOW PR_BLUE PR_WHITE PR_BLACK export PR_BOLD_RED PR_BOLD_GREEN PR_BOLD_YELLOW PR_BOLD_BLUE export PR_BOLD_WHITE PR_BOLD_BLACK # Clear LSCOLORS unset LSCOLORS export CLICOLOR=1 export LS_COLORS=exfxcxdxbxegedabagacad # 绑定某些按键 # To see the key combo you want to use just do: # cat > /dev/null # And press it bindkey "^K" kill-whole-line # ctrl-k bindkey "^R" history-incremental-search-backward # ctrl-r bindkey "^A" beginning-of-line # ctrl-a bindkey "^E" end-of-line # ctrl-e bindkey "[B" history-search-forward # down arrow bindkey "[A" history-search-backward # up arrow bindkey "^D" delete-char # ctrl-d bindkey "^F" forward-char # ctrl-f bindkey "^B" backward-char # ctrl-b bindkey -e # Default to standard emacs bindings, regardless of editor string # 定义某些全局变量 # Currently this path is appendend to dynamically when picking a ruby version export PATH=node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/local/share/npm/bin:~/.cabal/bin:~/.local/bin:$PATH export PATH=$PATH:/opt/boxen/homebrew/opt/go/libexec/bin # Setup terminal, and turn on colors export TERM=xterm-256color export CLICOLOR=1 export LSCOLORS=Gxfxcxdxbxegedabagacad # Enable color in grep export GREP_OPTIONS='--color=auto' export GREP_COLOR='3;33' # This resolves issues install the mysql, postgres, and other gems with native non universal binary extensions export ARCHFLAGS='-arch x86_64' export LESS='--ignore-case --raw-control-chars' export PAGER='most' export EDITOR='vim' export PYTHONPATH=/usr/local/lib/python2.6/site-packages # CTAGS Sorting in VIM/Emacs is better behaved with this in place export LC_COLLATE=C # GitHub token with no scope, used to get around API limits #xport HOMEBREW_GITHUB_API_TOKEN=$(cat ~/.gh_api_token) # setopt 某些选项设置 # ===== Basics # If you type foo, and it isn't a command, and it is a directory in your cdpath, go there setopt AUTO_CD # Allow comments even in interactive shells (especially for Muness) # setopt INTERACTIVE_COMMENTS # ===== History # Allow multiple terminal sessions to all append to one zsh command history setopt APPEND_HISTORY # Add comamnds as they are typed, don't wait until shell exit setopt INC_APPEND_HISTORY # Do not write events to history that are duplicates of previous events setopt HIST_IGNORE_DUPS # When searching history don't display results already cycled through twice setopt HIST_FIND_NO_DUPS # Remove extra blanks from each command line being added to history setopt HIST_REDUCE_BLANKS # Include more information about when the command was executed, etc setopt EXTENDED_HISTORY # ===== Completion # Allow completion from within a word/phrase setopt COMPLETE_IN_WORD # When completing from the middle of a word, move the cursor to the end of the word setopt ALWAYS_TO_END # ===== Prompt # Enable parameter expansion, command substitution, and arithmetic expansion in the prompt setopt PROMPT_SUBST unsetopt MENU_COMPLETE setopt AUTO_MENU # 历史设置 HISTSIZE=10000 SAVEHIST=10000 HISTFILE=~/.zsh_history bindkey '^R' zaw-history function git_prompt_info { local ref=$(=git symbolic-ref HEAD 2> /dev/null) local gitst="$(=git status 2> /dev/null)" if [[ -f .git/MERGE_HEAD ]]; then if [[ ${gitst} =~ "unmerged" ]]; then gitstatus=" %{$fg[red]%}unmerged%{$reset_color%}" else gitstatus=" %{$fg[green]%}merged%{$reset_color%}" fi elif [[ ${gitst} =~ "Changes to be committed" ]]; then gitstatus=" %{$fg[blue]%}!%{$reset_color%}" elif [[ ${gitst} =~ "use \"git add" ]]; then gitstatus=" %{$fg[red]%}!%{$reset_color%}" elif [[ -n `git checkout HEAD 2> /dev/null | grep ahead` ]]; then gitstatus=" %{$fg[yellow]%}*%{$reset_color%}" else gitstatus='' fi if [[ -n $ref ]]; then echo "%{$fg_bold[green]%}/${ref#refs/heads/}%{$reset_color%}$gitstatus" fi } PROMPT='%~%<< $(git_prompt_info)${PR_BOLD_WHITE}>%{${reset_color}%} ' precmd() { if [[ -n "$TMUX" ]]; then tmux setenv "$(tmux display -p 'TMUX_PWD_#D')" "$PWD" fi }
本文由博客群发一文多发等经营工具平台 OpenWrite 公布