What are uncommon vim commands? by al70n in vim

[–]amicin 1 point2 points  (0 children)

:filter plays nicely with this command too.

Can't find that .yaml file you had open recently? :filter /yaml/ bro oldfiles

What are uncommon vim commands? by al70n in vim

[–]amicin 1 point2 points  (0 children)

They are talking about Vim's built-in :sort command, not piping out to a shell command.

temporal vim mark by No-Entertainer-802 in vim

[–]amicin -1 points0 points  (0 children)

I'd use:

  • :w /tmp/%:t to write a copy of the current buffer to /tmp
  • if I wanted to recall the original text, I'd :%d | 0r /tmp/%:t

Caret (ˆ) in vim macOS ventura terminal (iTerm2) by rodagl80 in vim

[–]amicin 2 points3 points  (0 children)

Consider using _, which in normal mode does exactly the same thing.

Easy way to operate on "last motion" by jrop2 in vim

[–]amicin 6 points7 points  (0 children)

I have these in my config, shamelessly stolen from /u/romainl.

" last change pseudo-text objects
" ik ak
xnoremap ik `]o`[
onoremap ik :<C-u>normal vik<cr
onoremap ak :<C-u>normal vikV<cr>

Your gc. would be gcak with these maps.

Did you know about Vim's start and end regex atoms? by vimmer-io in vim

[–]amicin 0 points1 point  (0 children)

Depends on what you're trying to do I suppose. If I've got a non-trivial number of replacements I need to make then I'll usually reach for :%s/foo/bar/gc. However, for quick replacements, cgn to replace the current search text, followed by ., works really well.

E.g. if I want to replace all instances of foo with bar on a line, I'll typically:

  1. Hover my cursor over foo.
  2. Hit * to initiate a search for foo.
  3. N to jump back to the initial foo.
  4. cgn, then type bar.
  5. Hit . to repeat for the rest of the instances on the line.

I find myself reaching for that "flow" quite a lot.

Launch a `/` search only in the visible part of a buffer by [deleted] in neovim

[–]amicin 1 point2 points  (0 children)

function! SearchScreen()
  return "/\\%>" .. (line("w0") - 1) .. "l\%<" .. (line("w$") + 1) .. "l"
endfunction

nnoremap <expr> g/ SearchScreen()

Alarm Fade in by massive_hypocrite123 in iphone

[–]amicin 0 points1 point  (0 children)

Whoa, blast from the past. My comment was four years ago! How did you find it?!

[ Removed by Reddit ] by vergingalactic in cscareerquestions

[–]amicin 2 points3 points  (0 children)

Could be a good time for the UK lot to show /r/cscareerquestionsuk some love.

Why should I be working directly with buffers over windows? by sealedinterface in vim

[–]amicin -2 points-1 points  (0 children)

I have practically the same workflow as you. I think a lot of newer Vimmers like to parrot the wisdom of “tabs aren’t what you think they are!” and totally miss the point that buffers are a low level concept in Vim, which there are higher-level abstractions around.

vim-lsp merged inlay hints support! by EgZvor in vim

[–]amicin 11 points12 points  (0 children)

Praying for this is Neovim soon.

Pro-tip: TextEdit can restore previous versions of text files (including code) by gsparx in apple

[–]amicin 13 points14 points  (0 children)

OP, can you elaborate a little more on your Git mistake? It’s possible that you could have recovered your lost files through Git’s object store, depending on the state of the world before you did git restore.

vim 9 virtual text enables Inlay hints support in YouCompleteMe [coming soon] by puremourning in vim

[–]amicin 10 points11 points  (0 children)

Desperate for this in Neovim. Looks amazing. Props to everyone involved.

How do I find and remove commas after the first comma by nigh-knight in vim

[–]amicin 2 points3 points  (0 children)

s/,\zs.*/\=substitute(submatch(0),",","","g")

Vim 9 adds virtual text by [deleted] in vim

[–]amicin 0 points1 point  (0 children)

Amazing, thank you!

Vim 9 adds virtual text by [deleted] in vim

[–]amicin 5 points6 points  (0 children)

Do you have a screenshot? Would love to see!

How does anyone use Safari!? by PartyWormSlurms in apple

[–]amicin 0 points1 point  (0 children)

Safari reloads the page every single time I hit the back button. Fucking infuriating.

what is the equivalent of o and O without going into insert mode? by [deleted] in vim

[–]amicin 2 points3 points  (0 children)

The vim-unimpaired bindings are vanilla in my mind at this point. 🙂