Fork me on GitHub
#vim
<
2023-11-05
>
practicalli-johnny14:11:17

Is there a command to yank the contents of the current buffer? I cant seem to find anything in the neovim docs or via an internet search. I appreciate I can do gg to jump to the top then v for visual mode and then G to select the whole buffer contents, y to yank the contents into the clipboard... am I missing a simpler command sequence or plugin?

practicalli-johnny14:11:05

Ah, if I do gg then I can do yG which feels simpler

nate14:11:21

Yup? That’s what I do.

👍 2
Nundrum14:11:28

You can :%y Similar to other sed-like commands, the % means apply to the whole buffer.

👍 4
1
tomd16:11:34

I sometimes save one whole keystroke with https://github.com/kana/vim-textobj-entire: yae

peterh18:11:43

Recently, I’ve been trying to use .md files for Clerk notebooks instead of .clj, since I sometimes have a lot more Markdown text to write than code and editing Markdown is (of course) much nicer in a dedicated buffer than in Clojure comments. However, editing Clojure code without my structural editing tools and without evaluation is very painful, so I was looking for a solution that works similar to how you can edit OrgMode code blocks in Emacs in a temporary buffer that has the correct major mode for the language. I found vim-fancy (https://github.com/vitalk/vim-fancy/), which does exactly what I need, but sometimes crashes Neovim when I evaluate forms that print to the console or when I open popup-buffers, etc. But if I am careful it works quite well for basic stuff. Timeshift (https://github.com/hkupty/timeshift.vim) does the same thing, but I couldn’t get it to work (somehow it doesn’t parse the filetype correctly in my code blocks). Just wanted to ask around if someone knows about another plugin or a different solution.

nbardiuk20:11:19

Haven't tried this, https://github.com/AckslD/nvim-FeMaco.lua supposed to create a floating window for fenced code with correct file type

👀 2
Leaf Garland05:11:13

If you are using neovim with tree-sitter parsers then this is built-in. If you use fenced code blocks that include the language then a matching parser will be injected in. eg, in this picture there is a clojure and typescript code-block and I have typescript and clojure parsers installed. My colorscheme is a bit minimal but you can see that the code is highlighting correctly

Leaf Garland05:11:15

Sorry, didn't read properly - you wanted other editing features not just highlighting.

peterh10:11:39

Yeah, the highlighting works, but not the structural editing & lsp plugins I use in Clojure files, unfortunately (not sure if this would even be possible within a single buffer).