Skip to Content

Vim

  • strict warning: Non-static method view::load_views() should not be called statically in /var/www/drupal_module/views/views.module on line 864.
  • strict warning: Non-static method view::db_objects() should not be called statically in /var/www/drupal_module/views/includes/view.inc on line 1417.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /var/www/drupal_module/views/handlers/views_handler_argument.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /var/www/drupal_module/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /var/www/drupal_module/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter_node_status::operator_form() should be compatible with views_handler_filter::operator_form(&$form, &$form_state) in /var/www/drupal_module/views/modules/node/views_handler_filter_node_status.inc on line 0.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /var/www/drupal_module/views/plugins/views_plugin_style_default.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /var/www/drupal_module/views/plugins/views_plugin_row.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /var/www/drupal_module/views/plugins/views_plugin_row.inc on line 0.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Only variables should be passed by reference in /var/www/truevue.org/sites/all/themes/zeropoint/template.php on line 341.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/drupal_module/views/views.module on line 906.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/drupal_module/views/views.module on line 906.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/drupal_module/views/views.module on line 906.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/drupal_module/views/views.module on line 906.
  • strict warning: Declaration of views_handler_field_comment::init() should be compatible with views_handler_field::init(&$view, $options) in /var/www/drupal_module/views/modules/comment/views_handler_field_comment.inc on line 0.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /var/www/drupal_module/views/handlers/views_handler_filter_boolean_operator.inc on line 0.

vim匹配查找重复的行

原来对文件中重复行的处理就是用Vim的命令sort u进行删除,不过有个缺点是不知道具体哪些内容有重复,其实Vim中可以直接查找匹配重复的行,那么对文件中重复的内容就一目了然了。

Vim删除不包含指定字符串的行

Vim 删除不包含指定字符串的行:

:g/xxx/d,删除包含xxx的行

:v/xxx/d,删除不含xxx的行

Vi餐馆 (Vi Restaurant)

美国的Vi餐馆。Vim真厉害啊,居然可以用Vi开餐馆,Vim真是无所不在啊。

vimrc file back up

Back my vimrc file:

Vim 文件与字符统计

Vim中有两种方法可以统计当前文件的大小,包括字符数,单词数等。

第一种 使用替换功能:

字符替换后,会出现替换了多少次等说明信息,我们根据这个信息就可以统计文件的字符数,大小等信息。

  • 统计字符数::%s/./&/gn
  • 统计单词数::%s/\i\+/&/gn
  • 统计行数::%s/^//n
  • 统计指定单词::%s/the/&/gn 任何地方出现的 "the"

第二种 使用Vim命令

vim中改变显示颜色

vim 在新的标签页(tab)打开help

open help window in a new tab.

:tab h pattern

vim中使用重定向

:redir 可以将vim的命令行输出重定向到文件中

例子:
:redir!>/tmp/vim-setting.txt|:set all

在linux下面可以直接使用下面的命令
vim -c ':redir!>/tmp/all-my-settings.txt|:set|q' ; vim /tmp/all-my-settings.txt

使用vim在行首加入行号

有下面几种方法:

  • :%s/^/\=line(".")." "/
  • :%s/^/\=printf('%4s ',line('.'))

vim 替换技巧 (zz)

这两个技巧是近期看到的,记录下来,以免忘记。

[技巧一]

第一个是在VIM邮件列表中看到的,给出了一个如何统计文章字数的方法。

聚合内容