Fork me on GitHub
#vim
<
2022-03-18
>
noisesmith20:03:20

this seems like a totally newb thing, but I haven't been taking advantage of it enough:

nvim file.clj +100 # opens file to line 100
nvim file.clj +/foo # open file with search active, cursor on first match
a game changer if I am frequently going from the terminal back to make small edits

nice 6
Nundrum20:03:20

I didn't know about that! Nice!

noisesmith20:03:26

there's also -oN -ON -pN to start with N splits, N vsplits, or N tabs respecively, something I feel like I should put in an alias to reduce the amount of window management I do on startup

Nundrum20:03:14

I've done that with filenames. Like vim -O foo.txt bar.md

clj.max23:03:26

When I skip between small edits/terminal, I often just put vim into the bg with C-z and then bring it back with fg

clj.max23:03:38

But this is a nice trick, didn't know about it!

dharrigan09:03:55

One thing I really nope it would have (I use the + a lot to jump to a line), but to jump to a column isn't yet easily done, would to see something like foo.txt +13:10 or foo.txt +13,10 something like that, so I can jump to line, column.

Gunnar11:03:45

There are probably several ways. There usually is. 🙂 Here is the first I could think of. Yes it is verbose, but just wrap it in some alias or shell function that makes it simpler? vim file.clj +13 -c "normal 010lh" (go to line 13, column 10)

emilaasa08:03:36

'. goes to the last cursor position which is sometimes useful

emilaasa08:03:40

if you re-open a file

clj.max08:03:52

Within the same running instance of vim? I usually just scroll through C-o/i and it even changes the files for me.

Gunnar13:03:28

> vim file.clj +13 -c "normal 010lh" (The observant person will of course notice a small bug, that this way ends up on column 9 if the line is only 10 characters long, but I figured you need something "close enough")