vim

How to execute the vim commands through shell script

故事扮演 提交于 2019-12-22 05:39:24
问题 Hi I have a situation as I have a writing a shell script where I have to pass input to the vim . Explaining in detail Here I have already written shell script that I cannot changed. Here is the code for it. sudo vim /mnt/etc/{hosts,hostname,ports} due to this hosts file is opened we can go manually next to the hostname file by :n and similar for the ports file. But I have to perform same operation from my .sh file. Also I have to edit the ports file and after completing it I have to save and

Is it possible to make vim use forward slashes on windows?

99封情书 提交于 2019-12-22 05:34:08
问题 Native build of ViM on Windows uses backslashes in file paths including for completion, though it works fine if I use forward slashes manually (in fact all Windows API understand them, cmd.exe is the only exception) and backslashes cause various problems, because they double as escape and the "dwim" logic does not really work. For example: :vimgrep /Foo/ src/* works just fine, but :vimgrep /Foo/ src\* does not, because the \ escapes the * . Manually I just write forward slash, but tab

Is it possible to make vim use forward slashes on windows?

旧时模样 提交于 2019-12-22 05:34:03
问题 Native build of ViM on Windows uses backslashes in file paths including for completion, though it works fine if I use forward slashes manually (in fact all Windows API understand them, cmd.exe is the only exception) and backslashes cause various problems, because they double as escape and the "dwim" logic does not really work. For example: :vimgrep /Foo/ src/* works just fine, but :vimgrep /Foo/ src\* does not, because the \ escapes the * . Manually I just write forward slash, but tab

How to get a unique identifier for a window?

℡╲_俬逩灬. 提交于 2019-12-22 05:33:36
问题 I am trying to get some sort of unique identifier for a window, so that commands can be run against that window. Ie, if i need to give that window focus.. or if i need to see the size of that window.. etc. The problem is currently it seems like the window number is used as this identifier, but this number potentially changes any time a new window is introduced.. It seems like it is an index count from left to right and top to bottom.. which puzzles me as to why that would be used as an

How to make vim's `:global` command confirm-able before executing the ex Command?

只愿长相守 提交于 2019-12-22 05:33:31
问题 How can I make vim's :global command ask the user if they want to execute the ex command? Similar to what happens with the :substite command with the 'c' option, for example %s:Foo:Fighters:gc I tried: :g/mypattern/.s:.*\n::gc and :g/mypattern/s:.*\n::gc but if there is a match on below line it is jumped. For example: MATCH NONMATCH MATCH MATCH MATCH The result is: NONMATCH MATCH <<-- this should be erased. A promptable g/FOO/d would be perfect. 回答1: There is no native way to do this. The

Ruby: Checking for East Asian Width (Unicode)

感情迁移 提交于 2019-12-22 05:27:23
问题 Using Ruby, I have to output strings in an columnar format to the terminal. Something like this: | row 1 | a string here | etc | row 2 | another string | etc I can do this fine with Latin UTF8 characters using String#ljust and %s. But a problem arises when the characters are Korean, Chinese, etc. The columns simply won't align when there are rows of English interspersed with rows containing Korean, etc. How can I get column alignment here? Is there a way to output Asian characters in the

vim 和 gcc 的使用

为君一笑 提交于 2019-12-22 05:22:22
Linux-编辑器 vim的使用 vim 的三种模式:  1.普通模式(命令/正常模式)(用vim 初次打开的默认模式)    控制屏幕光标的移动,字符、字或行的删除,移动复制某区段及进入Insert mode下,或者到 last line mode  2.插入模式    只有在Insert mode下,才可以做文字输入,按「ESC」键可回到命令行模式。该模式是我们后面用的最频繁的编辑模式。  3.底行模式    文件保存或退出,也可以进行文件替换,找字符串,列出行号等操作。 在命令模式下,shift+: 即可进入该模式。要查看你的所有模式:打开vim 模式转换 插入模式 按「i」切换进入插入模式「insert mode」, 按“i”进入插入模式后是从光标当前位置开始输入文件; 按「a」进入插入模式后,是从目前光标所在位置的下一个位置开始输入文字; 按「o」进入插入模式后,是插入新的一行,从行首开 (光标换行) 命令模式 按[EXC] 键 普通模式切换至底行模式 「shift + ;」, 其实就是输入「:」 插入模式下的操作 移删复替撤改跳 移动光标 vim可以直接用键盘上的光标来上下左右移动,但正规的vim是用小写英文字母 「h」、控制光标左移一格 「j」、控制光标下移一格 「k」、控制光标上移一格 「l」、控制光标右移一格 「w」、光标跳到下一个字的字首 「b」

^M characters in git commit message (git commit -v)

眉间皱痕 提交于 2019-12-22 04:59:14
问题 I am having a weird problem where lots of ^M characters show up in my git commit message. Please find a screenshot attached. This is not causing any problems, just makes it annoying to read through. Tips appreciated. 回答1: "The Proper Way", if you use Git in cross-platform environment, contrary to Abhijeet's answer, is: Learn and CORRECTLY configure core.autocrlf settings in each client Read local topic "Why should I use core.autocrlf=true in Git?" as good starting point 回答2: Thats a windows

Vim: Use tabs for indentation, spaces for alignment with C source files

佐手、 提交于 2019-12-22 04:49:08
问题 Does anybody have her vim setup in a way that uses hard tabs as indentation characters, but does use spaces for alignment? The problem I have is that when starting a continuation line like in if (condition1 && (anotherlongcondition || /* <-- Here I insert a newline */ |-------|------- whatever /* some additional alignment added automatically */ , then cin (which is a must for me) adds some alignment just the way I prefer positionally , but this alignment is created using as much hard tabs as

How do I successfully use VIM as an external editor for Code::Blocks?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 04:40:52
问题 I really like Code::Blocks for its build system and step through debugging abilities - ie I really enjoy using wrappers to gcc/gdb more than using them from Makefiles or the command line. The problem is, I'm so brain damaged (or spoilt, some might say) by years of VIM use that I cannot edit in a standard Windows text editor. So, I setup Code::Blocks to use VIM as the file handler for .cpp/ .c/*.h and along with VIM's --server-name and --remote-tab options can right-click files in my C::B