个人linux开发环境配置

python环境

## 下载并配置虚拟环境virtualenvwrapper
https://virtualenvwrapper.readthedocs.io/en/latest/install.html

java环境

## 安装jdk
https://docs.oracle.com/en/java/javase/11/install/installation-jdk-linux-platforms.html#GUID-ADC9C14A-5F51-4C32-802C-9639A947317F

go环境

## 安装go
https://go.dev/doc/install

按照zsh

## 下载并安装zsh
https://github.com/ohmyzsh/ohmyzsh

## 下载zsh-auto suggestion
https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh

配置vim

" set default encoding
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936

" set color
colorscheme desert

" set gui font
set guifont=Bitstream\ Vera\ Sans\ Mono\ 10

" use vim to key in
set nocompatible

" set the rows of history
set history=100

" pop window to confirm if the change
set confirm

" set clipboard shared with window sys
set clipboard+=unnamed

" listen filetype
filetype on

" loading file plugin
filetype plugin on

" set indent for special file
filetype indent on

" save global var
set viminfo+=!

" not be spilt row when having keyword as follow
set iskeyword+=_,$,@,%,#,-

" set programmer highlight
syntax on

" show highlight for keywords
syntax keyword gtkType gint gshort guint gushort gulong gdouble gfloat gchar guchar gboolean gpointer
highlight link gtkType Type


" highlight for char which over 100limited
highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white
match OverLength '\%101v.*'

" the color of the status line
highlight StatusLine guifg=SlateBlue guibg=Yellow
highlight StatusLineNC guifg=Gray guibg=White

" file settings
" set backup file
set nobackup

" not create swap file
setlocal noswapfile
set bufhidden=hide

set linespace=0

" auto completed opr in enhanced command
set wildmenu

" show the row and col at the position which mouse focused on
set ruler
set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%)

" the row high in cmd
set cmdheight=2

" use backspace keyboard to deal with those which ard indent, eol, start,etc.
set backspace=2

" allow backspace cross wide
set whichwrap+=<,>,h,l

" could use mouse at buffer in any where
set mouse=a
set selection=exclusive
set selectmode=mouse,key

" not show help whern started
set shortmess=atI

" tell us which row has been modified
set report=0

" set not bell sound by using vim keyboard
set noerrorbells

" show blank when splited window
set fillchars=vert:\ ,stl:\ ,stlnc:\


" show highlight for the matched word
set showmatch

" the time of the highlight which have been matched
set matchtime=5

" ignore case
set ignorecase

" not show the row which the search keyword in
set nohlsearch

" highlight for search keyword when finding keyword
set incsearch

" input :set list cmd to be seen what should be shown
set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$

" keep 3 row between the buffer of the top and the bottom
set scrolloff=3

" not bell
set novisualbell

" the content of the status lines
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}

" show status line
set laststatus=2

" auto format
set formatoptions=tcrqn

" extend prev row indent,special for multi row comments
set autoindent

" if c program then auto indent
set smartindent

" use c indent
set cindent

" tab for 4 chars
set tabstop=4

" indent for 4 blank
set softtabstop=4
set shiftwidth=4

" not use tab to replace blank
set noexpandtab

" not change row
set nowrap

" sorted by name
let Tlist_Sort_Type = "name"

let Tlist_Use_Right_Window = 1

let Tlist_Compart_Format = 1

let Tlist_Exist_OnlyWindow = 1

let Tlist_File_Fold_Auto_Close = 0

let Tlist_Enable_Fold_Column = 0


" Autocommands
if has("autocmd")
	autocmd FileType xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby set number
	autocmd FileType xml,html vmap  'o'>o-->
	autocmd FileType java,c,cpp,cs vmap  ''>o*/
	autocmd FileType html,text,php,vim,c,java,xml,bash,shell,perl,python setlocal textwidth=100
	autocmd Filetype html,xml,xsl source $VIMRUNTIME/plugin/closetag.vim
				\ if line("'\"") > 0 && line("'\"") <= line("{1}quot;) |
				\   exe "normal g`\"" |
				\ endif
endif " has("autocmd")

" use F5 to compile and run c program
" use F6 to compile and run c++ program
" if use in window then should be remove './'
" used for c
map  :call CompileRunGcc()
func! CompileRunGcc()
	exec "w"
	exec "!gcc % -o %<"
	exec "! ./%<"
endfunc

" used for c++
map  :call CompileRunGpp()
func! CompileRunGpp()
	exec "w"
	exec "!g++ % -o %<"
	exec "! ./%<"
endfunc


" show more clearly in .NFO file
set encoding=utf-8
function! SetFileEncodings(encodings)
	let b:myfileencodingsbak=&fileencodings
	let &fileencodings=a:encodings
endfunction
function! RestoreFileEncodings()
	let &fileencodings=b:myfileencodingsbak
	unlet b:myfileencodingsbak
endfunction

au BufReadPre *.nfo call SetFileEncodings('cp437')|set ambiwidth=single
au BufReadPost *.nfo call RestoreFileEncodings()

" show highlight for txt or vim file
au BufRead,BufNewFile *  setfiletype txt

" use black keyboard to expand
set foldenable
"set foldmethod=manual
set foldmethod=syntax
set foldlevel=100
nnoremap  @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')

" set minibufexpl plugin
" let g:miniBufExplMapWindowNavVim = 1
" let g:miniBufExplMapWindowNavArrows = 1
" let g:miniBufExplMapCTabSwitchBufs = 1
" let g:miniBufExplModSelTarget = 1

" set mapleader
let mapleader = ","

" use 'ss' to load .vimrc
map  ss :source ~/.vimrc

" use 'ee' to open .vimrc file quickly
map  ee :e ~/.vimrc

" use 'w' save file
map  w :w

" use 'wq' to save and quit file quickly
map <silent> <leader>wq :wq<cr>

" auto source .vimrc and make it effect
autocmd! bufwritepost .vimrc source ~/.vimrc

自定义zsh配置

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
if [ -x /usr/bin/dircolors ]; then
        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

export LESS=eFRX
export GREP_OPTIONS='--exclude-dir=.svn --exclude-dir=.git --color=auto -nrI'
export GOPATH=$HOME/go
export GO111MODULE=on

if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
   export WORKON_HOME=/Users/keithl/.virtualenv
   export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
   export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
   export VIRTUALENV_DISTRIBUTE=true
   source /usr/local/bin/virtualenvwrapper.sh
fi

source ~/.bash_profile
# Path to your oh-my-zsh installation.
export ZSH="/Users/keithl/.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 $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.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
# 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 $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
# plugins=(git)
plugins=(git colorize github jira vagrant virtualenv pip python brew macos zsh-syntax-highlighting zsh-autosuggestions zsh-completions)

source $ZSH/oh-my-zsh.sh

# 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"
alias cls="clear"
alias tailf="tail -f"
alias ll="ls -al"
alias greadlink="readlink"
export LC_ALL="zh_CN.UTF-8"
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%d %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}>'
export PATH="/usr/local/opt/qt/bin:$PATH"
alias ssh2work01="ssh ubuntu@work01"
alias ssh2work02="ssh ubuntu@work02"
alias ssh2master="ssh root@master"
alias gitlog="git log --graph --pretty=oneline --abbrev-commit"

你可能感兴趣的:(#,环境配置与工具,vim,linux,编辑器)