vim

VI delete everything except a pattern

不打扰是莪最后的温柔 提交于 2021-02-07 22:32:30
问题 I have a huge JSON output and I just need to delete everything except a small string in each line. The string has the format "title": "someServerName" the "someServerName" (the section within quotes) can vary wildly. The closest I've come is this: :%s/\("title":\s"*"\) But this just manages to delete "title": " The only thing I want left in each line is "title": "someServerName" EDIT to answer the posted question: The Text I'm going to be working with will have a format similar to {"_links":

VI delete everything except a pattern

我怕爱的太早我们不能终老 提交于 2021-02-07 22:31:05
问题 I have a huge JSON output and I just need to delete everything except a small string in each line. The string has the format "title": "someServerName" the "someServerName" (the section within quotes) can vary wildly. The closest I've come is this: :%s/\("title":\s"*"\) But this just manages to delete "title": " The only thing I want left in each line is "title": "someServerName" EDIT to answer the posted question: The Text I'm going to be working with will have a format similar to {"_links":

Vim - Macro to expand verilog bus

穿精又带淫゛_ 提交于 2021-02-07 20:22:10
问题 I can't seem to be able to create a vim macro that does the following: Source: this_is_a_bus[10:0] another_bus[2:0] Required Dest: this_is_a_bus[10] this_is_a_bus[9] this_is_a_bus[8] this_is_a_bus[7] this_is_a_bus[6] this_is_a_bus[5] this_is_a_bus[4] this_is_a_bus[3] this_is_a_bus[2] this_is_a_bus[1] this_is_a_bus[0] another_bus[2] another_bus[1] another_bus[0] What I tried to do: I can search for \d\+:\d\+ and put the cursor on the first number, then copy that with yw to the memory. However

Highlighting arbitrary lines in VIM

∥☆過路亽.° 提交于 2021-02-07 19:16:06
问题 During the implementation process of a program I generally insert many append code lines, mainly with print command, to help me understand and debug the implemented program. Unfortunately, it is common to me to forget which lines are from the code and with were appended and should be deleted some time after. This problem gets worst with large programs. Well, I found this article that teaches how to keep one arbitrary user selected line highlighted (see section: Highlighting that stays after

How to run Vim commands from Terminal

断了今生、忘了曾经 提交于 2021-02-07 14:42:57
问题 My questions is one that I haven't seen answered, the usual question is how to run certain commands to a file. My question is how to run Vim commands or functions, from outside Vim (i.e. Terminal), these wouldn't affect any file, just Vim itself. Is this is even possible? If so, how? If this is not possible like this, is there a way to go into Vim, run a command automatically, and then exit when that ends? Or run another command and then exit? Thanks for your help! 回答1: Use vim --cmd 'Command

Python script should end with new line or not ? Pylint contradicting itself?

喜夏-厌秋 提交于 2021-02-07 12:22:28
问题 I am new to Pylint, and when I run it against my script, I get this output: C: 50, 0: Trailing newlines (trailing-newlines) Here, Pylint is saying that it is bad to have a final newline. I like to have a new line at the end of my scripts, so I thought I would disable this warning. I did some google web searching and found this: http://pylint-messages.wikidot.com/messages:c0304 C0304 Message Final newline missing Description Used when a Python source file has no line end character(s) on its

Vim: read modeline after opening the file?

。_饼干妹妹 提交于 2021-02-07 06:49:35
问题 I work on a variety of projects and many of them set file-specific vim settings. I have been asked to not have modelines set in .vimrc; is there a way after loading the file to load the modelines settings? So if I open tmp.c with vim: int main(int argc, char* argv[]) { return 0; } /* vim: set expandtab tabstop=4 : */ Is there a command I can run to set the stuff in the modeline? Just doing :set modeline after it is open doesn't do anything. 回答1: After :set modeline , reload your buffer with

YCM does not find my headers?

半城伤御伤魂 提交于 2021-02-07 05:38:25
问题 I have the following folder structure: . ├── include │ └── ctset │ ├── hashtable.h │ └── set.h └── src └── hashtable └── hashtable.c And in hashtable.c the include #include "ctset/hashtable.h" , but YCM keeps telling me that it doesn't know the types I defined in the header and use in the source. My .ycm_extra_conf.py is almost the default one with some adjustments: # This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text

YCM does not find my headers?

南楼画角 提交于 2021-02-07 05:38:06
问题 I have the following folder structure: . ├── include │ └── ctset │ ├── hashtable.h │ └── set.h └── src └── hashtable └── hashtable.c And in hashtable.c the include #include "ctset/hashtable.h" , but YCM keeps telling me that it doesn't know the types I defined in the header and use in the source. My .ycm_extra_conf.py is almost the default one with some adjustments: # This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text

Julia syntax highlighting in julia-vim

北慕城南 提交于 2021-02-07 05:15:59
问题 I use gvim with julia-vim for editing julia code. I am using julia 0.5 on a mac and installed julia-vim with vundle. My problem is that files with the .jl extension do not have appropriate highlighting. For example, if is highlighted but for is not. Any solution for this? 回答1: .jl files are sometimes recognized as lisp files by default, (blame Sawfish) so that's probably the syntax highlighting you're getting. (type defun and progn and etc and see if the pretty colors pop up) You were close