vi

How can I retain numbers for sorting them later?

你离开我真会死。 提交于 2019-12-11 06:57:21
问题 I have a problem that sounds like this: Write a shell script that for each file from the command line will output the number of words that are longer than the number k read from keyboard. The output must be ordered by the number of words. How can i retain the number of characters of each file,for sorting them? I tried something like that : #!/bin/bash if [ #@ -ne 1 ] then exit 1 fi array[$@]='' echo -n "Give the number>" read k for f in $@; do n=`$f | wc -c` if [ $n -gt $k ]; then i++ array[i

Replace | character between the records with a value in a pipe delimited file

有些话、适合烂在心里 提交于 2019-12-11 06:05:52
问题 This is my file. NAME|NUM|ADDR|AGE abcd|02|abc|cd|12 jake|04|xy|zzb|12 lau|92||xcx| 56 My desired output has to be like this NAME|NUM|ADDR|AGE abcd|02|abc#cd|12 jake|04|xy#zzb|18 lau|92|#xcx| 56 My file had 4 fields and the 3rd col has a pipe delimiter in between the characters like "ice|cream", my requirement is to replace the | field in the 3rd with any value like (#,* or anything). Since this is pipe delimited file i'm unable to replace that particular part of the file exclusively.Any help

Vim: set 'cursor' keys hjkl to wasd

依然范特西╮ 提交于 2019-12-11 04:17:15
问题 I admit that I'm not an expert vim user so forgive me not providing previous attempts! I wish to overwrite/remap the basic vi / vim (and gvim ) "cursor keys" hjkl to the ordinary "gamer layout" wasd (w-up, a-left, s-down, d-right). Moreover: I know that "w", "a", "s" and "d" are important keys in vim so I came up with the idea to remap hjkl to ALT + wasd . Have to configure .vimrc? Or is there some plugin? Can you help me? 回答1: Map your Alt + aswd to hjkl; in your .vimrc noremap <A-a> h

vi encryption: what algorithm has been used?

我与影子孤独终老i 提交于 2019-12-11 02:33:05
问题 I used an encrypted file to store my passwords for years. It has been encrypted using the vi -x command on Sun Solaris 10. I now tried to open the file on a linux box with both vi -x and vi -x -cm=blowfish . Sadly the file is completely messed up. My guess is that a different encryption algorithm has been used on Solaris. How can I find out which algorithm has been used and how can I open the file with a more recent version of vi? I do know the correct password and I do know several words in

Why does my YCM Server shut down?

不羁岁月 提交于 2019-12-11 01:39:42
问题 Whenever I open vim, I get the message that Ycm Server has shutdown with exit code -6. The log files contain the following info: 2017-12-23 21:25:50,550 - ERROR - Unable to connect to server Traceback (most recent call last): File "/Users/abhisheknaik/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 217, in HandleServerException yield File "/Users/abhisheknaik/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 237, in CheckIfServerIsReady

vi input mode in R?

心已入冬 提交于 2019-12-10 20:24:34
问题 I'd like to be able to edit my R history using vi commands (e.g. ESC-/, ESC-k). I noticed a similar question here: vi input mode in command line Matlab? and tried the readline mods suggested in this post (doesn't R use readline?) but they don't work (for me). Any ideas? 回答1: The Vim-R-plugin should do the trick. I have used it in Ubuntu, MacOS, and Windows 7. The developer is great and does frequent bugfixes. To get Vim behavior in the R console you'll need to use the Conque Shell plugin,

adb shell: can't use the ESCAPE key

耗尽温柔 提交于 2019-12-10 17:16:28
问题 I want to use vi when running adb shell . Starting "vi" is easy. However, I found that the ESC key doesn't seem to get through to it, so I can't exit insert mode. More broadly, it doesn't appear that I'm able to send an ESC character to the adb shell at all. I've scanned the web pretty thoroughly and haven't been able to find anyone with a similar problem (much less an answer). I'm running VRUFNK1 on a Samsung S4. On the PC end I'm running the "adb shell" command from Cygwin under Windows.

C++ Video streaming and transimisson

荒凉一梦 提交于 2019-12-10 12:37:25
问题 I am new to video decoding/encoding. Currently I have a task to test the video transmission for a network coding. The network coding programme was already done. Firstly I tried to divide the video into frames in opencv, and transmit the frames, but after division, I found a 3MB video are converted to 80MB total size frames!! which is not efficient for transmission. Is there any better way to do the video transmission? Can any pros provide me a sample code in C++? I be told that cannot

How to prevent wrapping string in quotes while enable auto-wrap in vim?

馋奶兔 提交于 2019-12-10 11:57:51
问题 I tend to enable auto-wrap : :set textwidth=80 :set formatoptions+=wt But I don't want to wrap when I input a long string in quotes when I coding with C or javascript, because it will be error; Can I configure my vim auto-wrap exclude quotes? or auto typing '\' before wrapping this line? 回答1: You can start from this little script which I coded and add some improvements in order to fit your needs: """""the event that will trigger the wrap (leaving insert mode) au InsertLeave * call WrapLines()

Using vim, how do you quickly refresh a web page you're working on?

…衆ロ難τιáo~ 提交于 2019-12-10 09:53:09
问题 I've been using VIM for a few weeks now while messing with various web languages and I'm really enjoying it. I find it cumbersome having to tab or click into my browser and refresh the page to see the effect of a code change. It's even more annoying as I'm using Virtual Box and I tend to be working from PDF files on the host system so I have limited window space. Do you gurus have any fancy ways of doing this? I was wondering if it's possible to split the VIM workspace and have links/lynx in