Live data from Hacker News

Five lines I put in a blank .vimrc

swordandsignals.com

121–130 of 133 posts

Re: Five lines I put in a blank .vimrc

#122
post #47

Kinda derailing the thread but might ask anyway, does anyone got recommendations on dot files synchronization through personal devices? I'm currently using a git+ss repo on a personal server. I wonder if there are more convenient ways to do this.

I wrote a program to solve this: https://github.com/knoebber/dotfile/

If I were on a fresh VM with an internet connection and wanted my vimrc, I would do

  curl https://dotfilehub.com/knoebber/vimrc >> ~/.vimrc

Re: Five lines I put in a blank .vimrc

#123
post #113

Earlier quoted context omitted.

I once had to connect to machines regularly where I did not have a home directory. This happened so often that I wrote a wrapper to log in: It would log into the remote machine using Expect, then it would send a command to the remote end that tested whether a home directory already existed. If so, it spawned a new shell in it. Otherwise it created a "home directory" in /tmp, pulled a tarball from a server, and extrac…

That's cool. Do you have a write-up of this somewhere?

Thank you for giving me a reason to start a blog :-)

Re: Five lines I put in a blank .vimrc

#124

Earlier quoted context omitted.

inoremap jk inoremap kj are essential to me... press both at the same time and you exit insert mode regardless of which one gets pressed slightly faster and you never leave the home row and if you press it when you are not in insert mode it's basically a nop unless you are at the start or end of the file. even if you are you might move down or up a line accidentally but i've never had that happen personally.

Then you can't type words that have jk or kj in them, right? :) Depending on languages used it could be a blocker

you certainly can. it just requires you to wait whatever the timeout is set to. it doesn't come up all that often and i've used it for a long time.

Re: Five lines I put in a blank .vimrc

#125
post #61

Earlier quoted context omitted.

If your vim is compiled with the correct flag for GUI operations (I forget which), you can yank/delete text into the * or + registers to make it available to the system clipboards. This won't bring the line numbers, and lets you avoid using the mouse.

I use vim in a terminal, the way the gods intended, not gvim. ;-P But apparently according to peer comments, there are ways to yank into clipboards, which is pretty cool.

This works with standard vim in a terminal as well. I too follow the old gods.

Re: Five lines I put in a blank .vimrc

#126
post #21

The swap file saved my work a number of times. If you never use recover and use Vim regularly, then go ahead and disable it; if you haven't used it because you don't know how to use it or you only rarely use Vim, then I'd encourage you to either try it first or leave it enabled (as it is by default) until it becomes a nuisance. And like u/strogonoff, I also disable line numbers, but that's just personal preference of…

inoremap jk inoremap kj are essential to me... press both at the same time and you exit insert mode regardless of which one gets pressed slightly faster and you never leave the home row and if you press it when you are not in insert mode it's basically a nop unless you are at the start or end of the file. even if you are you might move down or up a line accidentally but i've never had that happen personally.

I tried that, but found it annoying to occasionally get kicked out of insert mode while writing. I ended up rebinding Caps Lock to Escape instead, with Shift+CL to toggle caps; I quite like this rebinding even outside Vim. Two lines in autohotkey on Windows, or setxkbmap in X11.

Re: Five lines I put in a blank .vimrc

#127
post #27

It’s not enough. You should go all the way: set nobackup set nowritebackup set noundofile set noswapfile I explain why at https://lee-phillips.org/badvim/ Also, it’s best to just have one instance of Vim running, in server mode, so you can send files to it from the command line.

I laughed at the poetry of the line "I don’t really want Vim to litter my filesystem with all of these piles of nervous energy." Truth

I was still thinking about this today. "I have all these receipts everywhere..."

Re: Five lines I put in a blank .vimrc

#128

What is the kakoune equivalent of these options?

`hook global RegisterModified '/' %{ add-highlighter -override global/search regex "%reg{/}" 0:+u }` will underline the current search pattern

There is no ignorecase option, `(?i)` is the way to enable that in a regex, you can `map global normal / /(?i)` to auto insert-it

incsearch is the same

`add-highlighter global/ number-lines` display line numbers for all buffers

There is no swap file in Kakoune.

Re: Five lines I put in a blank .vimrc

#129
post #47

Kinda derailing the thread but might ask anyway, does anyone got recommendations on dot files synchronization through personal devices? I'm currently using a git+ss repo on a personal server. I wonder if there are more convenient ways to do this.

I have tried a custom linking script, Ansible, and stow. The best I have found is to just use a bare git repo based off of: https://www.atlassian.com/git/tutorials/dotfiles The idea is to make an alias that runs git so that it treats your home directory as a git repository and you can directly commit them. I would recommend bypassing that article's `config config --local status.showUntrackedFiles no` setting and sett…

Thanks! Using Ansible sounds like a great idea, specially when it allows me to also match installed packages!

Would be great if I could combine with a local secrets engine. Like Hashicorp Vault but local.

Re: Five lines I put in a blank .vimrc

#130
post #2

Keeping the swapfile on is really helpful when I accidentally open the same file in two different vim editors. But I do recommend configuring vim to place swapfiles in a different location, so you’re not scattering them all over your disk.

I actually went full on in the other direction and often have multiple vim instances working on the same file. It feels so much better than having to deal with swap file error messages. With the below it reloads the file when the window gets into focus. Super helpful when working in lots of terminal tabs. You just have to get into a habit of saving after every change as it conflicts otherwise. " check for and load fi…

why would you need to open the same file in multiple tabs instead of switching tabs to get to the file.

in the few cases where i really need to open the file multiple times i use tmux to allow a shared view.

Post reply on HN