让vim变得更简单(vim support)

本文介绍了一个名为vimsupport的vim插件,它提供了许多自动化功能来帮助用户快速编写bash脚本。文章详细介绍了插件的下载、安装、配置以及如何使用插件的快捷键进行代码编辑和格式化。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

简介

vim support是一个加快速写bash脚本的插件,其中抱恨很多自动化的函数的格式补充等功能 对于我这样的老是记不住bash格式的人来说太好用了

vim support下载

http://www.vim.org/scripts/script.php?script_id=365

vim support 安装

cd /opt/setup/ # download vim support source wget -O bash-support.zip http://www.vim.org/scripts/download_script.php?src_id=20562 mkdir /root/.vim cd /root/.vim unzip /opt/bash-support.zip -d /root/.vim

vim support 配置

修改脚本自动化署名
vim /root/.vim/bash-support/templates/Templates
修改显示的head如下:
SetMacro( 'AUTHOR', 'Eric Wu' ) SetMacro( 'COMPANY', 'Chengdu 1K8K Technology Co., Ltd.' ) SetMacro( 'COPYRIGHT', 'Copyright (c) | 2013 | EicWu' ) SetMacro( 'EMAIL', 'mesopodamia@gmail.com' ) SetMacro( 'LICENSE', 'GNU General Public License' )
修改需要显示的条目:
== Comments.file header == start, map:ch == #!/usr/bin/env bash #======================================================== # # FILE: |FILENAME| # # USAGE: ./|FILENAME| # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # NOTES: --- # AUTHOR: |AUTHOR|, |EMAIL| # COMPANY: |COMPANY| # CREATED: |DATE| |TIME| # REVISION: --- #========================================================
初始化vim配置
touch /root/.vimrc echo "set number" >> /root/.vimrc echo "set autoindent" >> /root/.vimrc
* 以上是操作是显示行数和代码自动对齐 vim support快捷键汇总
-- bash help ------------------------------------------

    \hb     Displays the Bash manual         (n, i)
    \hh     Displays help for the builtin    (n, i)
            under the cursor (Bash help).
            The tab expansion is active.
    \hm     displays the manual for the      (n, i)
            Bash command under the cursor
            The tab expansion is active.
    \hbs    Displays the Vim help page for   (n, i)
            this plugin.

 -- Comments -------------------------------------------

 [n]\cl     line end comment                 (n, i, v)
 [n]\cj     adjust end-of-line comments      (n, i, v)
    \cs     set end-of-line comment column   (n)
    \cfr    frame comment                    (n, i)
    \cfu    function description             (n, i)
    \ch     file header                      (n, i)
    \ckb    keyword comment BUG              (n, i)
    \ckt    keyword comment TODO             (n, i)
    \ckr    keyword comment TRICKY           (n, i)
    \ckw    keyword comment WARNING          (n, i)
    \ckn    keyword comment New_Keyword      (n, i)
 [n]\cc     toggle comment                   (n, i, v)
    \cd     date                             (n, i, v)
    \ct     date & time                      (n, i, v)
    \ce     echo "..."                       (n, i)
    \cr     remove echo "..."                (n, i)
    \css    script sections (tab completion) (n, i)
    \ckc    keyword comments(tab completion) (n, i)
    \cv     vim modeline                     (n, i)

 -- Statements ------------------------------------------

    \sc     case in ... esac                 (n, i)
    \sei    elif then                        (n, i)
    \sf     for in do done                   (n, i, v)
    \sfo    for ((...)) do done              (n, i, v)
    \si     if then fi                       (n, i, v)
    \sie    if then else fi                  (n, i, v)
    \ss     select in do done                (n, i, v)
    \su     until do done                    (n, i, v)
    \sw     while do done                    (n, i, v)
    \sfu    function                         (n, i, v)
    \se     echo -e "..."                    (n, i, v)
    \sp     printf "..."                     (n, i, v)
    \sa     array element ${.[.]}            (n, i, v)
    \saa    array elements ${.[@]}           (n, i, v)
    \sa1    array elements, 1 word ${.[*]}   (n, i, v)
    \ssa    subarray ${.[@]::}               (n, i, v)
    \san    no. of array elements ${#.[@]}   (n, i, v)
    \sai    list of arr. indices ${!.[*]}    (n, i, v)

 -- Snippets --------------------------------------------

    \nr     read code snippet                (n, i)
    \nw     write code snippet               (n, v, i)
    \ne     edit code snippet                (n, i)
    \ntl    edit local templates             (n, i)
    \ntg    edit global templates            (n, i)
    \ntr    reread the templates             (n, i)
    \nts    switch template style            (n, i)

 -- Test ------------------------------------------------

    \t1     unary operator, 1 arg.: \verb'[ -  ]'  (n, i)
    \t2     binary operator, 2 arg: \verb'[  -  ]' (n, i)

 -- Regular Expression ----------------------------------

    \xm  =~  (n, i)

 -- POSIX Character Classes -----------------------------

    \pan    [:alnum:]                        (n, i)
    \pal    [:alpha:]                        (n, i)
    \pas    [:ascii:]                        (n, i)
    \pb     [:blank:]                        (n, i)
    \pc     [:cntrl:]                        (n, i)
    \pd     [:digit:]                        (n, i)
    \pg     [:graph:]                        (n, i)
    \pl     [:lower:]                        (n, i)
    \ppr    [:print:]                        (n, i)
    \ppu    [:punct:]                        (n, i)
    \ps     [:space:]                        (n, i)
    \pu     [:upper:]                        (n, i)
    \pw     [:word:]                         (n, i)
    \px     [:xdigit:]                       (n, i)

 -- Run -------------------------------------------------

    \rr     update file, run script          (n, i)
    \ra     set script cmd. line arguments   (n, i)
    \rba    set Bash cmd. line arguments     (n, i)
    \rc     update file, check syntax        (n, i)
    \rco    syntax check options             (n, i)
    \rd     start debugger                   (n, i)
    \re     make script executable           (n, i)
    \rh     hardcopy buffer to FILENAME.ps   (n, i)
    \rs     settings and hot keys            (n, i)
    \rt     set xterm size                   (n, i)
    \ro     change output destination        (n, i)

 -- Load / Unload bash Support --------------------------

    \lbs    Load Bash Support                (n, GUI only)
    \ubs    Unload Bash Support              (n, GUI only)
 

转载于:https://my.oschina.net/mesopotamia/blog/410133

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值