`
23号
  • 浏览: 136916 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

My Vimrc

阅读更多

set dir=~/.vim/swp
set backup
set backupdir=~/.vim/backup/
set backupext=.bak

set autoindent        "always set autoindenting on
set smartindent       "set smart indent
set smarttab          "use tabs at the start of a line, spaces elsewhere
set expandtab         "not use tab
set tabstop=4 softtabstop=4 shiftwidth=4

set smartcase
set ignorecase        " easier to ignore case for searching
set incsearch         " do incremental searching
set hlsearch          " highlighting the last used search pattern. or :noh
"set list             " show chars on end of line, whitespace, etc
"set nowrap           " do not wrap lines

set wildmenu          " command-line completion operates in an enhanced mode
set history=50        " keep 50 lines of command line history
set mouse=a           " set mouse functions

"don't make noise
set noerrorbells
set novisualbell


filetype on           " detect the type of file
syntax on             " syntax highlighting on
set fileformats=unix,dos
set textwidth=80          
set ruler             " show current positions along the bottom

set foldenable        " turn on folding
set foldmethod=indent " make folding indent sensitive
set foldlevel=100     " don't autofold anything
set foldopen-=search  " don't open folds when you search into them
set foldopen-=undo    " don't open folds when you undo stuff

"set encoding=prc
"set fileencoding=prc
"set fileencodings=prc

set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8

set guifont=Consolas\ 12
"set gfn=Consolas:h12 gfw=Consolas:h12

"auto change work dir
set autochdir

let Tlist_Ctags_Cmd = '/usr/bin/ctags'
map <F5> :VTreeExplore<CR>
map <F6> :TlistToggle<CR>
map <C-T> :tabnew<CR>
map <C-W> :tabclose<CR>
map <S-Left> :tabprev<CR>
map <S-Right> :tabnext<CR>
map <Left> :bp<CR>
map <Right> :bn<CR>
map <F4> :bd<CR>
map <C-Q> :bdelete<CR>
map <C-C> "+y<CR>
map <C-V> "+gP<CR>


"A collection of C extension Vim syntax. $HOME/.vim/after/syntax
let glib_enable_deprecated = 1
let glib_deprecated_errors = 1


au BufEnter * if &textwidth > 0 | exec 'match Todo /\%>' . &textwidth . 'v.\+/' | endif
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h set shiftwidth=4
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h set softtabstop=4
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h set tabstop=4
au BufRead,BufNewFile *.py,*.pyw set expandtab                " not use tab
au BufRead,BufNewFile *.c,*.h set noexpandtab                 " use tab
au BufRead,BufNewFile Makefile* set noexpandtab
highlight BadWhitespace ctermbg=red guibg=red
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h set textwidth=79
au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix


autocmd bufnewfile *.py call setline(1,'#! /usr/bin/env python') |
    \ call setline(2,'# -*- coding: utf-8 -*-') |
    \ call setline(3,'') |
    \ call setline(4, strftime("# Create Date: %F %T")) |
    \ call setline(5,'# Author: N23 <No.0023@gmail.com>') |
    \ call setline(6,'# Blog: http://n23.appspot.com/blog') |
    \ call setline(7,'') |
    \ call setline(8,'') |
    \ exe "normal G"

"Python iMaps
au FileType python inoremap <buffer> $r return
au FileType python inoremap <buffer> $s self
au FileType python inoremap <buffer> $c ##<cr>#<space><cr>#<esc>kla
au FileType python inoremap <buffer> $f from
au FileType python inoremap <buffer> $i import
au FileType python inoremap <buffer> $p print
au FileType python inoremap <buffer> $d """<cr>"""<esc>O

"Java iMaps
autocmd FileType java inoremap <buffer> $pr private
autocmd FileType java inoremap <buffer> $r return
autocmd FileType java inoremap <buffer> $pu public
autocmd FileType java inoremap <buffer> $i import
autocmd FileType java inoremap <buffer> $b boolean
autocmd FileType java inoremap <buffer> $v void
autocmd FileType java inoremap <buffer> $s String
autocmd FileType java inoremap <buffer> $e Exception

augroup python_prog
  au!
  fun! Python_fold()
    execute 'syntax clear pythonStatement'
    execute 'syntax keyword pythonStatement break continue del'
    execute 'syntax keyword pythonStatement except exec finally'
    execute 'syntax keyword pythonStatement pass print raise'
    execute 'syntax keyword pythonStatement return try'
    execute 'syntax keyword pythonStatement global assert'
    execute 'syntax keyword pythonStatement lambda yield'
    execute 'syntax match pythonStatement /\<def\>/ nextgroup=pythonFunction skipwhite'
    execute 'syntax match pythonStatement /\<class\>/ nextgroup=pythonFunction skipwhite'
    execute 'syntax region pythonFold start="^\z(\s*\)\%(.*:\s*\%(#.*$\)\?\)" end="^\%(\n*\z1\s\)\@!" transparent fold'
    execute 'syntax sync minlines=2000 maxlines=4000'
    set autoindent
    set foldmethod=syntax
    " set foldopen=all foldclose=all
    set foldtext=substitute(getline(v:foldstart),'\\t','\ \ \ \ ','g').'\ \ ('.(v:foldend-v:foldstart+1).'\ lines)'
    set fillchars=vert:\|,fold:\
  endfun
  autocmd FileType python call Python_fold()
augroup END

"Make dir $HOME/.vim/after/syntax
"untar this file to $HOME/.vim/after/syntax
"If you don't have $HOME/.vim/after/syntax/c.vim,
"then copy c.vim.example to $HOME/.vim/after/syntax/c.vim

"see :h mysyntaxfile-add

"set csprg=/usr/local/bin/cscope
"set csto=1
"set nocsverb
"set cst
"cs add ~/.cscope/cscope.out
" ctrl + ]
" ctrl + t / ctrl + o
" cs find
" help cscope

"this script use to excute make in vim and open quickfix window
"map <C-M> :call Do_make()<CR><CR><CR>
"nmap B :call Do_make()<cr><cr><cr>
"nmap C :cclose<cr>
"function Do_make()
"  let filename = bufname("%")
"  let suffix_pos = stridx(filename, ".c")
"  if suffix_pos == -1
"      return
"  else
"      let target = strpart(filename,0,suffix_pos)
"  endif
"  let target = "make " . target
"  execute target
"  execute "copen"
"endfunction

"mkdir -p ~/.vim/templates
"let g:template_load = 1
"let g:template_tags_replacing = 1
"let g:T_AUTHOR = "N23"
"let g:T_AUTHOR_EMAIL = "No.0023@gmail.com"
"let g:T_AUTHOR_WEBSITE = "http://blog.chinaunix.net/u1/42287/"
"let g:T_DATE_FORMAT = "%F %T"

"change work folder
"cd ~/tmp

"runtime! ftplugin/man.vim
"use :Man

"   vim *.c
"   :argdo %s/oldvalue/newvalue/g
"
"   %
"   =%
"   gg, G
"   [[, ]]
"   :reg
"     "a5yy
"     "ap
"     "A5yy
"     his c
"     his s
"     :1,5 co 10
"     q
"     :scriptnames
"     :digraphs
"     ga              " hex
"     :set noma       " non modifiable
"     :set ro         " read only
"     #session
"       vim file1.c file2.c
"       :mksession
"       :q
"       vim -S Session.vim
"
"       map : all
"       nmap: normal map
"       vmap: visual map
"       imap: insert map
"
"       b:name        " buffer
"       w:name        " window
"       g:name        " global
"       v:name        " vim
"       a:name        " function param
"
"     :set all
"     :list
"     :augroup

分享到:
评论

相关推荐

    My .vimrc Backup

    《我的.vimrc备份:构建个性化的Vim编辑器环境》 在程序员的世界里,Vim编辑器以其高效、强大的特性赢得了众多忠实拥趸。一个精心配置的.vimrc文件,就像是程序员的个性化工作站,能够极大地提升编码效率。这篇博客...

    my-vimrc-master.zip

    "my-vimrc-master.zip" 是一个包含个人Vim配置文件的压缩包,特别为Vim 8.2版本优化。Vim配置文件(通常称为.vimrc)是用于设置编辑器行为的脚本,它允许用户根据个人喜好调整各种功能,如快捷键、颜色方案、插件等...

    my_vimrc:个人vim的配置文件

    用于备份我的.vimrc文件,防止丢失重新配置

    jonsen-vimrc

    my vimrc for vim 7.2 VIM(1) VIM(1) NAME vim - Vi IMproved, a programmers text editor SYNOPSIS vim [options] [file ..] vim [options] - vim [options] -t tag vim [options] -q [errorfile] ex ...

    vimrc settings

    vim settings,please rename vimrc to ".vimrc",and then move it to user directory. E.g /root/.vimrc /home/my/.vimrc It's very useful for me.

    我正在使用的_vimrc文件、字体和配色方案

    在提供的`myvim`压缩包中,很可能包含了用户的`.vimrc`文件、特定的字体文件以及配色方案文件。解压并应用这些设置,可以帮助用户快速搭建一个与原作者相似的工作环境。需要注意的是,个人化的配置可能需要根据自己...

    vim 配置文件 vimrc 较适用于php开发

    " My Bundles here: " " original repos on github Bundle 'mattn/zencoding-vim' Bundle 'Lokaltog/vim-powerline' Bundle 'Shougo/neocomplcache' Bundle 'Shougo/vimproc' "Bundle 'Shougo/neosnippet' ...

    my_vimrc_config:简单的vimrc配置,用于C ++中的竞争性编程

    【标题】"my_vimrc_config" 是一个针对C++竞争性编程的Vim配置文件集,它旨在优化Vim编辑器的环境,提供高效、美观且实用的编程体验。这个配置通过Vundle管理插件,确保了美学与实用性的完美结合。 【描述】中提到...

    my_vim:我的vimrc

    【标题】"my_vim:我的vimrc"指的是个人自定义的Vim配置文件集合,通常包含了一系列的Vim插件、设置和快捷键,以优化编辑器的使用体验。这个压缩包可能是一个名为"my_vim-master"的Git仓库克隆版,包含了作者对于Vim...

    my_vim_config:我的.vim文件夹,其中也包括我的vimrc

    在Vim中,个人配置文件是通过.vim目录和vimrc文件来实现的,这允许用户根据自己的需求调整编辑器的行为。标题中的"my_vim_config"就是这样一个自定义的.vim配置文件集合,包含了作者对于Vim的各种个性化设置。 `my_...

    点文件:.vimrc和.zshrc配置,使工作更轻松

    此外,`.zshrc`还可以用于配置Zsh插件,比如Oh My Zsh,这是一个广泛使用的框架,提供了大量预设的插件和主题,可以极大地提升shell的使用体验。 在`.vimrc`和`.zshrc`文件中,你还可以设置个性化元素,如提示符...

    MyVim:vim,vimrc,vimrc模板,vim文档,vim note,vim学习,vimtutor,学习vim,vim实践,vim学习,vim笔记,vim训练营,vim教程,vim入门教程,vim简明教程,vim实操教程, vim入门文档,vimtutor中文版

    在`MyVim-master`这个压缩包中,可能包含了作者黄剑关于Vim的学习资料、笔记、教程和配置示例。这是一份宝贵的资源,可以帮助你深入理解Vim的使用和配置。你可以找到关于Vim的实践案例,学习如何通过Vim提高编码效率...

    my_vim_config

    【描述】:这个压缩包“my_vim_config”包含的是个人化的Vim编辑器配置文件,它反映了用户对于Vim功能和个性化设置的定制,以提高编程效率和舒适度。 【标签】:Vim 【详细知识点】 1. **Vim简介**:Vim(Vi ...

    vimrc of vim

    my vim welcome to download

    积分管理系统java源码-vimrc:vimrc

    My-vimrc 简单说明 for anyone who need this vim 是一个高度可定制化的,文本编辑软件。因此,其个性化配置来说,并不适合所有人。但仍然有一定的借鉴意义。 本vimrc配置文件,是我多年使用vim软件积累所得;主要是...

    my configure file

    my configuration files including vimrc bashrc vim and gvimrc

    config:我的个人配置(zshrc,vimrc等)

    设定档我的个人配置(zshrc,vimrc等)设置安装brew install node 易于curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -sudo apt install -y nodejs : sh -c "$(curl -fsSL ...-depth=1 ...

    my-vimrc-file:因为当我不可避免地打破我的电脑

    Uber API 教程:构建派对邀请为您的下一个聚会制作数字邀请,同时学习如何使用 Uber API。 在本教程结束时,您的邀请将向用户显示最近的优步行程,并链接到您的帐户,以便您可以通过优步 API 附属计划获得奖励。

    myenv:我的环境设置涵盖了.bashrc和.vimrc

    #my包含.bashrc和.vimrc的环境设置 #Linux版本是lubuntu 16.4 #您可以运行“源README.md以运行此脚本” sudo apt更新; sudo apt安装git; #ssh-keygen -t rsa -C“ ” #git config --global user.name“您的...

Global site tag (gtag.js) - Google Analytics