vim + oh-my-zsh + git配置开发环境

vim配置

安装vundle

使用vundle作为插件管理器,使用前先安装vundle

  1. mkdir -p ~/.vim/bundle
  2. git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

#### 配置 .vimrc

编辑~/.vimrc文件,写入以下内容

  1. set nocompatible
  2. set rtp+=~/.vim/bundle/Vundle.vim
  3. call vundle#begin()
  4. Plugin 'VundleVim/Vundle.vim'
  5. " code complete
  6. Plugin 'davidhalter/jedi-vim'
  7. Plugin 'ervandew/supertab'
  8. " syntastic check
  9. Plugin 'nvie/vim-flake8'
  10. Plugin 'scrooloose/syntastic'
  11. " colorscheme
  12. Plugin 'altercation/vim-colors-solarized'
  13. Plugin 'luochen1990/rainbow' , {'for': 'python'}
  14. Plugin 'morhetz/gruvbox'
  15. " code format
  16. Plugin 'mindriot101/vim-yapf'
  17. " file search
  18. Plugin 'ctrlpvim/ctrlp.vim'
  19. call vundle#end()
  20. filetype plugin indent on
  21. colorscheme gruvbox
  22. " for code complete
  23. let g:jedi#auto_initialization = 1
  24. let g:jedi#completions_enabled = 0
  25. let g:jedi#show_call_signatures = 1
  26. " for <leader>
  27. let mapleader = ","
  28. let g:mapleader = ","
  29. " goto definition
  30. let g:jedi#goto_definitions_command = ""
  31. let g:jedi#goto_assignments_command = "<leader>g"
  32. let g:jedi#goto_command = "<leader>d"
  33. " file search
  34. let g:ctrlp_map = '<c-p>'
  35. let g:ctrlp_cmd = 'CtrlP'
  36. " serach file in MRU
  37. nmap <Leader>f :CtrlPMRUFiles<CR>
  38. " search file in BUffer
  39. nmap <Leader>b :CtrlPBuffer<CR>
  40. set number
  41. set cursorline
  42. set fileencoding=utf-8
  43. set fencs=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
  44. set history=500
  45. let python_highlight_all=1
  46. set background=dark
  47. set t_Co=256
  48. set laststatus=2
  49. set viminfo+=!
  50. set showmatch
  51. set matchtime=5
  52. set ignorecase
  53. set hlsearch
  54. set autoindent
  55. set cindent
  56. set tabstop=4
  57. set expandtab
  58. set softtabstop=4
  59. set shiftwidth=4
  60. set autochdir
  61. set autoread
  62. highlight OverLength ctermbg=red ctermfg=white guibg=#592929
  63. autocmd! FileType python match OverLength /\%89v.\+/

保存后打开vim,在normal模式下输入

  1. :PluginInstall

vundle会自动安装配置的插件,之后就可以愉快地使用啦~

使用

配置后的效果如图

使用比较简单,主要是flake8和jedi的使用

flake8用于检查代码,编辑完后按快捷键F7进行检查

jedi用于代码补全和跳转,在函数名或者类名处按下, + d会跳转到定义处

ctrp用于文件搜索和跳转,按下, + f 调出搜索框,输入文件名进行搜索,按下, + b调出缓冲区文件,此快捷键配合

, + d可以在定义处和调用处来回跳转,非常好用

zsh配置

zsh是区别于bash的一种shell,比bash更好用

安装zsh

  1. yum install zsh

oh-my-zsh是基于zsh的一个主题,可以在其官网上下载,地址:

以下两种方式任选一种安装

  1. # 选择其一即可
  2. sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  3. sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

配置.zshrc

  1. # If you come from bash you might have to change your $PATH.
  2. # export PATH=$HOME/bin:/usr/local/bin:$PATH
  3. # Path to your oh-my-zsh installation.
  4. export ZSH="/root/.oh-my-zsh"
  5. # Set name of the theme to load --- if set to "random", it will
  6. # load a random theme each time oh-my-zsh is loaded, in which case,
  7. # to know which specific one was loaded, run: echo $RANDOM_THEME
  8. # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
  9. ZSH_THEME="robbyrussell"
  10. # Set list of themes to pick from when loading at random
  11. # Setting this variable when ZSH_THEME=random will cause zsh to load
  12. # a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
  13. # If set to an empty array, this variable will have no effect.
  14. # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
  15. # Uncomment the following line to use case-sensitive completion.
  16. # CASE_SENSITIVE="true"
  17. # Uncomment the following line to use hyphen-insensitive completion.
  18. # Case-sensitive completion must be off. _ and - will be interchangeable.
  19. # HYPHEN_INSENSITIVE="true"
  20. # Uncomment the following line to disable bi-weekly auto-update checks.
  21. # DISABLE_AUTO_UPDATE="true"
  22. # Uncomment the following line to automatically update without prompting.
  23. # DISABLE_UPDATE_PROMPT="true"
  24. # Uncomment the following line to change how often to auto-update (in days).
  25. # export UPDATE_ZSH_DAYS=13
  26. # Uncomment the following line if pasting URLs and other text is messed up.
  27. # DISABLE_MAGIC_FUNCTIONS=true
  28. # Uncomment the following line to disable colors in ls.
  29. # DISABLE_LS_COLORS="true"
  30. # Uncomment the following line to disable auto-setting terminal title.
  31. # DISABLE_AUTO_TITLE="true"
  32. # Uncomment the following line to enable command auto-correction.
  33. # ENABLE_CORRECTION="true"
  34. # Uncomment the following line to display red dots whilst waiting for completion.
  35. # COMPLETION_WAITING_DOTS="true"
  36. # Uncomment the following line if you want to disable marking untracked files
  37. # under VCS as dirty. This makes repository status check for large repositories
  38. # much, much faster.
  39. # DISABLE_UNTRACKED_FILES_DIRTY="true"
  40. # Uncomment the following line if you want to change the command execution time
  41. # stamp shown in the history command output.
  42. # You can set one of the optional three formats:
  43. # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
  44. # or set a custom format using the strftime function format specifications,
  45. # see 'man strftime' for details.
  46. # HIST_STAMPS="mm/dd/yyyy"
  47. # Would you like to use another custom folder than $ZSH/custom?
  48. # ZSH_CUSTOM=/path/to/new-custom-folder
  49. # Which plugins would you like to load?
  50. # Standard plugins can be found in ~/.oh-my-zsh/plugins/*
  51. # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
  52. # Example format: plugins=(rails git textmate ruby lighthouse)
  53. # Add wisely, as too many plugins slow down shell startup.
  54. plugins=(
  55. git
  56. history
  57. zsh-syntax-highlighting
  58. zsh-completions
  59. extract
  60. )
  61. export LC_ALL=en_US.UTF-8
  62. export LANG=en_US.UTF-8
  63. source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
  64. bindkey ',' autosuggest-accept
  65. source $ZSH/oh-my-zsh.sh
  66. unsetopt share_history
  67. # User configuration
  68. # export MANPATH="/usr/local/man:$MANPATH"
  69. # You may need to manually set your language environment
  70. # export LANG=en_US.UTF-8
  71. # Preferred editor for local and remote sessions
  72. # if [[ -n $SSH_CONNECTION ]]; then
  73. # export EDITOR='vim'
  74. # else
  75. # export EDITOR='mvim'
  76. # fi
  77. # Compilation flags
  78. # export ARCHFLAGS="-arch x86_64"
  79. # Set personal aliases, overriding those provided by oh-my-zsh libs,
  80. # plugins, and themes. Aliases can be placed here, though oh-my-zsh
  81. # users are encouraged to define aliases within the ZSH_CUSTOM folder.
  82. # For a full list of active aliases, run `alias`.
  83. #
  84. # Example aliases
  85. # alias zshconfig="mate ~/.zshrc"
  86. # alias ohmyzsh="mate ~/.oh-my-zsh"
  87. export TERM=xterm-256color
  88. ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=247'
  89. # for autojump
  90. [[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

上面我们自己配置了一些插件,需要手动下载

安装zsh-autosuggestions

  1. git clone git://github.com/zsh-users/zsh-autosuggestions /root/.zsh/zsh-autosuggestions

安装zsh-syntax-highlighting和zsh-completions

  1. cd ~/.oh-my-zsh/plugins
  2. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
  3. git clone https://github.com/zsh-users/zsh-completions.git

刷新.zshrc文件

  1. source ~/.zshrc

#### 使用

上面步骤完成后,就可以愉快地使用啦,效果如下图

提示符会显示当前的仓库和分支名,命令行也会自动补全,非常好用

### git配置

原始的git没有颜色区分,看着不舒服,在~/.gitconfig里可以配置颜色,这样git statusgit diff就能很容易地看出修改来了

  1. [user]
  2. email = handsome@gmail.com
  3. name = handsome
  4. [alias]
  5. br = branch
  6. [color]
  7. branch = auto
  8. diff = auto
  9. status = auto
  10. [color "branch"]
  11. current = green
  12. local = white
  13. remote = green
  14. [color "diff"]
  15. meta = yellow bold
  16. frag = magenta bold
  17. old = red bold
  18. new = green bold
  19. [color "status"]
  20. added = green
  21. changed = red
  22. untracked = red

git的使用效果留给大家自己去体验哈哈

这就是我自己的配置,如果大家有更好的配置可以告知我~

vim + oh-my-zsh + git搭建开发环境的更多相关文章

  1. python Day 1 - 搭建开发环境

    搭建开发环境 首先,确认系统安装的Python版本是2.7.x: $ python --version Python 2.7.5 然后,安装开发Web App需要的第三方库: 前端模板引擎jinja2 ...

  2. Sublime Text3 + Golang搭建开发环境

    Sublime Text3 + Golang搭建开发环境 http://blog.csdn.net/aqiang912/article/details/46775409 1.安装git 因为golan ...

  3. 一、React Native 搭建开发环境(1)(Mac OS - IOS项目)

    React Native是Facebook推出的一个开发IOS和安卓APP的技术.至于更多的详情,这里不再描述,大家可以自行百度它的定义. 目的: 由于我想在一台电脑上同时开发IOS和Android两 ...

  4. 深入浅出Docker(五):基于Fig搭建开发环境

    概述 在搭建开发环境时,我们都希望搭建过程能够简单,并且一劳永逸,其他的同事可以复用已经搭建好的开发环境以节省开发时间.而在搭建开发环境时,我们经常会被复杂的配置以及重复的下载安装所困扰.在Docke ...

  5. 一、React Native 搭建开发环境(1)(Mac OS - IOS项目篇)

    React Native是Facebook推出的一个开发IOS和安卓APP的技术.至于更多的详情,这里不再描述,大家可以自行百度它的定义. 原因:由于我想在一台电脑上同时开发IOS和Android两个 ...

  6. React Native从零到一搭建开发环境

    React Native从零到一搭建开发环境 ReactNative环境搭建 安装Homebrew 安装rvm 安装nvm 安装node 安装react-native-cli 安装watchman i ...

  7. ESP32 LyraT音频开发板试玩(一):搭建开发环境

    我是卓波,很高兴你来看我的博客. 系列文章: ESP32 LyraT音频开发板试玩(一):搭建开发环境 ESP32 LyraT音频开发板试玩(二):播放音乐 关于ESP32的开发环境搭建,官方有教程, ...

  8. PYTHON --WebAPP项目转载(廖雪峰) -- Day 1 -- 搭建开发环境

    Day 1 - 搭建开发环境   搭建开发环境 首先,确认系统安装的Python版本是3.5.x: $ python3 --version Python 3.5.1 然后,用pip安装开发Web Ap ...

  9. Linux程序设计(搭建开发环境--curses)

    看官们.咱们今天要说的内容.是前面内容的一点小补充,详细的内容是:安装curses开发包.以搭建 开发环境.闲话休说,言归正转. 我们在前面说过搭建开发环境的内容,主要说了开发环境中的GCC和VIM, ...

随机推荐

  1. PTA(Advanced Level)1050.String Subtraction

    Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking all the char ...

  2. 【LOJ】#3102. 「JSOI2019」神经网络

    LOJ#3102. 「JSOI2019」神经网络 首先我们容易发现就是把树拆成若干条链,然后要求这些链排在一个环上,同一棵树的链不相邻 把树拆成链可以用一个简单(但是需要复杂的分类讨论)的树背包实现 ...

  3. tomcat单机多应用部署配合Nginx负载均衡

    一.Windows 配置tomcat . 安装两个tomcat服务器以上 . 配置环境变量 CATALINA_BASE:D:\servers\Tomcat8 CATALINA_HOME:D:\serv ...

  4. Eureka【支持Remote Region】

    工程公共pom依赖 <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncod ...

  5. HTNL基础之四

    11.<nav>导航元素 标签定义及使用说明 表示页面中导航链接的部分,例如:传统导航条,侧边栏导航,页内导航,翻页等 <nav> 标签定义导航链接的部分. 并不是所有的 HT ...

  6. C# 使用Emit实现动态AOP框架 (三)

    目  录 C# 使用Emit实现动态AOP框架 (一) C# 使用Emit实现动态AOP框架 (二) C# 使用Emit实现动态AOP框架 (三) C# 使用Emit实现动态AOP框架 进阶篇之异常处 ...

  7. 操作系统中堆(heap)与栈(stack)的区别

    主要区别如下: 一.空间分配: 1.堆(操作系统):一般由程序员分配释放,若程序员不释放,程序结束时可能由OS回收,分配方式类似于链表.PS:java中都是系统GC,程序员无法进行GC. 2.栈(操作 ...

  8. ubuntu 一键搭建VNN

    #!/bin/bash if [ $(id -u) != "0" ]; then printf "Error: You must be root to run this ...

  9. nexus 绑定负载均衡nginx反向代理后 遇到的https问题。

    1.今天搭建maven私服,下载安装好nexus运行后,通过IP可以直接访问,没有问题,如:http://123.123.123.123:8081 就可以进入主页面.没有任何问题. 2.但是他默认是h ...

  10. 关于阮一峰老师es6(第三版)中管道机制代码的理解浅析

    最近正在学习阮一峰老师的es6(第三版)教材,在学到第七章<函数的扩展>中的箭头函数嵌套时,文中提到了一个关于“管道机制”的示例,文中源代码如下: //es6(第三版)教材中的管道机制源代 ...