FAQ Database Discussion Community

Disable Wrapping Cursor in Eclipse

I'm mostly using Vi (edit: Vim) for text editing and the viPlugin for Eclipse Juno. Eclipse seems to have a very annoying behaviour of "wrapping" the cursor to the next/previous line, if yout reach the end/start of a line through cursor keys. (Reproduce by placing the cursor on the first...

parts inside augroup can't be highlighted in $MYVIMRC

augroup jsgroup autocmd! autocmd FileType javascript iabbrev <buffer> iff if ()<left> problem ---> autocmd FileType javascript iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a autocmd FileType javascript iabbrev <buffer> rtn return;<left> autocmd FileType javascript iabbrev <buffer> log/ console.log()<left> augroup END can someone tell me what is wrong with this $MYVIMRC code? The problem...

Save file content of a vi session without exiting the vi session

I'm trying to save content of a vi session without exiting the session. Is there any way I can achieve this?

Add a string to the beginning of a line containing a pattern - with sed and with awk [duplicate]

This question already has an answer here: Difference between single and double quotes in bash 2 answers I am trying to comment the lines in my scripts where a pattern from a given list of patterns is present. Now, I am able to do it the following way on...

Copy/Pasting DOCTYPE Tag Into Vi Document

I am using PuTTy to remote into a Unix box (HP-UX) and require to copy/paste XSD Schema contents into files manually (no SCP or sftp allowed unfortunately). What I do is first is to unset the auto indenting behavior of Vi (:set noautoindent), however, when I copy/paste the content, I...

vi, set user settings

When using vi I almost always need to do :set hlsearch :set number How can I make my system always load these as presets or something when I use vi. In one machine I am root, in another not. So please include an answer for both. Thank you!...

Using shell command output within VI editor

I'm just walking my very first steps with vi-like editors and i would like to know if it's possible to insert the output of a shell command within a line when, for example, editing /etc/shadow with vipw -s prueba4::16586:0:99999:7::: ~ ~ ~ ~ ~ ~ ~ ~ ~ My goal...

Add edit buffer alias to vim with directory mapping

I want to add a custom mapping of VIM's edit buffer command but with a default directory mapping. Here is an example: I have a directory called javascript/backbone. Every time I want to access a file in this folder, I have to type the entire path. I want to do...

How do I remove first 5 characters in each line in a text file using vi?

How do I remove the first 5 characters in each line in a text file? I have a file like this: 4 Alabama 4 Alaska 4 Arizona 4 Arkansas 4 California 54 Can 8 Carolina 4 Colorado 4 Connecticut 8 Dakota 4 Delaware 97 Do 4 Florida 4 Hampshire 47...

"+y operator for yanking to clip-board, not working

I use "+y to yank to clip-board so I can paste it somewhere else. It's working fine on one of my computers but not on an other. Both computers are Linux (Ubuntu) machines. The one where it is not working, I am connecting to it through SSH. Does anyone know...

String with n letters

I want to find a string with 5 letters via regular expressions. I tried it like this: /^.\{5}$ But this only gives me Strings with 5 letters from the Start of a line, not all Strings in the text. What is the Expression to find all 5-letter-words ? Gruß, Andre...

unix vi file edit not working the text just gets capitalized

Whenever I try to inset and edit text using vi the text is just getting capitalized. I couldn't enter new text I do have permissions to edit the file though...

vi/fugitive: Gpush does not exit… sometimes

I just started using fugitive in my workflow... very useful! But I've seem to have run into a weird annoyance that I'm hoping someone might have a solution to: When I run :Gpush, sometimes control never returns to vi. Vi hangs on the output of git push until I Ctrl+C...

How to search in vim for a value and then use the value to do search and replace in the same line?

I have the following set of lines, where the 1st column is a Scenario name and it's followed by a list of parameters. I want to use the 1st column value as a value to the parameter scen=, which may be anywhere in the list of parameters. For example, If...

How do I open just a subset of very large file using vi

How do I open just a subset of very large file using vi Open last 10000 lines using vi Open 10000, 20000 lines using vi ...

How to replace 'strange' signs?

When I open a file using vi I see the following line: 00:00:15:Co<9c> Ty! What is hidden under <9c> and how can I make a global replacement for all occurrences of this strange sign? File is encoded with UTF-8...

Replacing a string with empty line

I have a file which has 2000 lines of data (file name is data.tsv). I want to replace the string with empty line where there is a matching pattern, in my case is PMC: How can I do with Vim or other sed command? Thanks, Rio ...

Select a different keystroke than colon ':' to enter command-line mode in vi

Is there any way to achieve that remapping? I looked a bit into map and inoremap but they appear to affect within a given mode, not how to enter a given mode....

Regex Match without new line ^M

I have a regex in my perl script which is /Operating System:\s*(.*)/. The line I am matching is Operating System: Windows XP Service Pack 3 however, there is a new line after entered after that line. So the text would be seen as Operating System: Windows XP Service Pack 3^M....

How can I map keys in Insert mode that contains Carriage Return in it?

How can I map ctrl + enter to go to new line from anywhere in the current line in vim ? I just want to do it for insert mode. I tried :set <C-<CR>> <Esc>o but that doesn't seem to work....

Vim: Space bar in insert mode creates integers

I'm using MINGW on a Windows 7 machine to ssh to an EC2 instance (Ubuntu) on which I would like to use vim as my text editor. If I run vim test.txt, enter Insert mode, and type this is a test, however, vim interprets each of the spaces in that...

How to use vi mode in fish shell?

I saw vi-mode implementation for fish shell here, but I have no clue how to use it. Is there any tutorial available online (I couldn't find such) describing basic functionality - how to switch modes etc. thanks.

how to change editor behavior in intellij idea

I have installed IDea 14.0.2 just now. I do not know its default editor but it is opening my source files in vi option now. So, not letting me do default action like Ctrl + v, Ctrl + d which was present before and I used to like it. So,...

vim using “cscope find s” command and open result in new tab instead of window

I use cscope command :cs find s someFunction and i see the long list with this function appearance, I find that I'm interested in list and open it, vim opens a file in a new window, I want to open file in a new tab. I found several similar questions,...

Whats wrong with my Mongo query?

I've recently set a path in my vi .bash_profile to my mongo commands. I know this works because it was working yesterday. However when I do it now I get this error: AMAC02MX3APF8J3:~ james.flan$ mongo MongoDB shell version: 3.0.3 connecting to: test 2015-05-19T11:34:58.708+0100 W NETWORK Failed to connect to,...

copying everything from line number xxxxx to line number zzzzzz in vi editor

I would like to copy a couple of screenful lines using vi editor. Anything from line number xxxx to line number zzzzz. Then, I want to write these lines into another file....

Delete backwards from cursor to the end of the previous line in Vim?

Say I want to edit the following line: var myVar = "I am a string!"; So that it looks like this: var myVar = "I am a string!"; Is there a movement that goes to the end of the previous line?...

editing file through vi editor in shell script show error

script in which I open a file in vi editor , after that user will write any thing in it then save or quite by :wq! When I try this then it give an error message as below e138 can't write viminfo file $home/.viminfo! and ask for, Press Enter or...

Paste commands into vim

Say I have a series of commands that I want to run in vim: ifoo<ESC>:%s:foo:bar:g<CR> When I paste the above into vim, this will be the output: foo<ESC>:%s:foo:bar:g<CR> How can I paste the above into vim so that my result becomes: bar I.e. that it treats <ESC> and <CR> et...

Adding a new colorscheme without Root permission

I tried to add new colorschemes in /usr/share/vim/vim70/colors but it seems that I need Root permission to do so. Is there any way to do it without root permission?