linux下vim和bash設定檔 源檔案

來源:互聯網
上載者:User

標籤:

1. ~/.vimrc

"去掉討厭的有關vi一致性模式,避免以前版本的一些bug和局限set nocompatibleset autoread            " 檔案修改之後自動載入set completeopt=longest,menu      " 自動完成set history=1000        "記錄曆史的行數set backspace=2         " 設定退格鍵可用,正常處理indent, eol, start等set vb t_vb=            "當vim進行編輯時,如果命令錯誤,會發出警報,該設定去掉警報  filetype on             " 檢測檔案的類型filetype plugin on         " 載入檔案類型外掛程式filetype indent on        " 為特定檔案類型載入相關縮排檔案" 主題,顯示方面set background=dark        "背景使用黑色set showmatch            "設定匹配模式,類似當輸入一個左括弧時會匹配相應的那個右括弧set ruler               " 在狀態行上顯示光線標所在位置的行號和列號set showcmd                " 狀態列顯示目前所執行的指令set number                " 顯示行號syntax on                "文法高亮度顯示set cursorline           " 高亮游標所在的行 set report=0            " 通過使用: commands命令,告訴我們檔案的哪一行被改變過set shortmess=atI       " 啟動的時候不顯示那個援助索馬里兒童的提示set helplang=cn            " 中文" 格式方面"下面兩行在進行編寫代碼時,在格式對起上很有用;"第一行,vim使用自動對起,也就是把當前行的對起格式應用到下一行;"第二行,依據上面的對起格式,智能的選擇對起方式,對於類似C語言編"寫上很有用"set cindent            "(cindent是特別針對 C語言文法自動縮排)set autoindentset smartindentset paste                 " 粘貼時保持格式 set tabstop=4            "第一行設定tab鍵為4個空格set shiftwidth=4           "設定當行之間交錯時使用4個空格set softtabstop=4       " 按退格鍵時可以一次刪掉 4 個空格  set noexpandtab            " 不要用空格代替定位字元"查詢時非常方便,如要尋找book單詞,當輸入到/b時,會自動找到第一"個b開頭的單詞,當輸入到/bo時,會自動找到第一個bo開頭的單詞,依"次類推,進行尋找時,使用此設定會快速找到答案,當你找要匹配的單詞"時,別忘記斷行符號set incsearchset hlsearchset ic                  " ignorecase" 編碼set encoding=utf-8set fileencodings=utf-8,GBK,GB18030,big5set termencoding=utf-8" 可以在buffer的任何地方使用滑鼠(類似office中在工作區雙擊滑鼠定位)set mouse=aset mouse=vset selection=exclusiveset selectmode=mouse,key" 用空格鍵來開關摺疊set foldenableset foldmethod=manualnnoremap  @=((foldclosed(line(‘.‘)) < 0) ? ‘zc‘ : ‘zo‘)"set foldmethod=indent"修改一個檔案後,自動進行備份,備份的檔案名稱為原檔案名稱加"~"尾碼"if has("vms") "注意雙引號要用半形的引號" ""   set nobackup"else"   set backup"endif"set wildmenu        " 增強模式中的命令列自動完成操作"autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete"autocmd FileType python set omnifunc=pythoncomplete#Complete"autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags"autocmd FileType css set omnifunc=csscomplete#CompleteCSS"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags"autocmd FileType java set omnifunc=javacomplete#Complet" TList"let Tlist_Use_LEFT_Window=1"let Tlist_File_Fold_Auto_Close=1"let Tlist_Show_One_File=1"let Tlist_GainFocus_On_ToggleOpen=1"let Tlist_Exit_OnlyWindow=1"let g:winManagerWindowLayout=‘FileExplorer‘"nmap tl :Tlist<cr>"map <space> <ESC><C-g>

2. ~/.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)# for examples# If not running interactively, don‘t do anything[ -z "$PS1" ] && return# don‘t put duplicate lines in the history. See bash(1) for more options# ... or force ignoredups and ignorespaceHISTCONTROL=ignoredups:ignorespace# append to the history file, don‘t overwrite itshopt -s histappend# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)HISTSIZE=1000HISTFILESIZE=2000# check the window size after each command and, if necessary,# update the values of LINES and COLUMNS.shopt -s checkwinsize# make less more friendly for non-text input files, see lesspipe(1)[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"# set variable identifying the chroot you work in (used in the prompt below)if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then    debian_chroot=$(cat /etc/debian_chroot)fi# set a fancy prompt (non-color, unless we know we "want" color)case "$TERM" in    xterm-color) color_prompt=yes;;esac# uncomment for a colored prompt, if the terminal has the capability; turned# off by default to not distract the user: the focus in a terminal window# should be on the output of commands, not on the promptforce_color_prompt=yesif [ -n "$force_color_prompt" ]; then    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then    # We have color support; assume it‘s compliant with Ecma-48    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such    # a case would tend to support setf rather than setaf.)    color_prompt=yes    else    color_prompt=    fifiif [ "$color_prompt" = yes ]; then    PS1=‘${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ‘else    PS1=‘${debian_chroot:+($debian_chroot)}\[email protected]\h:\w\$ ‘fiunset color_prompt force_color_prompt# If this is an xterm set the title to [email protected]:dircase "$TERM" inxterm*|rxvt*)    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\[email protected]\h: \w\a\]$PS1"    ;;*)    ;;esac# enable color support of ls and also add handy aliasesif [ -x /usr/bin/dircolors ]; then    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"    alias ls=‘ls --color=auto‘    #alias dir=‘dir --color=auto‘    #alias vdir=‘vdir --color=auto‘    alias grep=‘grep --color=auto‘    alias fgrep=‘fgrep --color=auto‘    alias egrep=‘egrep --color=auto‘fi# some more ls aliasesalias ll=‘ls -alF‘alias la=‘ls -A‘alias l=‘ls -CF‘alias s=‘sudo shutdown -h 0‘alias m=‘sudo mentohust‘# Add an "alert" alias for long running commands.  Use like so:#   sleep 10; alertalias alert=‘notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e ‘\‘‘s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//‘\‘‘)"‘# Alias definitions.# You may want to put all your additions into a separate file like# ~/.bash_aliases, instead of adding them here directly.# See /usr/share/doc/bash-doc/examples in the bash-doc package.if [ -f ~/.bash_aliases ]; then    . ~/.bash_aliasesfi# enable programmable completion features (you don‘t need to enable# this, if it‘s already enabled in /etc/bash.bashrc and /etc/profile# sources /etc/bash.bashrc).if [ -f /etc/bash_completion ] && ! shopt -oq posix; then    . /etc/bash_completionfi

3. /etc/bash.bashrc

# System-wide .bashrc file for interactive bash(1) shells.# To enable the settings / commands in this file for login shells as well,# this file has to be sourced in /etc/profile.# If not running interactively, don‘t do anything[ -z "$PS1" ] && return# check the window size after each command and, if necessary,# update the values of LINES and COLUMNS.shopt -s checkwinsize# set variable identifying the chroot you work in (used in the prompt below)if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then    debian_chroot=$(cat /etc/debian_chroot)fi# set a fancy prompt (non-color, overwrite the one in /etc/profile)PS1=‘${debian_chroot:+($debian_chroot)}\[email protected]\h:\w\$ ‘# Commented out, don‘t overwrite xterm -T "title" -n "icontitle" by default.# If this is an xterm set the title to [email protected]:dir#case "$TERM" in#xterm*|rxvt*)#    PROMPT_COMMAND=‘echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"‘#    ;;#*)#    ;;#esac# enable bash completion in interactive shells#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then#    . /etc/bash_completion#fi# sudo hintif [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then    case " $(groups) " in *\ admin\ *)    if [ -x /usr/bin/sudo ]; then    cat <<-EOF    To run a command as administrator (user "root"), use "sudo <command>".    See "man sudo_root" for details.        EOF    fi    esacfi# if the command-not-found package is installed, use itif [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then    function command_not_found_handle {            # check because c-n-f could‘ve been removed in the meantime                if [ -x /usr/lib/command-not-found ]; then           /usr/bin/python /usr/lib/command-not-found -- "$1"                   return $?                elif [ -x /usr/share/command-not-found/command-not-found ]; then           /usr/bin/python /usr/share/command-not-found/command-not-found -- "$1"                   return $?        else           printf "%s: command not found\n" "$1" >&2           return 127        fi    }fi

linux下vim和bash設定檔 源檔案

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.