vim + oh-my-zsh + git搭建开发环境
vim + oh-my-zsh + git配置开发环境
vim配置
安装vundle
使用vundle作为插件管理器,使用前先安装vundle
mkdir -p ~/.vim/bundle
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
#### 配置 .vimrc
编辑~/.vimrc文件,写入以下内容
set nocompatible
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" code complete
Plugin 'davidhalter/jedi-vim'
Plugin 'ervandew/supertab'
" syntastic check
Plugin 'nvie/vim-flake8'
Plugin 'scrooloose/syntastic'
" colorscheme
Plugin 'altercation/vim-colors-solarized'
Plugin 'luochen1990/rainbow' , {'for': 'python'}
Plugin 'morhetz/gruvbox'
" code format
Plugin 'mindriot101/vim-yapf'
" file search
Plugin 'ctrlpvim/ctrlp.vim'
call vundle#end()
filetype plugin indent on
colorscheme gruvbox
" for code complete
let g:jedi#auto_initialization = 1
let g:jedi#completions_enabled = 0
let g:jedi#show_call_signatures = 1
" for <leader>
let mapleader = ","
let g:mapleader = ","
" goto definition
let g:jedi#goto_definitions_command = ""
let g:jedi#goto_assignments_command = "<leader>g"
let g:jedi#goto_command = "<leader>d"
" file search
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" serach file in MRU
nmap <Leader>f :CtrlPMRUFiles<CR>
" search file in BUffer
nmap <Leader>b :CtrlPBuffer<CR>
set number
set cursorline
set fileencoding=utf-8
set fencs=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set history=500
let python_highlight_all=1
set background=dark
set t_Co=256
set laststatus=2
set viminfo+=!
set showmatch
set matchtime=5
set ignorecase
set hlsearch
set autoindent
set cindent
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4
set autochdir
set autoread
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
autocmd! FileType python match OverLength /\%89v.\+/
保存后打开vim,在normal模式下输入
:PluginInstall
vundle会自动安装配置的插件,之后就可以愉快地使用啦~
使用
配置后的效果如图
使用比较简单,主要是flake8和jedi的使用
flake8用于检查代码,编辑完后按快捷键F7进行检查
jedi用于代码补全和跳转,在函数名或者类名处按下,
+ d
会跳转到定义处
ctrp用于文件搜索和跳转,按下,
+ f
调出搜索框,输入文件名进行搜索,按下,
+ b
调出缓冲区文件,此快捷键配合
,
+ d
可以在定义处和调用处来回跳转,非常好用
zsh配置
zsh是区别于bash的一种shell,比bash更好用
安装zsh
yum install zsh
oh-my-zsh是基于zsh的一个主题,可以在其官网上下载,地址:
以下两种方式任选一种安装
# 选择其一即可
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
配置.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/root/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
history
zsh-syntax-highlighting
zsh-completions
extract
)
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
bindkey ',' autosuggest-accept
source $ZSH/oh-my-zsh.sh
unsetopt share_history
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
export TERM=xterm-256color
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=247'
# for autojump
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
上面我们自己配置了一些插件,需要手动下载
安装zsh-autosuggestions
git clone git://github.com/zsh-users/zsh-autosuggestions /root/.zsh/zsh-autosuggestions
安装zsh-syntax-highlighting和zsh-completions
cd ~/.oh-my-zsh/plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-completions.git
刷新.zshrc文件
source ~/.zshrc
#### 使用
上面步骤完成后,就可以愉快地使用啦,效果如下图
提示符会显示当前的仓库和分支名,命令行也会自动补全,非常好用
### git配置
原始的git没有颜色区分,看着不舒服,在~/.gitconfig
里可以配置颜色,这样git status
和git diff
就能很容易地看出修改来了
[user]
email = handsome@gmail.com
name = handsome
[alias]
br = branch
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = green
local = white
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = green
changed = red
untracked = red
git的使用效果留给大家自己去体验哈哈
这就是我自己的配置,如果大家有更好的配置可以告知我~
vim + oh-my-zsh + git搭建开发环境的更多相关文章
- python Day 1 - 搭建开发环境
搭建开发环境 首先,确认系统安装的Python版本是2.7.x: $ python --version Python 2.7.5 然后,安装开发Web App需要的第三方库: 前端模板引擎jinja2 ...
- Sublime Text3 + Golang搭建开发环境
Sublime Text3 + Golang搭建开发环境 http://blog.csdn.net/aqiang912/article/details/46775409 1.安装git 因为golan ...
- 一、React Native 搭建开发环境(1)(Mac OS - IOS项目)
React Native是Facebook推出的一个开发IOS和安卓APP的技术.至于更多的详情,这里不再描述,大家可以自行百度它的定义. 目的: 由于我想在一台电脑上同时开发IOS和Android两 ...
- 深入浅出Docker(五):基于Fig搭建开发环境
概述 在搭建开发环境时,我们都希望搭建过程能够简单,并且一劳永逸,其他的同事可以复用已经搭建好的开发环境以节省开发时间.而在搭建开发环境时,我们经常会被复杂的配置以及重复的下载安装所困扰.在Docke ...
- 一、React Native 搭建开发环境(1)(Mac OS - IOS项目篇)
React Native是Facebook推出的一个开发IOS和安卓APP的技术.至于更多的详情,这里不再描述,大家可以自行百度它的定义. 原因:由于我想在一台电脑上同时开发IOS和Android两个 ...
- React Native从零到一搭建开发环境
React Native从零到一搭建开发环境 ReactNative环境搭建 安装Homebrew 安装rvm 安装nvm 安装node 安装react-native-cli 安装watchman i ...
- ESP32 LyraT音频开发板试玩(一):搭建开发环境
我是卓波,很高兴你来看我的博客. 系列文章: ESP32 LyraT音频开发板试玩(一):搭建开发环境 ESP32 LyraT音频开发板试玩(二):播放音乐 关于ESP32的开发环境搭建,官方有教程, ...
- PYTHON --WebAPP项目转载(廖雪峰) -- Day 1 -- 搭建开发环境
Day 1 - 搭建开发环境 搭建开发环境 首先,确认系统安装的Python版本是3.5.x: $ python3 --version Python 3.5.1 然后,用pip安装开发Web Ap ...
- Linux程序设计(搭建开发环境--curses)
看官们.咱们今天要说的内容.是前面内容的一点小补充,详细的内容是:安装curses开发包.以搭建 开发环境.闲话休说,言归正转. 我们在前面说过搭建开发环境的内容,主要说了开发环境中的GCC和VIM, ...
随机推荐
- python一个源文件调用另一个源文件的函数
使用软件:pychram 这个是使用了Dight.py的mai()函数,也已经成功运行,但是为什么pychram在下面划红色的波浪线呐.
- [转帖]关于 /dev/urandom 的流言终结 | Linux 中国
关于 /dev/urandom 的流言终结 | Linux 中国 2019年05月05日 14:03:52 技术无边 阅读数 202 版权声明:本文为博主原创文章,遵循CC 4.0 by-sa版权 ...
- java 复制指定目录中的所有文件和文件夹到另一个指定文件夹中
package com.test; import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream ...
- redhad 7.0更换yum源
1. 卸载红帽yum源 rpm –e $(rpm –qa|grep yum) --nodeps 2.删除所有repo相关文件 rm –rf /etc/yum.conf rm –rf /etc/yum ...
- Jobs(一)前端页面
Java Web工程中的Intellij中Java Web工程的基本目录: 启动web工程后,显示的默认页面是index.html.需要注意的是,本来IDE自建的是index.jsp,我暂时改成了in ...
- 9-MySQL DBA笔记-测试实践
第9章 测试实践 在第8章中介绍了测试所需要的理论知识,本章将为读者讲述实际的测试过程.实际测试一般包括硬件测试.MySQL基准测试及应用服务压力测试,下面将分别讲述这三方面的内容.此外,测试工具的选 ...
- Js setTimeout 用法
setTimeout( ) 是属于 window 的 method, 但我们都是略去 window 这顶层物件名称, 这是用来设定一个时间, 时间到了, 就会执行一个指定的 method. setTi ...
- scala中ClassOf、asInstenceOf、isInstanceOf三个预定义方法分析
classOf.isInstanceOf.asInstanceOf三个预定义方法分析 Scala的三个预定义(predefined)方法,我们经常用到:它们用来感觉很简单, 但是里面还是隐藏了一些细节 ...
- spring cloud EurekaClient 多网卡 ip 配置 和 源码分析(转)
https://blog.csdn.net/qq_30062125/article/details/83856655 1.前言对于spring cloud,各个服务实例需要注册到Eureka注册中心. ...
- windows批处理来执行java程序
新建后缀名为.bat的文件,然后用记事本编辑,如果用sublime高级记事本编辑最好. @echo off % mshta vbscript:CreateObject()(window.close)& ...