GithubHelp home page GithubHelp logo

vim-bucky's People

Contributors

dbmrq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sisrfeng

vim-bucky's Issues

Ignore lines in certain environments or between special comment markers

List of environments to be ignored

There are many ways to embed different type of source code into a texfile. A few examples are

  • bib files put into \begin{filecontents}{my.bib}/\end{filecontents
  • luatex
  • pythontex (package pythontex)
  • gnuplot (package gnuplottex)
  • asymptote
  • markdown
  • ...

They are typically content of a specific environment. Obviously, a list of these specific environments should be customisable since there are too many possibilities to add all of them to vim-bucky itself.
I personally would also add math environments where I use alignment tools such as vim-easy-align, tabular.vim or Align by Dr.Chip (e.g. systems of equations).
Also tables are a likely candidate that somebody wants to format them with a different tool than by vim-bucky.

The tool neoformat allows to use a different formatter for a visual selection than the default one for the file.

Ignore lines between special marker

A second feature request is to add support for manual markers to ignore lines in the code.

Tools such as astyle and uncrustify support the lines // *INDENT-OFF* and // *INDENT-ON*. clang-format uses // clang-format off/on and yapf (python) # yapf: disable/enable.
I would prefer a less tool specific marker such as // *INDENT-OFF* even though indent-off means more than just disabling indentation but all formatting at all.

RFC: textwidth=0 could mean no hardwrap

I was thinking about your hardcoded 78 which is used if textwidth=0 (tw=0).

I can imagine that your plugin could also be used by people who actually softwrap lines
but want to place every sentence on a single line.
Also some people work together with others who use softwrap and simply follow the existing style.
This could be the behavior if tw=0 and wrap=on (default of vim).

Furthermore, IMHO there is no need for a plugin specific variable to adjust the 78.
The user should set tw to his liking if he wants to have hardwrapping.

Inline math at the beginning of a sentence

Consider following text and its current result from vim-bucky with tw=80:

At vero eos et accusam et justo duo dolores et ea rebum.
Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
  amet. $E$ is a quantity ipsum dolor sit amet, consectetur adipisicing elit,
  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
  aliquip ex ea commodo consequat.

However, $E$ should be on a new line:

At vero eos et accusam et justo duo dolores et ea rebum.
Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
  amet.
$E$ is a quantity ipsum dolor sit amet, consectetur adipisicing elit, sed do
  eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
  aliquip ex ea commodo consequat.

Just for comparison latexindent version 3.5 handles this partially correctly:

❯ latexindent demo.tex -m -l=localSettings-lst269.yaml -w
At vero eos et accusam et justo duo dolores et ea rebum.
Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
  amet.
$E$ is a quantity ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
  aliquip ex ea commodo consequat.

the subordinate clause sed do eiusmod ... should be indented.

Indent display equation within a sentence

Equations are part of sentences. For example, see this screenshot from Feller on Probability Theory:

screen shot 2018-08-27 at 15 19 23

This is true for all books, articles, ... which use equations.

The tex source code could look like

Thus
  \begin{equation*}
    P\{A_1 \cup A_2\} = \frac{1}{2}+\frac{1}{2}-\frac{1}{4}=\frac{3}{4}.
  \end{equation*}

The probability $P\{A_1 \cup A_2\cup \cdots A_n\}$ of the realization of at
  least one among $n$ events can be computed by a formula analogous to (7.4),
  derived in IV,1.
Here we note only that the argument leading to (7.3) applies to any number of
  terms.
Thus \emph{for arbitrary events $A_1, A_2, \ldots$ the inequality}
  \begin{equation}
    P\{A_1 \cup A_2\cup \cdots \} \leq P\{A_1}+P\{A_2}+\ldots
  \end{equation}
  holds.
In the special case where the events $A_1, A_2, \ldots$ are mutually

Current Behavior

Thus
\begin{equation*}
   P\{A_1 \cup A_2\} = \frac{1}{2}+\frac{1}{2}-\frac{1}{4}=\frac{3}{4}.
\end{equation*}

The probability $P\{A_1 \cup A_2\cup \cdots A_n\}$ of the realization of at
   least one among $n$  events can be computed by a formula analogous to (7.4),
   derived in IV,1.
Here we note only that the argument leading to (7.3) applies to any number of
   terms.
Thus \emph{for arbitrary events $A_1, A_2, \ldots$ the inequality}
\begin{equation}
   P\{A_1 \cup A_2\cup \cdots \} \leq P\{A_1}+P\{A_2}+\ldots
\end{equation}
holds.
In the special case where the events $A_1, A_2, \ldots$ are mutually

Any chance, vim-bucky could also handle these?
I guess the more difficult one is when the period is within the math environment.

First impression and handling of comment character

Thanks for you plugin!

I have tried to use latexindent.pl to format latex text paragraphs. My try can be found here:
lervag/vimtex#544 (comment)

I share your opinion about the speed of latexindent (written in perl). I am surprised that vimscript can compete.

I did the minimal check whether vim-bucky works for http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/. Unsurprisingly, it works.

Documentation
Maybe, you could mention that by default the textwidth is 78 (hardcoded). But of course this can be changed with the usual vim setting 'textwidth' with its abbreviation 'tw'.

% Character used to split long expression over two lines avoiding additional horizontal space

I have following situation where I have inserted a % to split the long expression xxxxxxxxx} \cite{XxxxxXxXx:xxxx} so that the sentence is a little bit more nicely formatted.

Your plugin, however, treats this as a sentence ending:

Xx xxxxxxxx, xxx xxxxxxxx xxxxxxxxxx, xxxxxxxxxx xxxxxxxxxxx xxxxxxxx xx x
  xxxxxxxx xx xxxx xx xxxxxxx \enquote{xxxxxx xxxx xxxxxxxxx}%
\cite{XxxxxXxXx:xxxx}.
Xxxx x xxxxxxxx xx xxxxxx \emph{xxxxxxx} \cite{XxxxxXxXx:xxxx} xxx xx xxxxxxxx
  xxxxxxxxxxxxx xx x xxxxxxxx \emp{Xxxxxxx'x xxxxx}.

To be fair, latexindent cannot handle this either.

I am not sure if this is impossible or if there are situations which would actually expect that the sentence would end here.

backspace can not work when try to deleter an eol

When the cursor in the first column and try to deleter an eol, the backspace can not work beacuse vim-bucky always insert an eol . I have to use the following function to solve this error:

augroup backspaceMap "{{{
	autocmd!
	autocmd Filetype markdown,tex inoremap <buffer> <BS> <C-o>:call BS()<CR>
				\| inoremap <buffer> <C-h> <C-o>:call BS()<CR>
augroup END "}}}
function! BS() "{{{
	if col('.') == 1
		execute('normal! 2dh')
	else
		execute('normal! dh')
	endif
endfunction "}}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.