vim

what is the meaning of \ | in a map vim command?

↘锁芯ラ 提交于 2019-12-20 03:03:25
问题 Here is a map command. nnoremap <F5> :w\|!R %<CR> 1.what is the meaning of \ here? 2. does | mean pipe ? 回答1: The | character separates two Ex commands, see :help :| . It's like ; in programming languages like C and Java. It has nothing to do with pipes; Vim hasn't that concept (which is typically found in shells). It is escaped here so that the entire command sequence belongs to the mapping; i.e. it maps to :w|!R %<CR> . Without escaping, Vim would execute the following instead: :nnoremap

Java (Eclim + Vim) “system.out.print” not working

流过昼夜 提交于 2019-12-20 03:03:22
问题 I am new to Java programming, and today while messing with eclim and vim, I discovered that the System.out.println(); function is not working. class apples{ public static void main(String args[]){ double tuna = 5.28; System.out.print(tuna); } } This does not give me a result. But when I do: class apples{ public static void main(String args[]){ double tuna = 5.28; System.out.println(tuna); } } (The only difference is the "println") I get 5.28, the correct behavior. Anyone know why this would

Defining my own command

*爱你&永不变心* 提交于 2019-12-20 02:54:34
问题 I'm trying to define my own command in MacVim to turn a c statement or range of statements into comments. So I put this in my vimrc: command -range Com :<line1>,<line2>s?^.*$?/*&*/? It works fine if I just enter :Com to comment the current line. But if I enter something like :Com 3 5 in order to turn lines 3 thru 5 into comments I always get this error message: E488: Trailing characters Can anyone help? 回答1: You need to provide the range before the command, like that: :3,5Com Anyway, I

vim temporary disable undo?

北城余情 提交于 2019-12-20 02:42:24
问题 I followed add-custom-header-to-your-file to create my own custom header plugin. When I save the file it will auto. update the current date time to Last-Modified field. But this will add a edit history to undo list. How can I disable the undo temporary ? 回答1: You cannot disable undo without losing the undo history. Think about the undo implementation; would be pretty hard if you had a gap in there. If you don't worry about losing the history, :set undolevels=-1 (and then restoring to the

ubuntu install git vim Plug manage

*爱你&永不变心* 提交于 2019-12-20 02:14:59
在UBUNTU采用163或是阿里云来更新源,最新的更新源地址可以在网上查阅, 阿里源 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun

Autocomplete method structure in Vim

旧巷老猫 提交于 2019-12-20 02:09:10
问题 Does anyone know if there's a way to autocomplete a method in Vim? For an example in Ruby, if I type: def my_method and hit Enter, it would fill in the end and move the cursor to where the x is: def my_method x end 回答1: vim-endwise does this (I've been happy enough with it to not uninstall it, so I guess that's an endorsement even). 来源: https://stackoverflow.com/questions/11498492/autocomplete-method-structure-in-vim

How do I get the value returned from a function in Python & Vimscript?

孤街醉人 提交于 2019-12-20 01:52:07
问题 I'm using Python to write a vim plugin, but there's something wrong when dealing with Vimscript. function! Login() python << EOF import vim, weibo appkey = 'xxx' appsecret = 'xxxxx' callback_url = 'xxxxxxxx' acs_token = 'xxxxx' expr_in = 'xxxx' client = weibo.APIClient(app_key=appkey, app_secret=appsecret,\ redirect_uri=callback_url) client.set_access_token(acs_token, expr_in) del vim.current.buffer[:] EOF return client endfunction function! Post() python << EOF import vim, weibo try: vim

Searching a log file [duplicate]

拈花ヽ惹草 提交于 2019-12-20 01:42:33
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Searching using Regex in VIM or elsewhere I'm searching a huge ~600 Mb file for a particular pattern which is 7 Hexadecimal values long. The Problem is the 'pattern' could be on the next line and there are several addressing lines. I got rid of problem 1 by getting rid of all the carriage returns but I'm still faced with even if the values are on the next line I have no idea how to search past the address line.

vim中编码方式的设定

耗尽温柔 提交于 2019-12-20 00:56:53
以前在设置vi的编码方式设定的时候, 是直接从网上找的相关的方法, 主要是在/etc/vimrc文件中添加如下的内容: set fileencodings=utf-8,latin-1, gb2312,gbk,gb18030 set termencoding=utf-8 set encoding=prc 这样做可以使vi正确的显示文件内容是中的文件. 但是存在一个问题,就是如果要在vi中显示中文文件名的时候就会乱码. 之前我在网上搜索相关的问题, 几乎没有人提出这个问题, 然后我就容忍了一段时间,但是很不爽. 今天下决心要解决这个问题. 在网上找了很多材料之后,终于解决了这个问题. 这个问题主要是涉及到了vim中的编码方式. 与vi编码相关的有几个选项: encoding、fileencoding、fileencodings、termencoding,它们的意义如下: * encoding: Vim 内部使用的字符编码方式,包括 Vim 的 buffer (缓冲区)、菜单文本、消息文本等; * fileencoding: Vim 中当前编辑的文件的字符编码方式,Vim 保存文件时也会将文件保存为这种字符编码方式 (不管是否新文件都如此); * fileencodings: Vim 启动时会按照它所列出的字符编码方式逐一探测即将打开的文件的字符编码方式,并且将 fileencoding

特殊权限 SUID、SGID、Sticky

眉间皱痕 提交于 2019-12-20 00:04:06
一 . 前提 本篇主要讲解 SUID, SGID, Sticky 三个权限的基本原理和应用 . 为什么要使用特殊权限 ? 比如系统中假如有超过四类人然而每一类人都需要一种独特权限 . 只有三种独特权限的基础权限系统就会明显不够用 . 特殊权限可以扩展系统基础权限的功能 , 使得 linux 权限更加强大灵活 . 在理解特殊权限之前 , 需要先具备几个关于安全上下文的认知 : 前提:进程有属主和属组;文件有属主和属组; (1) 任何一个可执行程序文件能不能启动为进程:取决于发起者对程序文件是否拥有执行权限; (2) 启动为进程之后,其进程的属主为发起者;进程的属组为发起者所属的组; (3) 进程访问文件时的权限,取决于进程的发起者: (a) 进程的发起者,同文件的属主:则应用文件属主权限; (b) 进程的发起者,属于文件的属组;则应用文件属组权限; (c) 应用文件“其它”权限; 二 . SUID 权限设定方法: 字母表示法 : chmod u+s FILE... chmod u-s FILE... 数字表示法 : chmod 4 755 FILE 添加 SUID 权限到二进制程序文件 (添 加到 DIR 无意义 ) 在普通三位数字权限位之前 , 用 4 代表添加的 SUID 位 chmod 0 xxx .... 可以删除文件的 SUID( 无法删除目录的 SUID ) 文件权限表示