On 2025-01-05, Salman Halim <salmanhalim@gmail.com> wrote:
> I may have missed the part where you're not checking the current buffer
> (the bufnr bit). Not sure of an easier way than what you have to check if
> another buffer is empty.
Thanks. For some reason the beginning of my message got cut away. The
context is that I need to check in a Vim script function whether
a buffer passed as a parameter to the function is empty or how many
lines it has.
Life.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/vles1p%24shh%241%40ciao.gmane.io.
Sunday, January 5, 2025
Re: Get buffer's line count and check for emptiness
I may have missed the part where you're not checking the current buffer (the bufnr bit). Not sure of an easier way than what you have to check if another buffer is empty.
Salman
On Sun, Jan 5, 2025, 08:13 Salman Halim <salmanhalim@gmail.com> wrote:
line('$') == 1 to see if it's just one line
getline('1') == '' to see if that line is completely emptySalmanOn Sun, Jan 5, 2025, 08:09 Lifepillar <lifepillar@lifepillar.me> wrote:var linecount = getbufinfo(bufnr)[0].linecount
I also need to check whether a buffer is empty, which I do like this:
var is_empty = linecount == 1 && empty(getbufoneline(bufnr, 1))
I'm wondering: is there any simpler way to perform the two tasks above
that I'm missing?
Thanks,
Life.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/vle098%24an9%241%40ciao.gmane.io.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CANuxnEdQ38TwkKnX3m5jcxAL0F31eoeXyTsp-G%3DPtmAetCE92Q%40mail.gmail.com.
Re: Get buffer's line count and check for emptiness
line('$') == 1 to see if it's just one line
getline('1') == '' to see if that line is completely empty
Salman
On Sun, Jan 5, 2025, 08:09 Lifepillar <lifepillar@lifepillar.me> wrote:
var linecount = getbufinfo(bufnr)[0].linecount
I also need to check whether a buffer is empty, which I do like this:
var is_empty = linecount == 1 && empty(getbufoneline(bufnr, 1))
I'm wondering: is there any simpler way to perform the two tasks above
that I'm missing?
Thanks,
Life.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/vle098%24an9%241%40ciao.gmane.io.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CANuxnEc5RKwWA9bKGmeu6cj0%3D5Ec0aJ6uzrmZ9%3DZMVFXNcUUDw%40mail.gmail.com.
Get buffer's line count and check for emptiness
var linecount = getbufinfo(bufnr)[0].linecount
I also need to check whether a buffer is empty, which I do like this:
var is_empty = linecount == 1 && empty(getbufoneline(bufnr, 1))
I'm wondering: is there any simpler way to perform the two tasks above
that I'm missing?
Thanks,
Life.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/vle098%24an9%241%40ciao.gmane.io.
I also need to check whether a buffer is empty, which I do like this:
var is_empty = linecount == 1 && empty(getbufoneline(bufnr, 1))
I'm wondering: is there any simpler way to perform the two tasks above
that I'm missing?
Thanks,
Life.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/vle098%24an9%241%40ciao.gmane.io.
Friday, January 3, 2025
Re: Problem with keyboard mapping
Yes, the nnoremap worked perfectly! It looks to be an issue with Ctrl+space for some reason.
Thank you so much Igbanam for your help - I was struggling with this for several months and was ready to give up on getting the vim mapping right.Thanks,
Ven
On Thu, Jan 2, 2025 at 4:24 PM Igbanam Ogbuluijah <xigbanam@gmail.com> wrote:
Could you try this mappingnnoremap <leader><space> :SWSqlExecuteCurrent<CR>I don't know how the leader key would work with <C-space> (which I read as <ctrl><space>).Igbanam--On Thu, Jan 2, 2025 at 5:47 PM Ven Tadipatri <vtadipatri@gmail.com> wrote:Hi,--I have the Vim Sql Workbench plugin, and I'm trying to get the keyboard shortcut working. When I type ":nmap", I see that this mapping is there:n \<C-Space> @:SWSqlExecuteCurrent<CR>However, when I type "backslash - ctrl - space" , the Terminal just flashes and does nothing. I've tried using a different leader key, and the same thing happens, so it doesn't seem to be a Mac Terminal setting.This is on a mac, with vim 9.1 . On my old mac, this keymapping was working. It still works if I type ":SWSqlExecuteCurrent", it's just the keyboard shortcut that I'm struggling with.Would appreciate any help!Thanks,Ven
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAEodY67Vww8pR%2B6K24T33YcKgsBXw97byZPYWa9YXrb4Z-3jVg%40mail.gmail.com.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAOmRJrcZZB_kgtTSDz%3DAXUsmTp%3D0paqMv4hi%3D_6CK%3DtYaei2Mw%40mail.gmail.com.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAEodY65Q8hZrBjtOXsCkLUFcWL4CnMwLbM2WCn-AqqsASe3w-Q%40mail.gmail.com.
Thursday, January 2, 2025
Re: Problem with keyboard mapping
Could you try this mapping
nnoremap <leader><space> :SWSqlExecuteCurrent<CR>
I don't know how the leader key would work with <C-space> (which I read as <ctrl><space>).
Igbanam
On Thu, Jan 2, 2025 at 5:47 PM Ven Tadipatri <vtadipatri@gmail.com> wrote:
Hi,--I have the Vim Sql Workbench plugin, and I'm trying to get the keyboard shortcut working. When I type ":nmap", I see that this mapping is there:n \<C-Space> @:SWSqlExecuteCurrent<CR>However, when I type "backslash - ctrl - space" , the Terminal just flashes and does nothing. I've tried using a different leader key, and the same thing happens, so it doesn't seem to be a Mac Terminal setting.This is on a mac, with vim 9.1 . On my old mac, this keymapping was working. It still works if I type ":SWSqlExecuteCurrent", it's just the keyboard shortcut that I'm struggling with.Would appreciate any help!Thanks,Ven
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAEodY67Vww8pR%2B6K24T33YcKgsBXw97byZPYWa9YXrb4Z-3jVg%40mail.gmail.com.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAOmRJrcZZB_kgtTSDz%3DAXUsmTp%3D0paqMv4hi%3D_6CK%3DtYaei2Mw%40mail.gmail.com.
Re: Adding a single space to 'isk' but not multiple spaces?
On 2025-01-02, Tim Chase <vim@tim.thechases.com> wrote:
> Using ledger(1) for finances, fields are usually delimited by runs
> of 2+ spaces (or a tab), allowing a single space in the account-name.
> So I might have a transaction like
>
> 2024-012-31 ! Groceries
> Expenses:Household:Groceries:Food Lion $18.43
> Liabilities:Credit Card:Visa -$18.43
>
> (note the 2+ space indent and the 2+ space separation between the
> account and the amount, while the single space in "Food Lion" and
> "Credit Card")
>
> It would be awfully handy to have colons and single-spaces be part
> of 'isk' so that i_CTRL-N and i_CTRL-P can find full accounts
> is there a better solution I've overlooked?
Do you know about https://github.com/ledger/vim-ledger? Even if you
don't want a plugin, you may still copy its LedgerComplete omnifunc
function. I'm not using it currently, but I wrote the initial version of
it, and unless something was changed, it should allow you to complete
accounts by specifying prefixes. So, for instance, Ex:F:G<tab> becomes
Expenses:Food:Groceries. Very handy.
Btw, I have a bunch of mappings for several reports. They may not be up
to date, but in case you're interested:
https://github.com/lifepillar/vimrc/blob/master/after/ftplugin/ledger.vim
Hope this helps,
Life
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/vl6vn3%24fci%241%40ciao.gmane.io.
> Using ledger(1) for finances, fields are usually delimited by runs
> of 2+ spaces (or a tab), allowing a single space in the account-name.
> So I might have a transaction like
>
> 2024-012-31 ! Groceries
> Expenses:Household:Groceries:Food Lion $18.43
> Liabilities:Credit Card:Visa -$18.43
>
> (note the 2+ space indent and the 2+ space separation between the
> account and the amount, while the single space in "Food Lion" and
> "Credit Card")
>
> It would be awfully handy to have colons and single-spaces be part
> of 'isk' so that i_CTRL-N and i_CTRL-P can find full accounts
> is there a better solution I've overlooked?
Do you know about https://github.com/ledger/vim-ledger? Even if you
don't want a plugin, you may still copy its LedgerComplete omnifunc
function. I'm not using it currently, but I wrote the initial version of
it, and unless something was changed, it should allow you to complete
accounts by specifying prefixes. So, for instance, Ex:F:G<tab> becomes
Expenses:Food:Groceries. Very handy.
Btw, I have a bunch of mappings for several reports. They may not be up
to date, but in case you're interested:
https://github.com/lifepillar/vimrc/blob/master/after/ftplugin/ledger.vim
Hope this helps,
Life
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/vl6vn3%24fci%241%40ciao.gmane.io.
Re: Adding a single space to 'isk' but not multiple spaces?
The option that you seem to exclude is setlocal complete+=k{dict} for a dict file of your accounts.
How about redefining :help 'define'/'include', or ~/.ctags suitably to detect and complete them by `i_ctrl-x_ctrl-d/i/] ?
Le jeudi 2 janvier 2025 à 20:12:20 UTC+1, Tim Chase a écrit :
Using ledger(1) for finances, fields are usually delimited by runs
of 2+ spaces (or a tab), allowing a single space in the account-name.
So I might have a transaction like
2024-012-31 ! Groceries
Expenses:Household:Groceries:Food Lion $18.43
Liabilities:Credit Card:Visa -$18.43
(note the 2+ space indent and the 2+ space separation between the
account and the amount, while the single space in "Food Lion" and
"Credit Card")
It would be awfully handy to have colons and single-spaces be part
of 'isk' so that i_CTRL-N and i_CTRL-P can find full accounts (even
if they contain the occasional space), but that starts causing weird
issues (Vim really doesn't like having space in 'isk')
I've tried i_CTRL-X_CTRL-L to do whole-line completion but I have
enough transactions (and each amount regularly differs) that this
returns dozens or hundreds of matching lines, so it's less than useful.
Short of completely hijacking ^N/^P functionality to complete from
my known chart of accounts, is there a better solution I've overlooked?
Thanks!
-tim
(1) https://ledger-cli.org/
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/7d78e736-18ff-4d7f-98e0-3a1c9f6c2348n%40googlegroups.com.
Adding a single space to 'isk' but not multiple spaces?
Using ledger(1) for finances, fields are usually delimited by runs
of 2+ spaces (or a tab), allowing a single space in the account-name.
So I might have a transaction like
2024-012-31 ! Groceries
Expenses:Household:Groceries:Food Lion $18.43
Liabilities:Credit Card:Visa -$18.43
(note the 2+ space indent and the 2+ space separation between the
account and the amount, while the single space in "Food Lion" and
"Credit Card")
It would be awfully handy to have colons and single-spaces be part
of 'isk' so that i_CTRL-N and i_CTRL-P can find full accounts (even
if they contain the occasional space), but that starts causing weird
issues (Vim really doesn't like having space in 'isk')
I've tried i_CTRL-X_CTRL-L to do whole-line completion but I have
enough transactions (and each amount regularly differs) that this
returns dozens or hundreds of matching lines, so it's less than useful.
Short of completely hijacking ^N/^P functionality to complete from
my known chart of accounts, is there a better solution I've overlooked?
Thanks!
-tim
(1) https://ledger-cli.org/
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/Z3blCljFHiSixi1_%40thechases.com.
of 2+ spaces (or a tab), allowing a single space in the account-name.
So I might have a transaction like
2024-012-31 ! Groceries
Expenses:Household:Groceries:Food Lion $18.43
Liabilities:Credit Card:Visa -$18.43
(note the 2+ space indent and the 2+ space separation between the
account and the amount, while the single space in "Food Lion" and
"Credit Card")
It would be awfully handy to have colons and single-spaces be part
of 'isk' so that i_CTRL-N and i_CTRL-P can find full accounts (even
if they contain the occasional space), but that starts causing weird
issues (Vim really doesn't like having space in 'isk')
I've tried i_CTRL-X_CTRL-L to do whole-line completion but I have
enough transactions (and each amount regularly differs) that this
returns dozens or hundreds of matching lines, so it's less than useful.
Short of completely hijacking ^N/^P functionality to complete from
my known chart of accounts, is there a better solution I've overlooked?
Thanks!
-tim
(1) https://ledger-cli.org/
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/Z3blCljFHiSixi1_%40thechases.com.
Problem with keyboard mapping
Hi,
-- I have the Vim Sql Workbench plugin, and I'm trying to get the keyboard shortcut working. When I type ":nmap", I see that this mapping is there:
n \<C-Space> @:SWSqlExecuteCurrent<CR>
However, when I type "backslash - ctrl - space" , the Terminal just flashes and does nothing. I've tried using a different leader key, and the same thing happens, so it doesn't seem to be a Mac Terminal setting.
This is on a mac, with vim 9.1 . On my old mac, this keymapping was working. It still works if I type ":SWSqlExecuteCurrent", it's just the keyboard shortcut that I'm struggling with.
Would appreciate any help!
Thanks,
Ven
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAEodY67Vww8pR%2B6K24T33YcKgsBXw97byZPYWa9YXrb4Z-3jVg%40mail.gmail.com.