Tips

Tips

/******************

001_c.vim

002_Source Insight

003_PUTTY connect VMware

004_redhat linux纯字符界面启动

005_防火墙相关的命令

*****************/

001_c.vim

 

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

              1.~/.vim/c-support/templates/Templates可以设置版权信息,如作者、信箱、版权归属等,新建.c.cpp文件是可以看到,并且列出了使用模板文件位置,可以自己编辑

              2.\if    插入一般函数

              3.\im    插入主函数

              4.\cfu    插入函数头,即函数说明

              5.\cfr    插入一个frame comment,可以用来写变量说明

              6.\p

              7.\rc    保存并编译

              8.\rr   运行

              9.\nr    可以在~/.vim/c-support/codesnippets中编写一些预编译代码或者代码块,通过此命令使用

             

              -- Help ---------------------------------------------------------------

                \hm       show manual for word under the cursor (n,i)

                \hp       show plugin help                      (n,i)

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

                \cl       end-of-line comment                 (n,v,i)

                \cj       adjust end-of-line comment(s)       (n,v,i)

                \cs       set end-of-line comment column      (n)

                \c* comment /">       code -> comment /*[/b] */               (n,v)

                \cc       code -> comment //                  (n,v)

                \co       comment -> code                     (n,v)

                \cfr      frame comment                       (n,i)

                \cfu      function comment                    (n,i)

                \cme      method description                  (n,i)

                \ccl      class description                   (n,i)

                \cd       date                                (n,v,i)

                \ct       date \& time                        (n,v,i)

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

                \sd       do { } while                        (n,v,i)

                \sf       for                                 (n,i)

                \sfo      for { }                             (n,v,i)

                \si       if                                  (n,i)

                \sif      if { }                              (n,v,i)

                \sie      if else                             (n,v,i)

                \sife     if { } else { }                     (n,v,i)

                \sw       while                               (n,i)

                \swh      while { }                           (n,v,i)

                \ss       switch                              (n,v,i)

                \sc       case                                (n,i)

                \s{       { }                                 (n,v,i)

                -- Preprocessor -------------------------------------------------------

                \p                         (n,i)

                \p"       #include ""                         (n,i)

                \pd       #define                             (n,i)

                \pu       #undef                              (n,i)

                \pie      #if  #else #endif                   (n,v,i)

                \pid      #ifdef #else #endif                 (n,v,i)

                \pin      #ifndef #else #endif                (n,v,i)

                \pind     #ifndef #def #endif                 (n,v,i)

                \pi0      #if 0 #endif                        (n,v,i)

                \pr0      remove #if 0 #endif                 (n,i)

                \pe       #error                              (n,i)

                \pl       #line                               (n,i)

                \pp       #pragma                             (n,i)

                -- Idioms -------------------------------------------------------------

                \if       function                            (n,v,i)

                \isf      static function                     (n,v,i)

                \im       main()                              (n,v,i)

                \i0       for( x=0; x=0; x-=1 )            (n,v,i)

                \ie       enum   + typedef                    (n,i)

                \is       struct + typedef                    (n,i)

                \iu       union  + typedef                    (n,i)

                \ip       printf()                            (n,i)

                \isc      scanf()                             (n,i)

                \ica      p=calloc()                          (n,i)

                \ima      p=malloc()                          (n,i)

                \isi      sizeof()                            (n,v,i)

                \ias      assert()                            (n,v)

                \ii       open input file                     (n,i)

                \io       open output file                    (n,i)

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

                \nr       read code snippet                   (n,i)

                \nw       write code snippet                  (n,v,i)

                \ne       edit code snippet                   (n,i)

                \np       pick up prototype                   (n,v,i)

                \ni       insert prototype(s)                 (n,i)

                \nc       clear  prototype(s)                 (n,i)

                \ns       show   prototype(s)                 (n,i)

                \ntl      edit local templates                (n,i)

                \ntg      edit global templates               (n,i)

                \ntr      rebuild templates                   (n,i)

                -- C++ ----------------------------------------------------------------

                \+co      cout  package

               

002_Source Insight

                     1、背景色选择

                         要改变背景色Options->preference->windows background->color设置背景色

                     2、解决字符等宽对齐问题。

                         SIS默认字体是VERDANA,很漂亮。这网页上应该也是用的VERDANA字体。但由于美观的缘故,VERDANA字体是不等宽的。比如下面两行

                         llllllllll

                         MMMMMMMMMM

                         同样10个字符,长度差多了.VERDANA来看程序,有些本应该对齐的就歪了。解放方法是使用等宽的字体,但肯定比较丑。比较推荐的是用Courier New

                     3、解决TAB键缩进问题

                         Options-> Document Options里面的右下角Editing Options栏里,把Expand tabs勾起来,然后确定。OK,现在TAB键的缩进和四个空格的缩进在SIS里面看起来就对齐咯

                    

                     4SI中的自动对齐设置:

                         C程序里, 如果遇到行末没有分号的语句,IF, WHILE, SWITCH, 写到该行末按回车,则新行自动相对上一行缩进两列。

                         Option->Document option下的Auto IndientAuto Indient Type有三种类型 None,Simple,Smart。个人推荐选用Simple类型。

                     5、向项目中添加文件时,只添加特定类型的文件(文件类型过滤器)

                         编辑汇编代码时,在SIS里建立PROJECTADD TREE的时候,根据默认设置并不会把该TREE里面所有汇编文件都包含进来

                         只加了.inc.asm后缀的,.s后缀的没有。而且用SIS打开.s的文件,一片黑白没有色彩,感觉回到DOSEDIT时代了……

                         解决方法是在Options->Document Options里面,点左上的Document Type下拉菜单,选择x86 Asm Source File

                         然后在右边的File filter*.asm*.inc;的后面加上*.s;接着CLOSE就可以了。

                         上面问题解决了,但注意加入*.s后还需要重新ADD TREE一遍才能把这些汇编加到PROJECT里面。

                     6、添加文件类型

                         用户可以定义自己的类型,Options->Document Options->add type,定义文件类型名以及文件名后缀。

                         勾选include when adding to projects在添加目录下文件到工程是该类文件就会添加进SI的工程。

                         如果需要将所有文件添加进SI的工程,可以定义一种文件类型*.*  

                     7、恢复ctrl+a的全选功能

                         通过关键词save 找到save all,更改为ctrl+shift+a,通过关键词select找到select all,更改为ctrl +a

                    

                     Source Insight常用的快捷键:

                         Ctrl+= :Jump to definition

                         Alt+/ :Look up reference

                         F3 : search backward

                         F4 : search forward

                         F5: go to Line

                         F7 :Look up symbols

                         F8 :Look up local symbols

                         F9 :Ident left

                         F10 :Ident right

                         Alt+, :Jump backword

                         Alt+. : Jump forward

                         Shift+F3 : search the word under cusor backward

                         Shift+F4 : search the word under cusor forward

                         F12 : incremental search

                         Shift+Ctrl+f: search in project

                         shift+F8 : hilight word

                        

                     Source Insight的窗口操作:

                         project window Ctrl+O打开

                         symbol window Alt+F8打开和关闭

                         Contex Window 自定义键打开和关闭

                         Relation Window 自定义键打开 先锁定再刷新联系

                        

003_PUTTY connect VMware

 

1. If the error info is "connection timeout" you should launch the ssh service.

              /sbin/service sshd start

2. If "“connection reset by peer”", firewall should be closed.

              1) % setup

              2) firewall==>customize==> select ssh

             

004_redhat linux纯字符界面启动

 

1.    编辑/etc/inittab文件。找到id:5: initdefault:这一行,将它改为id:3:initdefault

 

 

005_防火墙相关的命令

              service iptables stop

              service iptables start

              redhat-config-securitylevel

             

              永久关闭防火墙

             

              service iptables sto

              chkconfig iptables off

你可能感兴趣的:(Tips)