FAQ Database Discussion Community


Add edit buffer alias to vim with directory mapping

backbone.js,vim,vi,vim-plugin
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...

Using shell command output within VI editor

shell,command-line,vi,shadow
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...

vi/fugitive: Gpush does not exit… sometimes

ssh,vi,vim-fugitive
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 replace 'strange' signs?

vim,replace,vi
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...

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

vim,vi
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?...

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

search,vim,replace,vi
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...

Adding a new colorscheme without Root permission

linux,vim,permissions,vi,csh
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?

Disable Wrapping Cursor in Eclipse

eclipse,vim,vi
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...

Regex Match without new line ^M

regex,perl,newline,vi
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....

editing file through vi editor in shell script show error

linux,bash,vim,vi
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...

Vim: Space bar in insert mode creates integers

vim,amazon-ec2,mingw,vi
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 do I open just a subset of very large file using vi

vim,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 ...

parts inside augroup can't be highlighted in $MYVIMRC

vim,vi
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...

how to change editor behavior in intellij idea

vim,intellij-idea,sublimetext,vi,ideavim
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,...

vi, set user settings

linux,vi
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!...

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

vim,vi
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...

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

vim,vi,vim-plugin,cscope
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,...

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

vim,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....

String with n letters

regex,vi
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...

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

regex,bash,awk,sed,vi
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...

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

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

How to use vi mode in fish shell?

vim,vi,fish
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.

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

unix,vi
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....

unix vi file edit not working the text just gets capitalized

unix,vi
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...

Paste commands into vim

vim,vi
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...

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

regex,unix,text,command,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...

Copy/Pasting DOCTYPE Tag Into Vi Document

xml,copy-paste,vi,putty,doctype
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...

Whats wrong with my Mongo query?

mongodb,terminal,vi,hybrid-mobile-app,.bash-profile
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 127.0.0.1:27017,...

Replacing a string with empty line

vim,sed,vi
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 ...

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

vim,text,insert,editor,vi
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....