vi配置

syntax enable
"set color theme
"colorscheme blackboard

set hidden " so if u want to go directly to a file, no tips show.
set nocompatible " be iMproved
filetype off " required!

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle
" required!
" let Vundle manage Vundle, required
 Plugin ‘VundleVim/Vundle.vim‘
" tip on github use username/repo
" tip on vim-script use repo
" other use git://git.user.com/comand-t.git
 Plugin ‘OmniCppComplete‘
 Plugin ‘winmanager‘
 Plugin ‘taglist.vim‘
 Plugin ‘SuperTab‘
 Plugin ‘scrooloose/nerdtree‘
 Plugin ‘vim-scripts/c.vim‘
 Plugin ‘grep.vim‘
 Plugin ‘chazy/cscope_maps‘
 Plugin ‘tpope/vim-surround‘
 Plugin ‘vim-scripts/a.vim‘
 Plugin ‘godlygeek/tabular‘
 Plugin ‘plasticboy/vim-markdown‘
 Plugin ‘neilagabriel/vim-geeknote‘
 Plugin ‘Emmet.vim‘
 Plugin ‘altercation/vim-colors-solarized‘

" " The following are examples of different formats supported.
" " Keep Plugin commands between vundle#begin/end.
" " plugin on GitHub repo
 Plugin ‘tpope/vim-fugitive‘
" " plugin from http://vim-scripts.org/vim/scripts.html
 Plugin ‘L9‘
" " Git plugin not hosted on GitHub
 "Plugin ‘git://git.wincent.com/command-t.git‘
" " git repos on your local machine (i.e. when working on your own plugin)
" Plugin ‘file:///home/gmarik/path/to/plugin‘
" " The sparkup vim script is in a subdirectory of this repo called vim.
" " Pass the path to set the runtimepath properly.
 Plugin ‘rstacruz/sparkup‘, {‘rtp‘: ‘vim/‘}
" " Avoid a name conflict with L9
" Plugin ‘user/L9‘, {‘name‘: ‘newL9‘}
"
" " All of your Plugins must be added before the following line
 call vundle#end()            " required

set background=light
let g:solarized_termcolors=256
colorscheme solarized

filetype plugin indent on

"auto completed
"RUBY
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1

"RUBY plugin
autocmd FileType ruby compiler ruby

"autocmd vimenter * if !argc() | NERDTree | endif
"autocmd VimEnter * NER

" 设定文件浏览器目录为当前目录
set bsdir=buffer
" 设置编码
set enc=utf-8
" 设置文件编码
set fenc=utf-8
" 设置文件编码检测类型及支持格式
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936

"显示行号
set number

"忽略大小写查找
set ic

" tab宽度
set tabstop=2
set expandtab
retab
set cindent shiftwidth=2
set autoindent shiftwidth=2
set shiftround

" set 折叠
set foldmethod=indent
" 打开文件默认不折叠
set foldlevelstart=99

let g:vim_markdown_folding_disabled = 1

"set my leader
let mapleader=","
let g:mapleader=","

"tabs
map <leader>tn :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove

"打开vimrc 文件 edit vimrc
:nnoremap <leader>ev :vsplit $MYVIMRC<cr>
"source file, the file excute as VimScript
:nnoremap <leader>sv :source $MYVIMRC<cr>
" 映射NERDTree插件
":map <leader>n :NERDTree<CR>
"let loaded_nerd_tree = 1
let NERDTreeQuitOnOpen = 0
let NERDChristmasTree=1
let g:NERDTreeWinSize = 18
map <leader>f :NERDTreeToggle<CR>

"switch window
:map <leader>w <C-W>w

" 把 CTRL-S 映射为 保存,因为这个操作做得太习惯了
imap <C-S> <C-C>:w<CR>

"set zen coding
 let g:user_zen_settings = {
  \ ‘php‘ : {
  \ ‘extends‘ : ‘html‘,
  \ ‘filters‘ : ‘c‘,
  \ },
  \ ‘xml‘ : {
  \ ‘extends‘ : ‘html‘,
  \ },
  \ ‘haml‘ : {
  \ ‘extends‘ : ‘html‘,
  \ },
  \ ‘erb‘ : {
  \ ‘extends‘ : ‘html‘,
  \ },
  \}
"set CtrlP
let g:ctrlp_map = ‘<c-p>‘
let g:ctrlp_cmd = ‘CtrlP‘
let g:ctrlp_working_path_mode = 2
"use in edit
imap <C-A> <C-C><c-p>
"use in none edit
:map <leader>t <c-p>
:map <leader>b :CtrlPBuffer<CR>

set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.jpg,*.png,*.gif,*.jpeg,.DS_Store " MacOSX/Linux
let g:ctrlp_custom_ignore = ‘\.git$\|\.hg$\|\.svn$‘

" move lines up or down (command - D)
nmap <D-j> mz:m+<cr>`z
nmap <D-k> mz:m-2<cr>`z
vmap <D-j> :m‘>+<cr>`<my`>mzgv`yo`z
vmap <D-k> :m‘<-2<cr>`>my`<mzgv`yo`z

" Tab move lines left or right (c-Ctrl,s-Shift)
nmap <c-tab> v>
nmap <s-tab> v<
vmap <c-tab> >gv
vmap <s-tab> <gv

" tab navigation like zsh
:nmap <D-1> :tabprevious<CR>
:map <D-1> :tabprevious<CR>
imap <D-1> <Esc>:tabprevious<CR>i

:nmap <D-2> :tabnext<CR>
:map <D-2> :tabnext<CR>
imap <D-2> <Esc>:tabnext<CR>i

"scss,sass
au BufRead,BufNewFile *.scss set filetype=scss
au BufRead,BufNewFile *.sass set filetype=scss

"coffee script
au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
au BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab
hi link coffeeSpaceError NONE
hi link coffeeSemicolonError NONE
hi link coffeeReservedError NONE
map <leader>cf :CoffeeCompile watch vert<cr>

"let skim use slim syntax
au BufRead,BufNewFile *.skim set filetype=slim

"ctags
set tags+=~/gitdb/rails/tags

"auto completed
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0

" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags

" Enable heavy omni completion.
if !exists(‘g:neocomplcache_omni_patterns‘)
  let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.ruby = ‘[^. *\t]\.\w*\|\h\w*::‘
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete

" code search
let g:ackprg = ‘ag --nogroup --nocolor --column‘

"set powerline
set laststatus=2
"set guifont=Powerline
"set font=Source\ Code\ Pro\:h15
set nocompatible
set t_Co=256
let g:Powerline_cache_enabled = 1

"minitest
set completefunc=syntaxcomplete#Complete

"process past
set pastetoggle=<F2>
nnoremap <F2> :set invpaste paste?<CR>
imap <F2> <C-O>:set invpaste paste?<CR>
set pastetoggle=<F2>
set mouse=a

""""""""""""""""""""""""""""""
" Tag list (ctags)
""""""""""""""""""""""""""""""

let Tlist_Ctags_Cmd = ‘/usr/bin/ctags‘
let Tlist_Show_One_File = 1            "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow = 1          "如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Show_Menu = 1
let Tlist_Auto_Open = 1
"let Tlist_Use_Right_Window = 1         "在右侧窗口中显示taglist窗口

"if(executable("cscope") && has("cscope") )
"   silent! execute "!find . -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.m" -o -name "*.mm" -o -name "*.java" -o -name "*.py" > cscope.files"
"endif
"silent! execute "!cscope -b"
"if filereadable("cscope.out")
" execute "cs a cscope.out"
"endif

"save the tag when write the file

function UpdateCtags()
  let curdir=getcwd()
  while !filereadable("./tags")
    cd ..
    if getcwd() == "/"
      break
    endif
  endwhile
  if filewritable("./tags")
    :!ctags -R
  endif
  execute ":cd " . curdir
endfunction

function UpdateCStags()
  let curdir=getcwd()
  while !filereadable("./cscope.out")
    cd ..
    if getcwd() == "/"
      break
    endif
  endwhile
  if filewritable("./cscope.out")
    :!cscope -Rbq
    execute ":cscope reset"
  endif
  execute ":cd " . curdir
endfunction

nnoremap <leader>ut :call UpdateCtags()<CR>
nnoremap <leader>us :call UpdateCStags()<CR>

nmap w= :resize +3<CR>
nmap w- :resize -3<CR>
nmap w, :vertical resize -3<CR>
nmap w. :vertical resize +3<CR>

时间: 2024-10-02 01:43:01

vi配置的相关文章

ubuntu环境配置之vi 配置【转载】

ubuntu环境配置之vi 配置 [日期:2014-02-10] 来源:Linux社区  作者:zhonghe1114 [字体:大 中 小] Android的源码开发,几乎离不开Linux,Linux系统当然首推Ubuntu了,linux自带的编辑工具VI,相信用过的人都知道它的强大之处了,但是,系统自带的vi,功能比较有限,用起来当然不怎么方便,所以我们需要对它进行优化配置.1.安装增强版vi:sudo apt-get install vim2.做一个软链接:sudo ln -sf /usr/

简单vi配置:YouCompleteMe

下图就是我的VI: 按F5 F6分别调出左右的窗口: 按C-P点出CtrlP搜索,直接查找工程中的文件: 自动补全用的YouCompleteMe,超级强悍: 先发3个有用的连接: https://github.com/humiaozuzu/dot-vimrc https://github.com/spf13/spf13-vim https://github.com/amix/vimrc . 我就是先根据第一个连接做的, 然后又加入了以下修改(是不是很懒 哈哈哈): 在.vimrc 中加入以下代码

vi 配置

set nocompatible set backspace=2 set nu syntax on set ruler set tabstop=2 set hlsearch set autoindent set smartindent set tabstop=4 set softtabstop=4 set shiftwidth=4

文本编辑器VIM/VI

vim/vi  功能强大全屏文本编辑器.主要是建立,编辑,显示文本. www.vim.org  构建shell脚本 :set number 使文件出现行号 a 光标后附件文件     i在光标前插入文本       o回到光标下插入新行 A在本行末附件文件   I在本行开始插入文本    O在光标上插入新行 命令模式: h←   j↓   k↑    i→    $行尾   0移至行首   H屏上方   M屏中方   L屏下端 定位 :set  number 设置行号 :set nonumber

VIM 的配置,存着,有用

新到手的MBP高配到手一星期, 好用到流泪,先谢谢妈咪... ====================================== ====================================== 所以,现在我们先把vi配置一下吧... ====================================== 为撒vimrc文件用了sudo等等方法就是readonly呢,真是的-------> 查了好多资料才发现MAC自带的那个vimrc压根就不能自己改,得自己在根目录下

惊艳的cygwin——Windows下的Linux命令行环境的配置和使用

http://www.tuicool.com/articles/2MramqI 时间 2014-07-29 09:28:36  点滴之间 聚沙成金 原文  http://www.path8.net/tn/archives/6021 主题 CygwinLinux命令 本文内容遵从 CC版权协议 , 可以随意转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明网址: http://oldratlee.com/post/2012-12-22/stunning-cygwin N年前倒腾过一次 

Microsoft Teams Voice语音落地系列-5 实战: Sonus语音网关配置

上一节中我们在Teams上面用命令配置好了Voice Routing Policy并分配给用户,理论上这时他的Teams UI上面的拨号盘就会出现.同时我们也建立好了PSTN Gateway, 这样子 Phone System >>> 本地语音网关的SIP Trunk 就做好了,从Teams 管理员中心上面可以看到这条SIP Trunk的状态,如下: 接下来这一节,我们集中精力讲述在语音网关侧的配置,这次我会选用Direct Routing的认证网关之一:Ribbon SWe Lite

必看的vi 的基本使用教程

vi,Unix&Linux下最基本的编辑器,功能强大使用简单,是用户的必备利器. 模式: 命令模式(默认,通过命令对文件内容进行编辑) vi //在当前目录创建空文件 vi filename //打开指定文件 vi -o|O f1 f2 //打开多个文件,o|O表示水平|垂直分隔 通过vi打开文件后自动进入命令模式,此模式下所有输入都是命令 插入模式(像windows中的普通编辑器一样使用) 命令模式下按iaoIAO任一键进入插入模式,esc回到命令模式 i在光标前插入文本 I在光标所在行前插入

vi 的基本使用

vi 的基本使用 1.那么什么是vi呢? vi,Unix&Linux下最基本的编辑器,功能强大使用简单,是用户的必备利器. 2.它的模式有哪些呢? 1. 命令模式(默认,通过命令对文件内容进行编辑) vi //在当前目录创建空文件 vi filename //打开指定文件 vi -o|O f1 f2 //打开多个文件,o|O表示水平|垂直分隔 通过vi打开文件后自动进入命令模式,此模式下所有输入都是命令 2. 插入模式(像windows中的普通编辑器一样使用) 命令模式下按iaoIAO任一键进入