All Questions

Tagged with
Filter by
Sorted by
Tagged with
339 votes
13 answers
264k views

vim: how to delete a newline/linefeed character(s)?

Is there a way to delete the newline at the end of a line in Vim, so that the next line is appended to the current line? For example: Evaluator<T>(): _bestPos(){ } I'd like to put this ...
derekerdmann's user avatar
276 votes
12 answers
177k views

How to run mvim (MacVim) from Terminal?

I have MacVim installed and I am trying to set it up as the editor for Git (version control), but I can't run 'mvim' from the command line as it isn't recognised. How do I setup mvim so I can run it ...
Fred's user avatar
  • 4,817
144 votes
11 answers
148k views

How can I open a Shell inside a Vim Window?

I can open a shell by using the :shell command in Vim, however I can't edit a file and at the same time use the shell. Is there any way to split Vim in many Windows (or tabs), and have a shell opened ...
Martín Fixman's user avatar
101 votes
5 answers
34k views

How can I make bash tab completion behave like vim tab completion and cycle through matching matches?

I've been meaning to find a solution for this for YEARS. I am sooo much more productive in vim when manipulating files than bash for this reason. If I have file_12390983421 file_12391983421 ...
pixelearth's user avatar
  • 14.1k
91 votes
5 answers
38k views

When in Vim insert mode, is there a way to add filepath autocompletion?

I write a lot of shell scripts and I am constantly having to enter in filepaths. I am wondering if anyone knows of a way to get Vim to autocomplete filepaths while in insert mode, just like when you ...
stephenmm's user avatar
  • 2,650
77 votes
5 answers
32k views

How to run a vim command from the shell command-line?

There are many stackoverflow questions about running shell programs from within vim. Is it is possible to do the reverse, i.e., $ vim :BundleInstall to allow me to run BundleInstall as part of a ...
jvc26's user avatar
  • 6,463
75 votes
7 answers
46k views

Vim: Pipe selected text to shell cmd and receive output on vim info/command line

I want to pipe the selected text to a shell command and receive the one-line output from this shell command on the vim info/command line? What I'm really trying to do: Pipe the selected text to a ...
ikwyl6's user avatar
  • 891
59 votes
6 answers
38k views

How to run a series of vim commands from command prompt

I have four text files A.txt, B.txt, C.txt and D.txt I have to perform a series of vim editing in all these files. Currently how I am doing is open each files and do the same vim commands one by one. ...
imbichie's user avatar
  • 1,590
45 votes
5 answers
86k views

How do you run Vim in Windows?

I just installed gVim, and tried using the usual "vim myfile.java" technique that usually works for linux to open up a file and edit it. But unfortunately, this doesn't seem to work. I've also tried "...
Mr Prolog's user avatar
  • 531
41 votes
11 answers
25k views

How to write buffer content to stdout?

Is there any chance to write the content of the current vim buffer to stdout? I'd like to use vim to edit content that was passed via stdin - without the need of a temporary file to retrieve the ...
hooblei's user avatar
  • 3,240
40 votes
4 answers
8k views

Execute shell command without filtering from Vim

I want to select a block of text (for example, V%) and use the text as input to a shell command (for example, wc or pbcopy) - but I don't want to alter the current buffer - I just want to see the ...
searlea's user avatar
  • 8,298
31 votes
6 answers
27k views

Vim [compile and] run shortcut

Basically what I want is a keyboard shortcut in vim that lets me [compile and] run the currently being edited C, C++ or Python program. In psuedocode: when a shortcut key is pressed: if ...
user avatar
29 votes
3 answers
7k views

How do I get vim's :sh command to source my bashrc?

Whenever I start a shell in vim using :sh, it doesn't source my ~/.bashrc file. How can I get it to do this automatically?
Pierre-Antoine LaFayette's user avatar
29 votes
7 answers
9k views

What setting in vim counteracts smartindent's refusal to indent # comments in shell scripts?

I recently started using vim 7 (previously vim 6) and the smartindent setting. For the most part, it works well, though I'm so used to typing a tab after an open brace that it is almost counter-...
Jonathan Leffler's user avatar
25 votes
4 answers
13k views

How to get Cmd-left/right working with iTerm2 and Vim (without requiring .vimrc changes)?

I want to be able to use Option-left and Option-right to skip words (and Cmd-left/right to go to beginning and end of lines) within Vim as it does at my shell prompt. My Iterm2 preferences have ...
Dolan Antenucci's user avatar
23 votes
2 answers
7k views

How to get return (status) value of an external command in Vim

I want to get the exit value (returned by $? on a shell; usually 0 or 1 for success or failure) of a external shell command in Vim. Note that I want to get its standard output too. So I can use the ...
highsciguy's user avatar
  • 2,619
22 votes
2 answers
11k views

How to run a shell command through vimscript?

In my Vim setup I'd like to add a configuration that runs a shell command with a certain mapping. Is there any possible way to do this in Vimscript?
beakr's user avatar
  • 5,807
20 votes
7 answers
13k views

How do I launch an editor from a shell script?

I would like my tcsh script to launch an editor (e.g., vi, emacs): #!/bin/tcsh vi my_file This starts up vi with my_file but first displays a warning "Vim: Warning: Output is not to a terminal" and ...
Marc Eaddy's user avatar
  • 1,792
19 votes
3 answers
22k views

Executing Vim commands in a shell script

I am writing a Bash script that runs a command-line program (Gromacs), saves the results, modifies the input files, and then loops through the process again. I am trying to use Vim to modify the input ...
Nikolkj's user avatar
  • 373
14 votes
1 answer
4k views

vim errors on vim startup when run in fish shell

Here's my error: ~> vim .tmux.conf Error detected while processing /Users/###/.spf13-vim-3/.vim/bundle/syntastic/plugin/syntastic.vim: line 23: E484: Can't open file /var/folders/c4/...
schellsan's user avatar
  • 2,194
13 votes
6 answers
8k views

Linux shell (bash) on vi's splitview

I've been searching with no results for an integration of bash inside vi, as featured in emacs; the problem is: I have vi open with 2 views, one open with :split command, and I want to use bash ...
gc5's user avatar
  • 9,668
13 votes
3 answers
11k views

Windows terminal/Console/shell in Vi mode?

I'm a big fan of VIM and I use VI mode for my terminal in Mac/Ubuntu. It's very easy to set a Vi Mode in Unix OS: simply put set editing-mode vi set keymap vi-command into ~/.inputrc. However, my ...
songyy's user avatar
  • 4,463
12 votes
3 answers
2k views

Running R inside a buffer in Vim

I have used Stata and gVim on Windows for a while now. Recently I have switched to Linux, and I am planning to also change from Stata to R. A friend of mine is using R and Emacs ESS which seems to ...
ilprincipe's user avatar
11 votes
5 answers
11k views

Is there a way to change vim's default mode

Does anyone know how to change vim's default mode? Its default mode is command mode, but could I change it to insert mode?
user1033390's user avatar
11 votes
2 answers
3k views

How to remap escape insert mode to 'jk' in fish shell?

I use jk as my escape sequence in vim as well as vi-mode for bash and zshell. How do I do this in fish shell? i.e. in vim: inoremap jk <esc> bash: bind -m vi-insert '"jk": vi-movement-mode' ...
willpnw's user avatar
  • 755
10 votes
3 answers
6k views

How to build and run a shell command based on the contents of several lines in Vim?

A frequently used feature of Vim for me is filtering a file (or a selection of text) through an external command and replace the selection with the result, e.g.: :'<,>'!sort so c b a will be ...
oliver's user avatar
  • 9,355
10 votes
3 answers
9k views

shell script to add header to a file

I was trying to write a script to add a trademark header to my .cpp file. my solution is as follows. cat trademark.txt test.cpp > new_test.cpp && mv new_test.cpp test.cpp However, wanted ...
Jack's user avatar
  • 751
9 votes
2 answers
4k views

How to check whether shell scripts / Vim running in VS Code integrated terminal?

Issue Question is as stated in the title. In gist, I am trying to get my bash scripts and Vim to behave differently when running in VS Code's integrated terminal. Things I've found I have managed ...
yongjieyongjie's user avatar
9 votes
2 answers
855 views

vim: Why does the sh colour scheme highlight `$(...)` as an error?

For example: I was under the impression that $(...) was recommended over `` because it's easier to nest.
David Wolever's user avatar
9 votes
2 answers
11k views

escape character in vim command

I want to run command like this: vim -c "%g/blablabla/norm /str<ESC>cwSTR" file How I write escape character in the command?
dimba's user avatar
  • 27.2k
9 votes
1 answer
2k views

Best way to read output of shell command

In Vim, What is the best (portable and fast) way to read output of a shell command? This output may be binary and thus contain nulls and (not) have trailing newline which matters. Current solutions I ...
ZyX's user avatar
  • 53.2k
9 votes
2 answers
8k views

Neovim terminal emulator configuration for Windows 10

I am trying to configure Neovim for Windows. One of the key things of this configuration is getting access to the terminal-emulator (it's very comfortable to switch and use the terminal with Vim). But ...
Dmytro's user avatar
  • 91
8 votes
3 answers
13k views

Compiled vim from source on Mac OSX and getting 'shell returned 127' error?

On my Mac OSX 10.6 machine, I started to use MacVIM for vim. Then I noticed my terminal version was different to the MacVIM version (MacVIM was 7.3 and my terminal version 7.2)... I thought they used ...
littlejim84's user avatar
  • 9,171
8 votes
2 answers
15k views

Shell commands from vim

What is the best approach of using shell commands from vim? I know about the possibility of !shell_command. But this doesn't know all commands e.g. export OSTYPE; make install So I have to run it ...
xralf's user avatar
  • 3,544
8 votes
1 answer
7k views

"dyld: Library not loaded", "libruby.1.9.1.dylib" when calling "mvim ." in the command line

I'm trying to open my rails project into mvim (macvim) using "mvim ." but I get the following error. ➜ cs193p git:(master) mvim . dyld: Library not loaded: /Users/myusername/.rvm/rubies/ruby-1.9.3-...
AdamT's user avatar
  • 6,475
8 votes
4 answers
13k views

Vim change block cursor when in insert mode

Not sure what the terminology is for it but on Vim the 'cursor' is always like an insert/replace cursor instead of the blinking line cursor I'm used to in other gui editors. Is there any way to change ...
Derek Organ's user avatar
  • 8,393
8 votes
2 answers
11k views

Running a shell script in .vimrc (and processing the output)

I am trying to run a shell script from within a .vimrc file (three problems marked in the script): function! CheckMe(file) let shellcmd = 'checkme '.a:file " Start the command and return 0 ...
knipknap's user avatar
  • 6,044
8 votes
2 answers
4k views

how to set vimrc tags to use shell environment variables

I tried but failed and need an expert help. In a .vimrc I have the following: set tags=/sandbox/myNameIsSam/tags This works just fine. Inside gvim, I can load the tags file and everything is awesome....
user2019842's user avatar
7 votes
1 answer
2k views

Im using vim to check man page, and there is some weird character,how to make it normal?

I'm trying using man ascii | vi - to check ascii manual with vim, then there are some weird character like '^H' weird character in vim how to make it normal? EDIT: i think this is due to some ...
user956609's user avatar
  • 1,124
7 votes
1 answer
659 views

How to map a long bash command in vim?

The shell command can kill chrome process. ps -ef | grep chrome |awk '{print $2}'| xargs kill Now I want to map the character - with above bash command. nnoremap - :!ps -ef | grep chrome |awk '{...
showkey's user avatar
  • 520
7 votes
1 answer
4k views

How do I get Code Folding in Vim for shell scripts working

Whatever I do, I don't seem to get syntax folding running for shell scripts. So I have a file called abc.sh call :let g:sh_fold_enabled=7 :let g:is_bash=1 :set foldmethod=syntax But it still can't ...
hgiesel's user avatar
  • 5,550
7 votes
2 answers
3k views

Next Line in less

I'm using less and since I have long lines I need some way of going to the next line (I mean the real next line, not the next line shown in less which might be the continuation of the previous line) ...
Shayan's user avatar
  • 2,818
7 votes
4 answers
6k views

IDE that provide autocompletion and error detection for Linux bash or shell scripting?

Our dev team is looking for an IDE like vi or nano or even textpad for windows that has the capability to autocomplete and error correction for bash or shell script for linux. Basically something ...
Geo's user avatar
  • 8,733
7 votes
1 answer
3k views

How do I send the current buffer or line as stdin to system() in vim?

There are 3 closely related vim commands that let you call an external program: :[range]!{filter-cmd} {arg} (ex-command, :help :range!) :[range]write !{cmd} (ex-command, :help :w_c) system({expr}, {...
Ein's user avatar
  • 1,573
7 votes
7 answers
3k views

Pipe a vim command after a shell command

I'm trying to make a key mapping in vim that (a) saves current file (b) performs a git action, using shell (c) quits current vim editor. I've tried the following methods but still can't figure it out....
AnnieFromTaiwan's user avatar
7 votes
1 answer
3k views

Most elegant way to detect available colors in terminal to use colorschemes in vim?

I want to know if it's possible to detect available colors in terminal which vim was called, so I could select different colorschemes for each color situation. This is different from checking &...
Somebody still uses you MS-DOS's user avatar
7 votes
5 answers
5k views

Run a command but stay in the shell vs exit

I know that in vim I can type :terminal <command> % to run a command on the file in the current edit buffer. For example and to simplify what I want to do let's take a simple ls command: :...
robus's user avatar
  • 101
7 votes
1 answer
3k views

Run shell command on visual selection

I'm trying to run a shell command on a visual selection but I can't figure out how to run it on the selection and not the selected lines, eg: Selection start here v hello world ^ Ends ...
Andreas Louv's user avatar
  • 46.7k
6 votes
3 answers
2k views

Vim: read modeline after opening the file?

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 ...
Levi Morrison's user avatar
6 votes
3 answers
4k views

Killing vim processes with a shell script leaves .swp files

I developed a script that will kill all 'vim' processes working on xxx.log files: ps -ef|grep vim|grep xxx.log|awk '{print $2}'|xargs kill -9 However, the .swp (swap) files remain for each vim ...
Asfbar's user avatar
  • 279

1
2 3 4 5
7