Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [vim]

Vim is an open-source text editor with a steep learning curve that leads to high efficiency in many tasks related to text edition. If you wish to start with vim, try to run “vimtutor”, which will teach you basic commands.

45
votes
5answers
32k views

How to make a global ~/.vimrc?

Right now, I make everyone do ~/.vimrc and put their settings there. How can I make a global, default .vimrc for new users?
33
votes
14answers
21k views

How to bring .vimrc around when I SSH?

My work tends to involves using SSH to connect to various machines, and then using vim to edit files on those machines. The problem is that I have to constantly copy my .vimrc file around. It's very ...
28
votes
4answers
7k views

vim re-edit as root

I often open a file in vim, make some changes and when it's time to save the file is read-only.. (owned by another user). I'm looking for tips on how I could re-open the file as root and keep my ...
24
votes
1answer
4k views

How to tell if I'm in MacVim in .vimrc

In my .vimrc, I want to check if I'm in MacVim vs. regular vim so I can optionally set some MacVim-specific settings, which should not be applied to regular vim. How do I do this?
21
votes
10answers
3k views

Suggestions for entries in a sysadmins .vimrc

At the very least I always uncomment "syntax on" in /etc/vim/vimrc
19
votes
12answers
2k views

What language for starting on Linux? [closed]

I am about to begin a 4-year information security degree at Purdue. The degree does not call for any programming courses. So the only time I will be able to take one is the occasional elective. So ...
17
votes
2answers
7k views

How do I keep 10 lines visible when scrolling up to EOF with CRTL-F?

I am used to using vi, not vim. What I find annoying in vim is that when you are scrolling with CTRL-F and reach EOF, vim scrolls down to the very last line and put this line on the top of your screen,...
17
votes
5answers
4k views

Windows Powershell Vim Keybindings

Is there a way to get vim keybindings in powershell as you would in bash or zsh with a command like set -o vi
14
votes
2answers
8k views

How to set vim filetype when editing nginx config files

When I open vim for a file like /etc/nginx/sites-available/default, syntax highlighting works fine. But then if I create my own file /etc/nginx/sites-available/myapp, vim does not highlight its syntax....
13
votes
4answers
3k views

Save file after forgetting to open as root / sudo vi [duplicate]

Possible Duplicate: vim re-edit as root I could have sworn I saw this question asked. But after looking though every search result for "vi" I'm stumped/lazy. I've opened a file, made an edit and ...
12
votes
1answer
4k views

Configure vim for text selection with shift and copy/paste via ctrl+c, ctrl+v?

Many machines i need to work with have basic NIX installation with vim as text editor. But vim's way to select text is kind of unusual to me :). Is it any easy way to re-configure vim so it will use ...
11
votes
4answers
7k views

Vim - Trigger action\script on save\write?

This might be better for super user, but I figure as a tool of the trade it might be a better topic for here. I find often when editing in vim that I exit out, run some script that I am testing, and ...
11
votes
2answers
5k views

How to tell Vim to extend the background color to the whole screen?

I have an issue with the Vim color schemes: The background color does not fill the whole screen. For example, in the "blue" color scheme the whole screen should turn blue. Instead, the blue background ...
9
votes
4answers
15k views

How to enable color in Vim over SSH?

I have two remote servers: Server 1: Linux 2.6.18-238.12.1.el5PAE i686 / VIM - Vi IMproved - version 7.0.237 Server 2: Linux 2.6.18-338.19.1.el5.lve0.8.36 x86_64 / VIM - Vi IMproved version 7.0.237 ...
6
votes
7answers
2k views

Split vim window

How do I have vim and a console in the same window? For example, I am splitting up the vim window into multiple windows (vertically or horizontally). What I want is to have the code window on the left ...
6
votes
6answers
1k views

emacs for sys admins [closed]

Are you a sys admin that uses emacs? What tools/plugins do you find essential? In my organization the programmers tend to use emacs whereas the sys admins gravitate towards vim. Since we have 4:1 ...
5
votes
2answers
971 views

When using vim with screen the keys ctrl + right and ctrl + left don't work

In the last days i became very addicted of using the combination terminator (in full screen) + screen + vim. But i'm having problems with the ctrl + right and ctrl + left key mappings, they are ...
5
votes
3answers
5k views

Change location _viminfo file on Windows

I use gvim 7.2 script dev and other admin work on a Windows XP laptop and it has picked my network share as the location of the _viminfo. This is problematic because it takes a long time for vim to ...
5
votes
6answers
4k views

How do you use VIM to edit tabular data (tables)? Specifically, BIND (named) DNS db files

I'm usually a purist when it comes to vimming. I don't like remapping keys, or learning to rely on a bunch of plugins. I like to feel just as powerful on foreign boxen as I do on my own dev box. I do, ...
4
votes
3answers
2k views

How to I use Vim's increment (Control-a) when in a screen session?

Is there a way to re-map Control-a in screen to Alt-a or something else, so I can use Control-A in Vim normally (increments the number under the cursor)?
3
votes
13answers
1k views

Vim features and extension that make your work easier [closed]

What Vim features and extension do you use? Which would you recommend for a Linux sysadmin?
3
votes
1answer
339 views

Command output in vi editor

I open a text file using vi editor in linux and want to insert date command output without exiting vi editor. What is the trick? Thanks
3
votes
1answer
2k views

Vim SCP parameter with private public key pair

Currently, I am trying to edit a file on a remote server using Vim's built-in netrw plugin. I can SSH fine into my Amazon EC2 server using a command like this: ssh -i <keyfile> bitname@<ec2-...
3
votes
1answer
1k views

Can vim execute buffer without addons?

If editing some script in vim, a file with .py or .sh extension, is it any build-in vim command that allows to run such file? I know it's a lot of IDE-like addons for VIM that allows to execute files ...
3
votes
2answers
578 views

Setting a default vim filetype for syntax highlighting

How do I tell vim to automatically use a particular filetype (usually for syntax highlighting) when none is detected?
3
votes
1answer
2k views

disabling specific byobu/screen keybindings that conflict with vim keybindings

ctrl + a under byobu has either emacs mode or screen mode. However, I need keybindings like ctrl + a for vim's "increment value" method. How would I prevent byobu/screen from blocking certain keyboard ...
3
votes
2answers
1k views

Languages in vim editor

How to insert copy-paste a hindi language word from web pages to vim editor.When i do it now it says "..... . ....." What is the settings that has to be changed in vim editor to do this Thanks..
3
votes
1answer
162 views

Vim hangs on one specific file?

My putty session keeps on hanging when I'm in the middle of editing a file in vim. This has happened three times this morning. Hopefully it's nothing, just a glitch in the matrix somewhere, but I ...
2
votes
2answers
6k views

How do I enable characters like [Æ, Ø, Å] in PuTTY/Debian?

I'm using VIM through PuTTY to work on my development server, but it gets rather difficult when I have to work on files containing characters like those mentioned in the title. Not only does it make ...
2
votes
3answers
294 views

Most elegant way of ssh copying a file to a remote host, then executing it

I find myself performing this REPL-like action quite often: vim foo.sh scp foo.sh host:/tmp/foo.sh ssh host /tmp/foo.sh # realizing it wasn't quite right vim foo.sh scp foo.sh host:/tmp/foo.sh ssh ...
2
votes
3answers
2k views

VI Editor on Ubuntu using VIM Short Cuts?

I installed Ubuntu and I tried to use the terminal's vi editor. The editor is using a different set of short cut keys that I'm not familiar with. Someone told me it's probably using the VIM short ...
2
votes
1answer
998 views

Linode Lish Shell Vim and Nano rendering troubles: lines not appearing / cursor positions wrong

I'm using a linode VPS and I just cloned one of my servers to my development server as I've done many times before. As usual SSH is inaccessible until /etc/network/interfaces is correctly updated. I ...
2
votes
3answers
2k views

Vim keyboard remap on Snow Leopard (MacOs 10.6)

I want to have my external keyboard's HOME, END, PAGEDOWN and PAGEUP Working on Leopard's Terminal. So that I changed in Terminal > File > Preferences: Home: \033[H End: \033[F PageUp: \033[5~ ...
2
votes
1answer
34 views

FreeNAS prevents writing to VIMs .swp file

Our developers recently updated to the latest version of vim and sense then when they edit files from the network share hosted on a FreeNAS server, they eventually cannot write the file, as the .swp ...
2
votes
3answers
339 views

SSH access denied when 'authorized_keys' file is created with Vim

I created an ec2 instance with an Ubuntu 16.04 AMI. I created a sudo user for this AMI with: sudo adduser myuser sudo usermod -aG sudo myuser Then I attempted to give the user ssh access with an rsa ...
2
votes
2answers
1k views

Puppet and Vim fighting over Ruby version

I have installed puppet 3.0.1 from the .dmg from puppetlabs. If I remove ruby 1.9.3, puppet works, but other things like my vim install (dependant plugins) do not. According to http://docs.puppetlabs....
2
votes
1answer
2k views

Creating a global Vim configuration, including separate configuration files for plugins?

I use Arch Linux (ARM, but irrelevant) on a server machine, and I want to create a global configuration for Vim, based on my current personal configuration. I have already moved my ~/.vimrc to /etc/...
2
votes
2answers
228 views

Scrolling? ~ Vim ex mode

Feel free to point me to the appropriate documentation for this. When in ex mode ( Q ) and entering numerous commands, the file scrolls up to where you can't see what you're working on. Are there ...
2
votes
1answer
980 views

strftime returning time for wrong timezone

I'm trying to get "dts" to echo the current local time in vim (cygwin under Windows 7) byt the output is GMT+1 instead of the localtime (GMT-7). My abbreviation works fine on other machines, but I can'...
1
vote
4answers
2k views

Is linux VI editor different from vim editor

I want to use one editor which is available across all the system. Someone told me VIM is best and i tried on ubuntu and VIM was not there but vi is there. SO which one should i use
1
vote
2answers
3k views

Why can't I change the mode of /proc/sys/kernel/pty/max even when I am root?

Since pty is limited, I want to modify the content of /proc/sys/kernel/pty/max. The original value in max is 4096, and now I want to modify it to 10000. [root@home pty]# pwd /proc/sys/kernel/pty [...
1
vote
4answers
514 views

Editing root-writable files with only sudo rights

Our sysadmins login to boxes using unprivileged accounts with sudo rights. I often, out of habit, open files in vim instead of sudoedit. I do not want to get into the habit of using sudoedit. My ...
1
vote
4answers
494 views

Unable to grep sourced Files in Vim

I have files which I source in my files. I want to search them, when I am at a file which have these sources. I run unsuccessfully !bufdo grep source and !bufdo grep source % Example of .zshrc ...
1
vote
1answer
221 views

Some keys not working under screen in vim

When using vim under screen, some keys are not working. Namely, Pressing Alt-Left produces '3D' and Alt-Right produces '3C' Also, pressing Up/Down when scrolling list of files in Command-T plugin ...
1
vote
3answers
329 views

Unable to find the right fileformat for Screen's logs in Vim

I see alt text http://files.getdropbox.com/u/175564/fileformat-problem.png where I have ^M and ^[ at various places. The former seems to be enter, while the latter apparently the end/beginning of ...
1
vote
1answer
634 views

How to prevent users from renaming files while providing write permissions on Linux [closed]

For some special purpose, I want to prevent non-root users of the Linux Server from changing/renaming the filenames. However, they can modify and write to the contents of the file. How to do this from ...
1
vote
3answers
115 views

Change Vim configurable based on filetype

Is there a way where I can set vim to configure itself based on the filetype? So for example, text files have the equivalent of :set spell :syntax off Where a C source file has :syntax on :...
1
vote
2answers
161 views

Display a summary of the scope context with vim [closed]

Let say I am working on a code which look like this, in C for example. function foo() { int a; int b; 15 kLoC for (int i = 0; i < n; i++) { 15 kLoC if (bar) { while (true) { ...
1
vote
4answers
169 views

What $TERM value can you use on a Nokia N810 so Vim's key mappings work properly?

I'm connected to a Nokia N810 Internet Tablet through ssh. The default $TERM value is 'xterm' which causes all sorts of key bindings messes in Vim. Specifically the arrow keys, and home/end keys print ...
1
vote
1answer
877 views

Automate user quotas for edquota to bypass vim [duplicate]

Possible Duplicate: Setting up disk quota on ubuntu for multiple users When assigning user quotas, one has to use edquota. However, this brings up the vim editor. Is there any way to bypass this. ...