News for hackers. Stuff that matters.
Re:Steve Losh's .vimrc by LeafStorm on Friday November 18, 2011 @10:19AM (#3251970)
That's one thing that worries me about using vim full-time: if I become reliant on a .vimrc or a set of plugins to use vim effectively, but I'm on a computer that doesn't have my .vimrc on it, I'm doomed.
Re:Steve Losh's .vimrc by billybob on Friday November 18, 2011 @10:40AM (#3252036)
I feel exactly the opposite. The previous editors that I used required configuration through a menu system. I wouldn't have known how to take that with me elsewhere.

With Vim, all my configuration is in files, which can be backed up. I have them in a dotfiles repo on Github. As I make tweaks, I regularly pull and push from my various computers and they are always up to date. If I'm on a computer that doesn't have my .vimrc, I'm just a `git pull` away from having it. (Same goes for zsh config, etc.)

The most likely time for me not to have my .vimrc is when sshing into a server, in which case I can use stock vim just fine. If my main editor were a GUI, I wouldn't have it available at all, so I think Vim has a leg up in that, too.

Re:Steve Losh's .vimrc by billybob on Friday November 18, 2011 @02:35PM (#3253037)
By the way, if you're ever confused about what behavior is native and what comes from your config, use the `-u "NONE"` option to run vanilla vim (or macvim or gvim).
Re:Steve Losh's .vimrc by secoif on Friday November 18, 2011 @02:35PM (#3253040)
you can get around this by editing remote files with your vim over scp http://vim.wikia.com/wiki/Editing_remote_files_via_scp_in_vi...
Re:Steve Losh's .vimrc by bostonvaulter2 on Saturday November 19, 2011 @01:34AM (#3254780)
I do the same thing. But I also have customized branches to work with my config. I will usually make new commits on the computer-specific branch and then cherry pick the commits to master and then rebase the computer-specific branch on top of master. This can get a little repetitive and result in my computer-specific branches getting very out of date so I wrote a bash script called git-update to streamline this process for me. Here's the code:

https://github.com/axelson/git-update

Re:Steve Losh's .vimrc by zmanji on Friday November 18, 2011 @10:24AM (#3251979)
This is why people place them on github or bitbucket. So it is very easy to clone the repo locally and then use the .vimrc. It is something you only have to do once per machine.
Re:Steve Losh's .vimrc by rudenoise on Friday November 18, 2011 @10:28AM (#3251995)
I totally agree. Personally I take the Robert De Niro approach:

"...become attached to nothing in life that you can't walk away from in 30 seconds if you spot the "Heat" around the corner."

Except I apply this to customised/complicated software rather than "things" in my life.

Re:Steve Losh's .vimrc by SandB0x on Friday November 18, 2011 @11:05AM (#3252147)
On all my machines ~/.vimrc and friends are symlinked out from my Dropbox folder.
Re:Steve Losh's .vimrc by loevborg on Friday November 18, 2011 @11:53AM (#3252360)
This is what I do as well. To make thinks simpler, I use this script to automatically create the symlinks (if they are not already existant). If you put it in your `.zshrc`, you can run the command `dropbox-update-dotfiles` to make or update the symlinks. Not that this makes use of `zsh` extensions, so it requires adaptation to use with bash.

  dropbox-update-dotfiles () {
    src="$HOME/Dropbox/dotfiles"
    dst="$HOME"
  
    if [[ ! -d "$src" ]]; then
      print "Directory $src not found."
    fi
  
    for f in "$src"/*~*(.swp|~|.pyc)(D); do
      if [[ -h "$dst/${f:t}" ]]; then
        # exists as symlink
      elif [[ -e "$dst/${f:t}" ]]; then
        print "WARNING: ${f:t} exists, but is not a symlink."
      else
        ln -sv "$f" "$dst"
      fi
    done
  }
Re:Steve Losh's .vimrc by tednaleid on Friday November 18, 2011 @12:19PM (#3252470)
I use zsh too, but did something similar that should also work in bash: http://naleid.com/blog/2011/10/03/using-dropbox-to-share-you...

I link my dot files as well as Documents, Pictures, Music, and Desktop directories that are also normally controlled by OSX. Having those shared across multiple computers is awesome. Sit down at a computer, and it's there.

I also have my zsh files checked in to bitbucket (https://bitbucket.org/tednaleid/shared-zshrc/) so even if the computer doesn't have dropbox (like many of the linux servers I have access to), as long as it has mercurial, I can clone the repo and be ready to go.

Re:Steve Losh's .vimrc by ldh on Friday November 18, 2011 @10:22AM (#3251977)
Does that computer have a network connection? Just store your plugins and settings in a git repo (a good idea anyway) and pull them down on whatever machine you're using.
Re:Steve Losh's .vimrc by agscala on Friday November 18, 2011 @10:36AM (#3252024)
This is what I do. I can clone a git repo, run an install script, and have my typical vim setup running in a trivial amount of time.
Re:Steve Losh's .vimrc by stevelosh on Friday November 18, 2011 @10:57AM (#3252116)
Same here.

    cd
    hg clone http://bitbucket.org/sjl/dotfiles .dotfiles
    ln -s `pwd`/.dotfiles/vim/.vimrc ~/.vimrc
    cd -
My full Vim config is now installed, plugins included thanks to Mercurial's subrepos.

But really, I don't find myself editing files directly on servers all that often. And when I do I usually prefer bcvi anyway, because I can use MacVim instead of Vim through a terminal (which I hate because of all the shadowed keys).

Re:Steve Losh's .vimrc by ansible on Friday November 18, 2011 @11:26AM (#3252248)
Rather than type in the symbolic link commands, I just have a config script that I run (also checked into version control) that will move the old .vim directory, .bashrc, and other files out of the way, and install links to the version controlled file instead. Easy.
Re:Steve Losh's .vimrc by tuxcanfly on Friday November 18, 2011 @11:44AM (#3252324)
Re:Steve Losh's .vimrc by jodoherty on Friday November 18, 2011 @11:00AM (#3252130)
I've basically memorized my .vimrc and .gvimrc files from retyping them over and over again, but then I take the approach of using the standard configuration when possible and only customizing the minimum required, so it's not as bad as it sounds.

The power of VIM as an effective and consistent text editor is far more important to me than the power of VIM as a highly configurable editor.

Re:Steve Losh's .vimrc by loire280 on Friday November 18, 2011 @10:29AM (#3252002)
This is why I stick pretty close to stock vim - I use it on too many remote systems to worry about keeping my environment consistent. I could automate something, and maybe when our sysadmin finishes integrating puppet into our servers I can use that, but in the meantime, my .vimrc is just syntax highlighting and tab settings.
Re:Steve Losh's .vimrc by mun2mun on Friday November 18, 2011 @04:24PM (#3253485)
Even in new computer without net connection vanilla vim is good enough for editing. When sit in an alien computer with vanilla vim. At first I put these lines in .vimrc

   set nocp
   set hidden
   set ts=2
   set sw=2
   set autoindent
   set incsearch
   filetype on
   filetype plugin on
   map <C-J> <C-W>j
   map <C-K> <C-W>k
   map <C-l> <C-W>l
   map <C-h> <C-W>h
For buffer management, combination of :ls, :b and :b# does the job well enough, compiling command-t plugin isn't necessary :). For listing of files there is :sexplore . For code browsing there is plain old ctags. There you go, almost 90% of environment created. Other things like surround or snipets support would be better. But I don't use them most of the time :).
Re:Steve Losh's .vimrc by qdog on Friday November 18, 2011 @12:19PM (#3252473)
echo set ts=3 > ~/.vimrc echo "Toggle search highlighting on and off with F5 >> ~/.vimrc echo map "<F5> : set hls\!<bar>set hsl?<CR>" >> ~/.vimrc

Everything else is gravy for me. While an extended rc is handy and I often store one where I can get to it, if I'm just editing a couple of files, vanilla + the tab size I want and a shortcut to highlighting search terms gets me going. YMMV

I tried to get into emacs, but I kept coming back to vim. Probably because the first editor I really used was a version of 'ed' back when I played MUDs.

Re:Steve Losh's .vimrc by sce on Saturday November 19, 2011 @06:01AM (#3255073)
Enter is actually a good candidate for something like that:

  " turn off highlighted results (set nohlsearch) when pressing enter.
  " just pressing n or N will turn the highlight back again
  nnoremap <cr> :noh <cr>
https://github.com/sce/dotfiles
Re:Steve Losh's .vimrc by sjs on Friday November 18, 2011 @10:58AM (#3252120)
I run

    wget -qO - bit.ly/newbox | sh
or

    curl -Ls bit.ly/newbox | sh
and am up and running. No sweat. I keep this stuff in Dropbox too, just in case.
Re:Steve Losh's .vimrc by JoshTriplett on Friday November 18, 2011 @03:18PM (#3253229)
That's a huge amount of trust you've placed in bit.ly, and in insecure http. You might at least consider typing out https://bit.ly/newbox so that you only have to trust bit.ly. Better yet, memorize the URL that bit.ly links to.

Also, why do you symlink your dotfiles into your cloned git repo, rather than just checking out the git repo as ~? Personally, I just move the .git directory from the clone to ~, and then "git checkout -f".

Re:Steve Losh's .vimrc by sjs on Friday November 18, 2011 @03:56PM (#3253372)
I'm lazy and don't want to type out the github URL, but you're right I should place the redirection under my control and use HTTPS. Honestly though I cannot think of a single reason why anyone would want to hijack my script. I don't do anything very interesting that would make my machine a lucrative target for that sort of malicious activity. I'm a very small fish in a massive pond.

Also due to laziness I don't want to add a bunch of stuff to .gitignore, or add * and then add exceptions. I like having the symlinks.

Re:Steve Losh's .vimrc by gerrit on Saturday November 19, 2011 @10:13AM (#3255408)
Re:Steve Losh's .vimrc by mhansen on Friday November 18, 2011 @10:41PM (#3254495)
Just watch out that you don't get a 404 one day and end up piping a whole lot of error screen HTML into your shell, it could have wildly unpredictable results.
Re:Steve Losh's .vimrc by Dobbs on Friday November 18, 2011 @12:11PM (#3252430)
On foreign machines I'm rarely doing anything complicated enough where not having my .vimrc is noticeable. If I'm going to be spending a lot of time working on something, then it isn't a problem to either use my local machine or sshfs the remote server and work on it from my local editor.

I try and keep my .vimrc limited to configuration and enhancement and not change how the core works. Things like rebinding builtin actions will never be seen in my .vimrc.

Re:Steve Losh's .vimrc by marshray on Friday November 18, 2011 @11:07AM (#3252155)
I've had that concern as well but have not found it to be a problem in practice. For one thing, it's not hard to go back to default vim if you're on a different system. For another, it's usually not that hard to copy your .vimrc over if you're going to stay awhile.
Re:Steve Losh's .vimrc by oops on Friday November 18, 2011 @10:22AM (#3251976)
What editor do you use now?
Re:Steve Losh's .vimrc by dextorious on Saturday November 19, 2011 @08:50AM (#3255279)
Really? You are doomed because you don't have some extra configuration niceties? Basic vim editing is not enough?

Then I have to ask: what exactly are you doing in that other computer?

If it's just some temporary sysadmin stuff and the like, then you surely can get by with the basic vim functionality.

Now, If you're gonna be using that other computer for a longer period, then why not just add your .vimrc there? With github, bitbucket, dropbox et al you can have your configuration pushed to the other computer in seconds.

I also find that with everybody having laptops these days, the need to use some "other computer" is much less frequent.