vim

VIM how to replace “AA” to “BB” in a file

喜夏-厌秋 提交于 2019-12-25 02:39:10
问题 I need to replace a file which has thousand of lines code. In the log, it has a specific word which I want to replace this work with some other words. Say, how to replace all "AA" to "BB" in this file? thanks 回答1: You want to use :%s/\<AA\>/BB/g % specifies that you want to replace on all lines. s tells vim that you want to do a substitution Between the first / and second / is what you want to replace (ie \<AA\> ). The \< and the \> are word boundaries , making sure that AA is matched but fAA

vimscript using another file instead of .viminfo

一曲冷凌霜 提交于 2019-12-25 02:32:09
问题 I installed a vimscript written by expert in this question. But there is one problem in the script. When I restart the computer, the bookmarks saved by the script will disappear. Is it possible to store the bookmarks to another file (e.g. mybookmarks.txt ) instead of .viminfo file? Bookmarks stored in .viminfo disappear unpredictably. 回答1: Since it seems like a good tool in general, I extracted it to a plugin: http://www.vim.org/scripts/script.php?script_id=3826. This would store bookmarks

vim-powerline plugin in ConEmu

冷暖自知 提交于 2019-12-25 01:54:13
问题 I'm configuring the Vim and ConEmu to work on my Win8 as on my Fedora distro. After problems with getting to work the 256 colors in ConEmu for my color schema seoul256, now I have problems with the vim-powerline colors. In gvim there is no problem, only in the console. It looks that So how can I get it to work? 来源: https://stackoverflow.com/questions/23446550/vim-powerline-plugin-in-conemu

Linux基础命令对应练习

浪尽此生 提交于 2019-12-25 01:49:02
对应练习 路径练习 新建目录——mkdir练习 复制——cp练习 移除文件或目录——rm练习 移动文件与目录,或更名——mv练习 直接查看文件内容——cat练习 修改文件时间或建新档——touch练习 程序编辑器——vim练习 vim练习答案 参考来源 路径练习 #终端的默认路径 ~ root@kali:~ # #表示去根目录 root@kali:~ # cd / #表示去用户的家目录 root@kali:/ # cd ~ #表示回到刚刚工作的目录,这里指根目录 root@kali:~ # cd - / #不加路劲,默认代表去家目录 root@kali:/ # cd #代表去上级目录 root@kali:~ # cd .. 新建目录——mkdir练习 #表示到/tmp目录下 root@kali:~ # cd /tmp #建立名为test的新目录, root@kali:/tmp # mkdir test #成功 #建立test1下test2下的test3新目录 root@kali:/tmp # mkdir test1/test2/test3 mkdir: cannot create directory ‘test1/test2/test3’: No such file or directory #失败了,系统不能建立这个目录

How can I tell vim where my _vimrc and plugins are

江枫思渺然 提交于 2019-12-25 01:48:52
问题 At work I have gvim installed in C:/Program Files/vim but have no write permission on this folder. I would like vim to use my personal _vimrc and potentially some addins that would be in a bundle directory. Problem is that vim choose the default _vimrc in C:/... What can I do to fix my problem, I was thinking of a script but I can't manage in writing one that work... ? EDIT: Off course I do not have admin rights 回答1: Your configuration belongs in %HOME% (or %USERPROFILE% if the former isn't

For selected lines, put each scentence on a new line with vim

别来无恙 提交于 2019-12-25 00:38:13
问题 My vim buffer contains lines with more then one sentence. How can I make each sentence start on an new line? I do not want to insert extra empty lines between sentences that already start on a new line. I can replace each . by .\n %s/\./\.\n/ but that insert a new line also when there already is a new line after a sentence. Edit: If the line starts with % then I want to leave that line as it is. 回答1: You can try this: :%s/\([?.!]\)\s\(\w\)/\1\r\2/g A lookbehind to make sure the line does not

Number pane not being highlighted in vim dracula theme

♀尐吖头ヾ 提交于 2019-12-24 22:54:49
问题 I am using dracula theme for vim and am not able to get the number pane, that is, the side panel which contains the line numbers, to be displayed in a sort of translucent manner. The preview image shows that it's possible. How the terminal should look like How it actually looks To fix this issue, I think I need to configure some attributes accordingly, but being a beginner, I don't know which ones, therefore any help and guidance would be appreciated. As a reference, these are my dotvim files

Disabling vim's location list on missing C header file

邮差的信 提交于 2019-12-24 20:28:16
问题 Vim is pretty smart when it comes to C, so if one inserts a bogus header file such as #include <stdioo.h> , it complains by bringing up a location list with the following error: foo.c:1|20| fatal error: stdioo.h: No such file or directory || compilation terminated. Which is great, but for whatever reason, I get the same error when including the <mpi.h> header file. I know this is a vim problem b/c I can compile and execute the program with mpicc and mpiexec , respectively. Besides it being

How to convert windows console output to utf8 in VIM

拈花ヽ惹草 提交于 2019-12-24 18:51:01
问题 I want to execute a system command from gvim and retrieve the output of that command in the current buffer. So i run the following command in gvim: :r echo éèà However the result shows three black squares instead of the echoed characters. I have not yet figure out what to do to get this to work. I have the following encoding setup: set encoding=utf8 set termencoding=cp850 My windows console encoding is cp850. 回答1: TL;DR :r! echo éèà | c:\cygwin\bin\iconv -f cp850 -t cp1252 Assumptions I have

构建虚拟Web主机实例

空扰寡人 提交于 2019-12-24 18:26:55
构建虚拟Web主机实例 虚拟web主机的定义: ●在同一台服务器中运行多个Web站点,其中每一个站点并不独立占用一台真正的计算机 虚拟主机的优势: ​ 虚拟Web主机指的是在同一台服务器中运行多个Web站点,其中的每一个站点实际上并不独自占用整个服务器,因此 被称为“虚拟Web主机”。 通过虚拟Web主机服务可以充分利用服务器的硬件资源,从而大大降低网站构建及运行成本。 httpd支持的虚拟主机类型: ●基于域名的虚拟主机 (应用最为广泛) ●基于IP地址的虚拟主机 ●基于端口的虚拟主机 特征关系对应分别如下 ip相同、端口相同,域名不同; ip不同,端口不同; ip相同,端口不同。 1)基于域名构建示例 构建两个虚拟web站点 1.www.jj.com 2.www.kk.com 实际流程如下: 使用一台httpd服务器搭建,ip地址为192.168.68.145.具体构建过程如下: 1.为虚拟主机提供域名解析 安装bind和httpd服务:yum install -y bind httpd [root@localhost ~]# vim /etc/named.conf [root@localhost ~]# head -21 /etc/named.conf |tail options { listen-on port 53 { any; }; listen-on-v6 port