vim

what do the + signs mean in vimscript regex strings

扶醉桌前 提交于 2019-12-24 02:05:24
问题 You can find this syntax being commonly used in syntax vimscripts. For example you can find it in the file <vimdir>\syntax\python.vim on line 113 in vim 7.4 (win7): syn match pythonEscape +\\[abfnrtv'"\\]+ contained My simple question is what do the + signs mean at the either end of the regex string literal? I could not find anything with :help literal-string and :help regex or steve losh's book. Where do you think I should have been looking? 回答1: They are indeed the start and end of the

LVS负载均衡群集之NAT模式搭建 (实践篇)

为君一笑 提交于 2019-12-24 01:56:23
实验原理图 实验环境 LVS调度器作为web服务器池的网关 LVS服务器配置两块网卡分别连接内外网 使用轮询(rr)调度算法 LVS负载调度器网段规划 内网33网关:192.168.144.1 外网36:12.0.0.1 web1 192.168.144.151 web2 192.168.144.170 nfs服务器 192.168.144.145 client测试机 12.0.0.12 实践操作 在NFS服务器上添加两块硬盘,做共享存储使用,格式化 在虚拟机上添加硬盘 [root@nfs ~]# fdisk /dev/sdb //分区 令(输入 m 获取帮助):n //创建新分区 Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p //主分区 分区号 (1-4,默认 1): //回车默认选项 起始 扇区 (2048-41943039,默认为 2048): //回车默认选项 将使用默认值 2048 Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039): //回车默认选项 将使用默认值 41943039 分区 1 已设置为 Linux 类型,大小设为 20 GiB 命令(输入 m 获取帮助):w

Nginx+Tomcat负载均衡群集搭建

倖福魔咒の 提交于 2019-12-24 01:53:21
Tomcat简介 Tomcat最初是由Sun的软件构架师詹姆斯邓肯.戴维森开发 安装完Tomcat后安装路径下面的目录和文件,是使用或者配置Tomcat的重要文件 Tomcat重要目录 bin:存放启动和关闭Tomcat脚本 conf:存放Tomcat不同的配置文件 doc:存放Tomcat文档 lib/japser/common:存放Tomcat运行需要的库文件 logs:存放Tomcat执行时的LOG文件 src:存放Tomcat的源代码 webapps:Tomcat的主要Web发布目录 work:存放jsp编译后产生的class文件 Nginx应用 Nginx是一款非常优秀的HTTP服务器软件 支持高达50 000个并发连接数的响应 拥有强大的静态资源处理能力 运行稳定 内存、CPU等系统资源消耗非常低 目前很多大型网站都应用Nginx服务器作为后端网站程序的反向代理及负载均衡器,提升整个站点的负载并发能力 Nginx负载均衡实现原理 Nginx实现负载均衡是通过反向代理来实现的 反向代理原理 Nginx配置反向代理的主要参数 upstream服务池名{ } 配置后端服务器池,以提供响应数据 proxy_pass http://服务池名 配置将访问请求转发给后端服务器池的服务器处理 Nginx+Tomcat负载均衡群集实验 实验环境 Nginx服务器IP地址:192.168

How do I override gf with vim-rails

十年热恋 提交于 2019-12-24 01:41:25
问题 I've written a Vimscript function - CoffeeScriptIncludeExpr - that when assigned to includeexpr , allows me to use gf to open a CoffeeScript file when the cursor is on its classname. However, this doesn't work in a Rails project. My vimrc contains the following autocmd User Rails.javascript.coffee* set includeexpr=CoffeeScriptIncludeExpr() autocmd User Rails.javascript.coffee* set path=app/assets/javascripts/** which I had hoped would have the desired effect. If I type gf in a CoffeeScript

How to map a sequence in vim conditionally to run external programs without printing the else clause

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 01:40:14
问题 How can I map a sequence in vim conditionally to run any of two external programs in such way that the screen is not cleared to show the else clause? For example: :nmap <c-l> :if filereadable('Makefile')<CR>!make<CR>else<CR>!ls<CR>endif<CR> ctrl + m executes make but then clears the screen and prints the following at the bottom of it: : else : !ls : endif Press ENTER or type command to continue 回答1: You can use an expression mapping ( :help map-expr ) :nnoremap <expr> <c-m> filereadable(

Autoindent : smartindent and indentexpr

社会主义新天地 提交于 2019-12-24 01:19:45
问题 When I'm editing a Python file, for example: def my_func(): print('Something') <-- CURSOR IS HERE and I want to add a comment by typing a # , the line is automatically reindenting to the very beginning of the line: def my_func(): print('Something') #<-- CURSOR IS HERE I found that it's an effect of the smartindent option, so to fix it, I just have to run :set nosi (or disable it in my .vimrc). But in Vim's help, in :h 'smartindent' , you can read this: When 'cindent' is on or 'indentexpr' is

Hadoop 黑白名单,新节点

吃可爱长大的小学妹 提交于 2019-12-24 01:03:43
1、hadoop动态增加新节点 1、添加主机映射 vim /etc/hosts,这里是node4 192.168.88.135 master0 192.168.88.136 master1 192.168.88.137 node1 192.168.88.139 node2 192.168.88.138 node3 192.168.88.145 node4 2、更改主机名为node4 vim /etc/sysconfig/network NETWORKING=yes HOSTNAME=node4 3、配置静态ip,然后重启reboot vim /etc/sysconfig/network-scripts/ifcfg-eth0 vim /etc/udev/rules.d/70-persistent-net.rules DEVICE=eth0 TYPE=Ethernet UUID=27b5d0ea-0df8-4909-a0f6-5e405f2ab682 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none HWADDR=00:0c:29:bb:d0:e2 DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no NAME="System eth0" LAST

How to Eatchar in a multi-line Vim abbreviation

耗尽温柔 提交于 2019-12-24 00:59:47
问题 I would like to trigger a multi line abbreviation in Vim, without entering the 'trigger' character, and with the cursor ending in insert mode at a particular location. I am nearly there, but just failing to make it. Thus far, i have added the following to my _vimrc: " eat characters after abbreviation function! Eatchar(pat) let c = nr2char(getchar(0)) return (c =~ a:pat) ? '' : c endfunction iabbr <silent> if if ()<left><C-R>=Eatchar('\s')<CR> :iabbr <silent> rfF <- function( )<CR>{<CR> <CR>}

Vim key mapping works in command editor, not in .vimrc - why?

▼魔方 西西 提交于 2019-12-24 00:55:43
问题 When I create the following key mapping via the command buffer it works as expected moving the cursor 5 lines down: map ^[[1;3B 5<Down> When I add it to my .vimrc file so that it works across sessions, pressing Alt+Down moves backwards 1 line (to somewhere not vertically above - maybe it's going to a previous sentence). My :map output is this: 0 ^ ^[[1;3B 5<Down> n gx <Plug>NetrwBrowseX n <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR> Press ENTER or type command to

How to replace finding words with the different in each occurrence in VI/VIM editor ?

和自甴很熟 提交于 2019-12-24 00:52:54
问题 For example, I have a text , 10 3 4 2 10 , 4 ,10 .... No I want to change each 10 with different words I know %s/10/replace-words/gc but it only let me replace interactively like yes/no but I want to change each occurrence of 10 with different words like replace1, 3, 4 , 2 , replace2, 4, replace3 .... 回答1: Replaces each occurence of 10 with replace{index_of_match} : :let @a=1 | %s/10/\='replace'.(@a+setreg('a',@a+1))/g Replaces each occurence of 10 with a word from a predefined array: :let b