用户操作
[即时聊天] [发私信] [加为好友]
randyID:skyyunmi
81117次访问,排名1213好友2人,关注者3
skyyunmi的文章
原创 188 篇
翻译 2 篇
转载 86 篇
评论 31 篇
randy的公告
welcome my friends^_^
   首页          留言
Locations of visitors to this page
最近评论
yang :希望我们生一个聪明的宝宝。
Elaine_Yang:原来你不久前才算是结婚,新婚快乐!
fr:谢谢
yang:21;30~22:00日语?游戏?
Elaine_Yang:杨玲萍,lingling200_98@hotmail.com
文章分类
收藏
    相册
    Inter
    yang
    风景
    婚纱照
    江ノ島・鎌倉
    美女
    日本闲逛见闻
    温泉
    樱花
    自暴
    good blog
    CODE PROJECT
    STL China
    何勃亮个人空间
    unix-ubuntu
    LinuxFocus 在线杂志
    Linux时代
    ubuntu
    Ubuntu中文 论坛
    Ubuntu中文星球
    常去网址
    中国经济网--财经书架在线阅读
    思维的乐趣
    趣味电子屋
    工具
    google
    地球人
    爱心词典
    百度
    糍粑
    工作用
    IC datasheet
    理财
    sina stock
    中国基金网
    朋友空间
    小水--江洋
    我的空间
    我的心情吧(RSS)
    我的收集吧(RSS)
    我的照片吧(RSS)
    我的网络硬盘
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    转载 史上最强的Vim配置脚本收藏

    新一篇: 080426 | 旧一篇: EDA设计主要流程

    http://www.amix.dk/vim/vimrc.html#Fileformats
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "          _
    "      __ | 
    "     /   | /
    "     __ | 
    " by Amix - http://amix.dk/
    "
    " Maintainer: Amir Salihefendic <amix3k at gmail.com>
    " Version: 2.7
    " Last Change: 12/10/06 00:09:21
    "
    " Sections:
    " ----------------------
    " General
    " Colors and Fonts
    " Fileformats
    " VIM userinterface
    "    Statusline
    " Visual
    " Moving around and tabs
    " General Autocommands
    " Parenthesis/bracket expanding
    " General Abbrevs
    " Editing mappings etc.
    " Command-line config
    " Buffer realted
    " Files and backups
    " Folding
    " Text options
    "    Indent
    " Spell checking
    " Plugin configuration
    "    Yank ring
    "    File explorer
    "    Minibuffer
    "    Tag list (ctags) - not used
    "    LaTeX Suite things
    " Filetype generic
    "    Todo
    "    VIM
    "    HTML related
    "    Ruby & PHP section
    "    Python section
    "    Cheetah section
    "    Vim section
    "    Java section
    "    JavaScript section
    "    C mappings
    "    SML
    "    Scheme bindings
    " Snippets
    "    Python
    "    javaScript
    " Cope
    " MISC
    "
    "  Tip:
    "   If you find anything that you can't understand than do this:
    "   help keyword OR helpgrep keywords
    "  Example:
    "   Go into command-line mode and type helpgrep nocompatible, ie.
    "   :helpgrep nocompatible
    "   then press <leader>c to see the results, or :botright cw
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " General
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Get out of VI's compatible mode..
    set nocompatible

    "Sets how many lines of history VIM har to remember
    set history=400

    "Enable filetype plugin
    filetype plugin 
    on
    filetype indent 
    on

    "Set to auto read when a file is changed from the outside
    set autoread

    "Have the mouse enabled all the time:
    set mouse=a

    "Set mapleader
    let mapleader = 
    ","
    let g:mapleader = 
    ","

    "Fast saving
    nmap 
    <leader>:w!<cr>
    nmap 
    <leader>:find<cr>

    "Fast reloading of the .vimrc
    map <leader>s :source ~/vim_local/vimrc<cr>
    "Fast editing of .vimrc
    map 
    <leader>:e! ~/vim_local/vimrc<cr>
    "When .vimrc is edited, reload it
    autocmd! bufwritepost vimrc source ~/vim_local/vimrc


    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Colors and Fonts
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Enable syntax hl
    syntax enable

    "Set font to Monaco 10pt
    if MySys() == "mac"
      
    set gfn=Bitstream Vera Sans Mono:h14
      
    set nomacatsui
      
    set termencoding=macroman
    elseif MySys
    () == "linux"
      
    set gfn=Monospace 11
    endif

    if has("gui_running")
      
    set guioptions-=T
      let psc_style
    ='cool'
      colorscheme ps_color
    else
      
    set background=dark
      colorscheme zellner
    endif

    "Some nice mapping to switch syntax (useful if one mixes different languages in one file)
    map <leader>1 :set syntax=cheetah<cr>
    map <leader>2 :set syntax=xhtml<cr>
    map <leader>3 :set syntax=python<cr>
    map <leader>4 :set ft=javascript<cr>
    map <leader>$ :syntax sync fromstart<cr>

    autocmd BufEnter * :syntax sync fromstart

    "Highlight current
    if has("gui_running")
      
    set cursorline
      hi cursorline guibg
    =#333333
      hi CursorColumn guibg
    =#333333
    endif

    "Omni menu colors
    hi Pmenu guibg=#333333
    hi PmenuSel guibg=#555555 guifg=#ffffff


    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Fileformats
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Favorite filetypes
    set ffs=unix,dos,mac

    nmap <leader>fd :se ff=dos<cr>
    nmap <leader>fu :se ff=unix<cr>



    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " VIM userinterface
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Set 7 lines to the curors - when moving vertical..
    set so=7

    "Turn on WiLd menu
    set wildmenu

    "Always show current position
    set ruler

    "The commandbar is 2 high
    set cmdheight=2

    "Show line number
    set nu

    "Do not redraw, when running macros.. lazyredraw
    set lz

    "Change buffer - without saving
    set hid

    "Set backspace
    set backspace=eol,start,indent

    "Bbackspace and cursor keys wrap to
    set whichwrap+=<,>,h,l

    "Ignore case when searching
    set ignorecase
    set incsearch

    "Set magic on
    set magic

    "No sound on errors.
    set noerrorbells
    set novisualbell
    set t_vb=

    "show matching bracets
    set showmatch

    "How many tenths of a second to blink
    set mat=2

    "Highlight search things
    set hlsearch

      
    """"""""""""""""""""""""""""""
      
    " Statusline
      
    """"""""""""""""""""""""""""""
      
    "Always hide the statusline
      set laststatus=2

      function! CurDir()
         let curdir = substitute(getcwd(), '/Users/amir/', 
    "~/""g")
         return curdir
      endfunction

      
    "Format the statusline
      
    set statusline= %F%m%r%h %w  CWD: %r%{CurDir()}%h   Line: %l/%L:%c



    """"""""""""""""""""""""""""""
    " Visual
    """"""""""""""""""""""""""""""
    " From an idea by Michael Naumann
    function! VisualSearch
    (direction) range
      let l
    :saved_reg = @"
      execute 
    "normal! vgvy"
      let l:pattern = escape(@
    ", '\/.*$^~[]')
      let l
    :pattern = substitute(l:pattern, " $", "", "")
      
    if a:direction == 'b'
        execute 
    "normal ?" . l:pattern . "^M"
      
    else
        execute 
    "normal /" . l:pattern . "^M"
      endif
      let @
    / = l:pattern
      let @
    " = l:saved_reg
    endfunction

    "Basically you press * or # to search for the current selection !! Really useful
    vnoremap 
    <silent> * :call VisualSearch('f')<CR>
    vnoremap 
    <silent> # :call VisualSearch('b')<CR>


    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Moving around and tabs
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Map space to / and c-space to ?
    map 
    <space> /
    map 
    <c-space> ?

    "Smart way to move btw. windows
    map <C-j> <C-W>j
    map <C-k> <C-W>k
    map <C-h> <C-W>h
    map <C-l> <C-W>l

    "Actually, the tab does not switch buffers, but my arrows
    "Bclose function ca be found in "Buffer related" section
    map <leader>bd :Bclose<cr>
    map <down> <leader>bd
    "Use the arrows to something usefull
    map 
    <right> :bn<cr>
    map 
    <left> :bp<cr>

    "Tab configuration
    map <leader>tn :tabnew %<cr>
    map <leader>te :tabedit
    map <leader>tc :tabclose<cr>
    map <leader>tm :tabmove
    try
      set switchbuf=usetab
      set stal=2
    catch
    endtry

    "Moving fast to front, back and 2 sides ;)
    imap 
    <m-$> <esc>$a
    imap 
    <m-0> <esc>0i
    imap 
    <D-$> <esc>$a
    imap 
    <D-0> <esc>0i


    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " General Autocommands
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Switch to current dir
    map 
    <leader>cd :cd %:p:h<cr>


    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Parenthesis/bracket expanding
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    vnoremap 
    $1 <esc>`>a)<esc>`<i(<esc>
    ")
    vnoremap $2 <esc>`>a]<esc>`<i[<esc>
    vnoremap $3 <esc>`>a}<esc>`<i{<esc>
    vnoremap $$ <esc>`>a
    "<esc>`<i"<esc>
    vnoremap $q <esc>`>a'<esc>`<i'<esc>
    vnoremap $w <esc>`>a
    "<esc>`<i"<esc>

    "Map auto complete of (, ", ', [
    inoremap $1 ()<esc>:let leavechar=
    ")"<cr>i
    inoremap $2 []<esc>:let leavechar=
    "]"<cr>i
    inoremap $4 {<esc>o}<esc>:let leavechar=
    "}"<cr>O
    inoremap $3 {}<esc>:let leavechar=
    "}"<cr>i
    inoremap $q ''<esc>:let leavechar=
    "'"<cr>i
    inoremap $w 
    ""<esc>:let leavechar='"'<cr>i
    au BufNewFile
    ,BufRead *.(vim)@! inoremap " ""<esc>:let leavechar='"'<cr>i
    au BufNewFile
    ,BufRead *.(txt)@! inoremap ' ''<esc>:let leavechar="'"<cr>i

    imap 
    <m-l> <esc>:exec "normal f" . leavechar<cr>a
    imap 
    <d-l> <esc>:exec "normal f" . leavechar<cr>a


    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " General Abbrevs
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "My information
    iab xdate 
    <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
    iab xname Amir Salihefendic


    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Editing mappings etc.
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Remap VIM 0
    map 
    0 ^

    "Move a line of text using control
    nmap <M-j> mz:m+<cr>`z
    nmap <M-k> mz:m-2<cr>`z
    vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
    vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z

    if MySys() == 
    "mac"
      nmap <D-j> <M-j>
      nmap <D-k> <M-k>
      vmap <D-j> <M-j>
      vmap <D-k> <M-k>
    endif

    func! DeleteTrailingWS()
      exe 
    "normal mz"
      %s/s+$//ge
      exe 
    "normal `z"
    endfunc
    autocmd BufWrite *.py :call DeleteTrailingWS()

    set completeopt=menu

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Command-line config
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    func! Cwd
    ()
      let cwd 
    = getcwd()
      
    return "" . cwd 
    endfunc

    func! DeleteTillSlash
    ()
      let g
    :cmd = getcmdline()
      
    if MySys() == "linux" || MySys() == "mac"
        let g
    :cmd_edited = substitute(g:cmd, "\(.*[/]\).*", "\1", "")
      
    else
        let g
    :cmd_edited = substitute(g:cmd, "\(.*[\\]\).*", "\1", "")
      endif
      
    if g:cmd == g:cmd_edited
        
    if MySys() == "linux" || MySys() == "mac"
          let g
    :cmd_edited = substitute(g:cmd, "\(.*[/]\).*/", "\1", "")
        
    else
          let g
    :cmd_edited = substitute(g:cmd, "\(.*[\\]\).*[\\]", "\1", "")
        endif
      endif
      
    return g:cmd_edited
    endfunc

    func! CurrentFileDir
    (cmd)
      
    return a:cmd . " " . expand("%:p:h") . "/"
    endfunc

    "Smart mappings on the command line
    cno $h e ~/
    cno $d e ~/Desktop/
    cno $j e ./

    cno $q <C->eDeleteTillSlash()<cr>

    cno $c e <C->eCurrentFileDir(
    "e")<cr>