Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
putra surya herlambang
@putrasurya

Hi everyone,
i'm new to vim, anyone know how to select word and wrap the word with quote ?

i usually use vscode, i can select word and type quote and it will automatically wrap them with quote,

thank you

Abdelhakeem Osama
@abdelhakeem
@putrasurya Hi! This answers your question
Andrey Popp
@andreypopp
Vim surround also
Andrey Popp
@andreypopp
building neovim from sources: command fails the first time I run it, then going ok.
H.L Praveen Raj
@hlpr98
@KillTheMule hey, thanks for that :)
Justin M. Keyes
@justinmk
@hlpr98 nice blog post! I saw 2 minor typos: "NeoVim" should be "Neovim", and also "worry" should be "not worry" :)
zgpio
@zgpio
Typo: "GUI clinet” in feature work should be “GUI client"
Marco Hinz
@mhinz
@andreypopp What's the error?
H.L Praveen Raj
@hlpr98
@justinmk @zgpio thank you for the feedback :)... I have corrected the typos
Hirokazu Hata
@h-michael

if g:foo is not defined, I called like this then I get error.

local foo = vim.api.nvim_get_var('foo’)

So I called like this, but I could not catch the error.

local foo
if pcall(vim.api.nvim_get_var('foo’)) then
  foo = vim.api.nvim_get_var('foo’)
end

How to use vim.api.nvim_get_var with optional variables ?

Justin M. Keyes
@justinmk
@h-michael could use vim.api.nvim_call_function('exists'...).
Björn Linse
@bfredl
@h-michael you would need to get two return values from pcall
i e local status, res = pcall(vim.api.nvim_get_var('foo’))
Hirokazu Hata
@h-michael
@justinmk @bfredl I see, thanks :)
putra surya herlambang
@putrasurya

Hi everyone, is there quick way to wrap text with single/double quote? like in vscode, i just need to select the word and then type ", then it will automatically wrap the word with double quote

Thank you very much for the response

Björn Linse
@bfredl
@putrasurya your question was answered last time you asked it. I use the vim-surround plugin also.
putra surya herlambang
@putrasurya
@bfredl Thank you, sorry i was at my work hours ago, i've read it, but it seems kinda complex for me, i'm not type of fast typing person but very lazy to use mouse
Björn Linse
@bfredl
mouse how? the plugin defines a set of bindings you can use regardless if you selected the text with keyboard or mouse to start with.
putra surya herlambang
@putrasurya
@bfredl I see, thanks :)
Justin M. Keyes
@justinmk
select text then type S"
Edd Barrett
@vext01
Hey @justinmk
Justin M. Keyes
@justinmk
hi
Edd Barrett
@vext01
i'll have some time at the weekend to look at that PR again
Justin M. Keyes
@justinmk
ok, i'll try to push some ideas to it soon
Edd Barrett
@vext01
but i need help with that script helper thingy
thanks
Justin M. Keyes
@justinmk
@jamessan how about this approach for disabling the mouse temporarily: nnoremap <M-LeftMouse> <Cmd>set mouse=<Bar>autocmd CursorMoved * ++once set mouse=nv<CR>
James McCoy
@jamessan
@justinmk I'm missing some context here
Justin M. Keyes
@justinmk
@jamessan referring to old debate about enabling mouse=a
this gives a universal (non-terminal-specific) way to tell users how to use terminal-copy instead of vim-mouse-copy. And it's not an awkward normal-mode mapping, it's easy to use while hand is already on the mouse. Pretty close to best of both worlds: even over SSH one can use vim-mouse behavior, but if one needs to copy text, just do alt-click.
James McCoy
@jamessan
It should restore the original value, but otherwise possibly seems ok
Justin M. Keyes
@justinmk
\o/
James McCoy
@jamessan
The big problem is whether the terminal can communicate the <M-LeftMouse> to nvim
Justin M. Keyes
@justinmk
that should be quite a rare edge case
James McCoy
@jamessan
Is it though? Terminals suck
Justin M. Keyes
@justinmk
i think the main objection will be non-US keyboard layouts that lack ALT. I don't know how common that is, but the main goal is to solve the 80% case. Because right now we're solving the 50-60% case. Many users like having mouse enabled
Björn Linse
@bfredl
How common is it to lack ALT? Non-english keyboards typically has a left ALT that works like standard ALT/META and a right ALT/GR for typing additional symbols.
Justin M. Keyes
@justinmk
Not sure, I remember ZyX mentioned it and maybe 1 other person . I don't know which layout/keyboard though.
I'm testing this mapping for now, and so far it seems really nice.
Francisco Lopes
@oblitum
I have some weird behavior that happens consistently only inside a container, on popup, arrows work fine to go down and up, ctrl-n works to go down, but ctrl-p doesn't! it doesn't refresh the selection on the first ctrl-p, only when I press a second time, then it refreshes, but it jumps up twice. Anyone experienced something similar?
it's like it actually select-previous, but doesn't refresh the selection, only on the second time
James McCoy
@jamessan
@oblitum: maybe that's an escape key for your interface into the container and when you press it a second time, that disambiguates it, so both are sent down to nvim?
(grasping at straws)
Ryan Greenblatt
@rgreenblatt
Does anyone know why COLORTERM isn't set to 'truecolor' in terminals within nvim when termguicolors is enabled/should this be an issue?
Björn Linse
@bfredl
probably at least because no one has asked about it before :)
is it standard? xterm with truecolor does not set it at least
Ryan Greenblatt
@rgreenblatt
Fair enough. I will make an issue.
James McCoy
@jamessan
@abdelhakeem 8.1.0888 was the patch I remembered
Abdelhakeem Osama
@abdelhakeem
@jamessan Yup neovim/neovim#10819 :)