Last active
June 14, 2019 08:50
-
-
Save 92hackers/9eb02b10eb5058ffcc31dabb8f5c282a to your computer and use it in GitHub Desktop.
new-cy-vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" This line should not be removed as it ensures that various options are | |
" properly set to work with the Vim-related packages available in Debian. | |
runtime! debian.vim | |
" Vim self configurations | |
set cindent | |
set incsearch | |
set backspace=2 | |
set foldenable | |
" Reload all opening files when those files modified, such as: git pull | |
" Awesome ! | |
set autoread | |
" Highlight tabs as errors. | |
match ErrorMsg /\t/ | |
match ErrorMsg / \+$/ | |
" Show Tabs as `>-` character | |
" Show traing spaces as middle line | |
set list | |
set listchars=tab:>-,trail:- | |
"inoremap ( ( )<left> | |
"inoremap ' ''<left> | |
"inoremap { {}<left>" | |
inoremap < <><left> | |
"inoremap : : | |
"inoremap = = | |
"inoremap [ []<left> | |
set hls | |
"This unsets the "last search pattern" register by hitting return | |
nnoremap <CR> :noh<CR> | |
syntax on | |
" If using a dark background within the editing area and syntax highlighting | |
" turn on this option as well | |
set background=dark | |
" Uncomment the following to have Vim jump to the last position when | |
" reopening a file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | |
endif | |
" Uncomment the following to have Vim load indentation rules and plugins | |
" according to the detected filetype. | |
if has("autocmd") | |
filetype plugin indent on | |
endif | |
" The following are commented out as they cause vim to behave a lot | |
" differently from regular Vi. They are highly recommended though. | |
set showcmd " Show (partial) command in status line. | |
set showmatch " Show matching brackets. | |
set ignorecase " Do case insensitive matching | |
set smartcase " Do smart case matching | |
set incsearch " Incremental search | |
set autowrite " Automatically save before commands like :next and :make | |
set hidden " Hide buffers when they are abandoned | |
set mouse=a " Enable mouse usage (all modes) | |
" Source a global configuration file if available | |
if filereadable("/etc/vim/vimrc.local") | |
source /etc/vim/vimrc.local | |
endif | |
set nu | |
set autoindent | |
" Setting encoding | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
set termencoding=utf-8 | |
set fencs=utf-8,gbk | |
filetype on | |
set ts=4 | |
set sw=4 | |
set tabstop=2 shiftwidth=2 expandtab | |
"color plate" | |
let g:industry_termcolors=256 | |
colorscheme desert | |
" Add vertical column line to indicate 80 max-characters. | |
highlight ColorColumn ctermbg=gray | |
set colorcolumn=80 | |
"Create new files from templates, i need create all kinds of template files | |
"firstly | |
"":autocmd BufNewFile *.html 0r ~/.vim/template/template.html | |
"set for vundle. | |
set nocompatible | |
"keep Plugin commands between vundle#begin/end." | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Support javascript es6 | |
Plugin 'isRuslan/vim-es6' | |
"let Vundle manager Vundle, required. | |
Plugin 'gmarik/Vundle.vim' | |
"Plugin 'cscope.vim' | |
"Plugin 'nginx.vim' | |
Plugin 'chr4/nginx.vim' | |
Plugin 'mattn/emmet-vim' | |
" Fix jsx className class problem | |
" when expanding, replace class with className in jsx file. | |
let g:user_emmet_settings = { | |
\ 'javascript' : { | |
\ 'extends' : 'jsx', | |
\ }, | |
\} | |
Plugin 'othree/html5.vim' | |
Plugin 'valloric/MatchTagAlways' | |
" Surrounding operations, type :help surround to get manuals | |
Plugin 'tpope/vim-surround' | |
"code snippets engine for Vim, with snippets library, | |
Plugin 'xptemplate' | |
"YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for | |
"vim. automatically complete." | |
Plugin 'Valloric/YouCompleteMe' | |
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' | |
Plugin 'Raimondi/delimitMate' | |
"settings for delimitMate. | |
let delimitMate_expand_space = 1 | |
let delimitMate_autoclose = 1 | |
let delimitMate_expand_cr = 1 | |
"this plugin will allow you to run ag from vim, and shows the results in a | |
"split window." | |
Plugin 'rking/ag.vim' | |
" Map ctrl+g to open quickfix window to search code segments. | |
" nnoremap <C-g> :Ag<Cr> | |
"https://github.com/gyng/ctrlsf.vim run :CtrlSf pattern it will split a new | |
"window to show search result." | |
Plugin 'dyng/ctrlsf.vim' | |
Plugin 'scrooloose/nerdtree' | |
" Open nerd tree with ctrl + g shortcut. | |
map <C-g> :NERDTreeToggle<CR> | |
"open a NERDTree automatically when vim starts up." | |
"autocmd vimenter * NERDTree | |
"Plugins for Javascript | |
"ale: common lint engine for various languages, Config lint only on file saving | |
Plugin 'w0rp/ale' | |
let g:ale_lint_on_save = 1 | |
let g:ale_lint_on_text_changed = 0 | |
"Plugin for react.js | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'mxw/vim-jsx' | |
"Easy motion, Move cursor quickly. | |
Plugin 'easymotion/vim-easymotion' | |
"Configs for easy motion: | |
let g:EasyMotion_do_mapping = 0 " Disable default mappings | |
" Jump to anywhere you want with minimal keystrokes, with just one key | |
" binding. | |
" `s{char}{label}` | |
nmap q <Plug>(easymotion-overwin-f) | |
" or | |
" `s{char}{char}{label}` | |
" Need one more keystroke, but on average, it may be more comfortable. | |
nmap q <Plug>(easymotion-overwin-f2) | |
"Turn on case insensitive feature | |
let g:EasyMotion_smartcase = 1 | |
"JK motions: Line motions, move in fuzzy search results | |
map <Leader>j <Plug>(easymotion-j) | |
map <Leader>k <Plug>(easymotion-k) | |
"Add status line, air-line is a powerful plugin | |
Plugin 'vim-airline/vim-airline' | |
"Config tabline which airline builtin | |
let g:airline#extensions#tabline#enabled = 1 | |
" Config fzf as vim plugin | |
set rtp+=/usr/local/opt/fzf | |
Plugin 'junegunn/fzf.vim' | |
" Set shortcut for searching files | |
nnoremap <C-p> :GFiles<Cr> | |
" Set shortcut for open buffers | |
nnoremap <C-n> :Buffers<Cr> | |
" nerd comment, a nice comment tool. | |
Plugin 'scrooloose/nerdcommenter' | |
" Fancy welcome screen | |
Plugin 'mhinz/vim-startify' | |
" A Git wrapper | |
Plugin 'tpope/vim-fugitive' | |
" Support system copy && paste in vim | |
Plugin 'christoomey/vim-system-copy' | |
"for vundle, all plugins must be added before the following line." | |
call vundle#end() | |
filetype plugin indent on | |
" Summary | |
" | |
" Q1: How To Reload .vimrc without reloading vim when .vimrc updated ? | |
" :source ~/.vimrc | |
" | |
" Q2: How to reload an newly installed plugin in a running vim session ? | |
" :source ~/.vim/bundle/vim-system-copy/plugin/xxx.vim | |
" |
Author
92hackers
commented
Jan 19, 2018
- 需要将 里面的内容整理一下,插件跟 set 分门归类。
- :help leader && map in vim script, 搞懂,对于设置太重要了。
- 重新考虑 vim,
- 将 useful plugins 整理一下。
终于暂时将 set && Plugin 归类了,这样来看就清晰多了, vim 自己的配置跟 plugin 的配置区分开来。
今天使用 fzf plugin 来代替 ctrlp 进行 文件查找工作。
tutorial: https://github.com/junegunn/fzf.vim
New Features:
- :source ~/.vimrc ==> 不需重启 vim 就能加载更新过的 .vimrc 配置文件。
- 新增键盘映射: ctrl + p ==> 打开文件列表, ctrl + n : 打开 buffers
- set autoread ===> 当文件改动的时候,在 vim 里面自动更新所有打开的文件。
新增在 vim 中使用c-c, c-v, 进行复制,粘贴文本操作,直接跟系统剪切板关联。利用插件实现。
在 vim 中显示 tab 为错误。同时会高亮显示 traling spaces
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment