每天一个小功能(vim等)

2011-11-17

  1. vim基本配置
    set nocompatible
    set columns=80
    set tabstop=4
    set ruler
    set expandtab
    set number
    set ignorecase
    set wrapmargin=15
    set cindent
    set shiftwidth=4
    syntax on


    代码着色 显示行号 等:

  2. vim tab键变为4个空格
    set expandtab # 使用space代替tab.
    set tabstop=4 # 四个空格。
     set shiftwidth=4 # 自动缩进的宽度。
  3. ssh的退格键 (OT)
    经常出现进入python交互后,按退格键 出现 “^H^H^H” 而不是删除字符
     option->session option ->Terminal->Emulation->mapping keys other mappings 里勾选Backspace sends delete
  4. jmeter无界面方式运行:
    JMeter -n -t "xxx.jmx" -l test.log
  5. Linux的grep命令中使用OR,AND,NOT操作符
    OR:
    1 grep 'pattern1\|pattern2' filename
    2 grep -E 选项可以用来扩展选项为正则表达式。 如果使用了grep 命令的选项-E,则应该使用 | 来分割多个3 pattern,以此实现OR操作。
    4 egrep 命令等同于‘grep -E’
    AND:
    1 使用 -E 'pattern1.*pattern2'
    2 多个grep
    NOT:
    grep -v 'pattern1' filename
  6. vim显示行号
    加上 :se number
     关掉用:se nonumber
  7. vim同时显示多个文件:
    :split
    :vsplit
  8. 打开多个 vim file1 file2
    Ctrl+w 切换
  9. taglist 和 WinManager插件
    可显示当前文件程序结构和目录文件结构
    http://www.vim.org/scripts/script.php?script_id=273
    http://www.vim.org/scripts/script.php?script_id=95
    更多插件配置见 http://blog.csdn.net/wooin/article/details/1858917
  10. 查询当前用户下程序占用的端口
    1 lsof -i :端口 号 (可能需要安装软件包)
    2 netstat -tulpn
  11. 自启动脚本
    避免服务器意外故障时的重启
    /etc/rc.d/rc.local 里加入启动sh 脚本即可
原文地址:https://www.cnblogs.com/shenguanpu/p/2299785.html