Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion re-wraps lines? #4

Open
gauteh opened this issue Feb 21, 2018 · 4 comments
Open

Completion re-wraps lines? #4

gauteh opened this issue Feb 21, 2018 · 4 comments

Comments

@gauteh
Copy link

gauteh commented Feb 21, 2018

Hi, when I complete several addresses on the same field (e.g. To:) the lines are wrapped upon insertion. And I have to join the lines again before doing more completions. This is probably partly an effect of my settings as well. Do you have any sane settings where this does not happen?

@hgvhgv
Copy link

hgvhgv commented Jun 9, 2021

I know this is old, but in case anyone else comes here and sees this, I have the following autocommand that changes the tw based on the mail header. Works for me (probably taken from somewhere else, but can't find now). I guess I at one point also changed the fo on the fly, but now have that commented out.

" Set up ft=mail for different tw for headers
fun! s:mail()
augroup ft_mail_heds
    autocmd!
    autocmd CursorMoved,CursorMovedI *
        \  if index(["mailHeaderKey", "mailSubject", "mailHeaderEmail", "mailHeader"], synIDattr(synID(line('.'), col('.'), 1), 'name')) >= 0
        "\|     setlocal formatoptions=roqn1j
        \|     setlocal textwidth=0
        \| else
        "\|     setlocal formatoptions=jtcqlw
        \|     setlocal textwidth=79
        \| endif
augroup end
endfun

ETA: modified from here https://vi.stackexchange.com/questions/9174/line-number-specific-text-width-setting

@adborden
Copy link
Owner

adborden commented Jun 9, 2021

Thanks @hgvhgv ! Do you want to submit this as PR?

@hgvhgv
Copy link

hgvhgv commented Jun 10, 2021

I think this is something that users should do on their own, no? Altering formatting behavior for a completion plugin seems like it would be surprising/annoying?

@adborden
Copy link
Owner

Completely agree! Maybe I misunderstood the patch, it's been a while since I've done anything in vimscript. Is it possible to provide a PR that only adjusts the format for header lines? Store the current format options when you move onto a header line, then restore them when you move off?

If not, then it might be helpful to include your snippet in the README as a suggestion. Either way, I think there's a PR here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants