GithubHelp home page GithubHelp logo

preciouschicken / vim-groff-viewer Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 51 KB

A vim plugin for displaying Groff files in a document viewer.

Home Page: https://preciouschicken.com/software/vim-groff-viewer/

License: Apache License 2.0

Vim Script 100.00%
groff vim plugin

vim-groff-viewer's People

Contributors

preciouschicken avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

markusbkk

vim-groff-viewer's Issues

Path containing spaces generates empty file

Describe the issue

If the path has a space in the directory (and possibly the file name?) a blank file is generated and the viewer fails.

To reproduce

Create a groff document within a directory containing a space, e.g.

/home/gene/Dropbox/test bed/complaint.me

and run vim-groff-viewer open file command.

Expected behaviour

vim-groff-viewer should create postscript file, not a blank file, regardless of spaces.

Screenshots

N/A

Configuration

Manjaro Linux 21.3.7
GNU groff version 1.22.4
NVIM v0.7.2

Additional context

N/A

Use grog when no user options provided

Would grog work better in the SaveTempPS() function than groff if no options are provided by user? Currently the plugin guesses the macro from the file extension, any other options have to be added by the user.

Print option hardcoded to me macro

Describe the issue

Print option is wrongly hardcoded to me macro.

To reproduce

Print using a macro other than me.

Expected behaviour

Should print all macros.

Screenshots

N/A

Configuration

Manjaro Linux 21.3.7
GNU groff version 1.22.4
NVIM v0.7.2

Additional context

N/A

Split buffer causes undefined variable error

Describe the issue

Using the :sb command to split a buffer between a groff (e.g. .me) and non-groff (e.g. .txt) file causes an error message on write:

Error detected while processing function <SNR>58_SaveTempPS:
line    4:
E121: Undefined variable: b:tempName

Non-groff file does write correctly however.

To reproduce

Split buffer on groff and non-groff file and :w non-groff file.

Expected behaviour

No error message.

Screenshots

N/A

Configuration

Manjaro Linux 21.3.7
GNU groff version 1.22.4
NVIM v0.7.2

Additional context

N/A

Replace leader with localleader

Replace <leader> with <localeader> because:

It's even more important when you're writing a plugin for other people to use. The convention of using for local mappings will prevent your plugin from overwriting someone else's mapping that they've painstakingly burned into their fingers over time.

See example of FileType Events from Learn Vimscript the Hard Way.

Key mappings enabled with open buffers other than nroff filetype

Describe the issue

The key mappings (e.g. <localleader>o to open viewer) are enabled in buffers which have a filetype other than nroff when you also have a nroff buffer loaded.

To Reproduce

  1. Open (for example) nvim complaint.me hw.ms index.html
  2. Change neovim buffer to index.html: :b index
  3. In normal mode enter <localleader>o
  4. Status message relayed informing you that viewer opening (though doesn't).

Expected behaviour
Mapping should not work in open buffers other than filetype=nroff

Desktop (please complete the following information):

  • OS: Manjaro Linux 23.1.3
  • NVIM 0.9.5

Improve accuracy of wordcount

Describe the issue

Wordcount functionality (<localleader>wc) overcounts words (slightly).

Expected behaviour

Accurate wordcount.

Desktop (please complete the following information):

  • OS: Manjaro Linux 23.1.3
  • NVIM 0.9.5

Additional context

Rather than counting words for lines beginning with 't' instead count word spaces ('wh'?) and then plus one for ultimate word? Former method occasionally splits words. Read man 5 groff_out again. Emulate as far as possible how GNU wc functions.

Include word count feature

New remap to print out word count using a command similar to:

groff -me complaint.me | ps2ascii | wc -w

Wordcount freezes nvim on sample_docs.mom

Describe the issue
When calling \wc function on the sample_docs.mom document neovim freezes.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to https://fossies.org/linux/misc/groff-1.22.4.tar.gz/groff-1.22.4/contrib/mom/examples/sample_docs.mom
  2. Copy text into a file named sample_docs.mom
  3. Run \wc

Expected behavior
Produces wordcount.

Screenshots
Nil

Desktop (please complete the following information):

  • Neovim v0.8.0

Additional context
Is this a mom only issue? Or possibly caused by length of file?

Filetype plugin disabled on Neovim

Describe the issue
Filetype plugin not recognised on Neovim (v0.9.1), i.e. none of the mappings work. Continues to work on vim.

To Reproduce

  1. Open groff file using neovim
  2. Enter <leader>o

Neovim will enter insert mode and not open viewer - as if plugin was not there.

Expected behavior
Viewer to open.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Manjaro 23.0.0
  • Neovim v0.9.1

Additional context
This is almost certainly an issue with the disabling option code:

if exists("b:did_ftplugin")
	finish
endif
let b:did_ftplugin = 1

If the variable name is changed then it will work in both vim and neovim. Does neovim think a plugin for this filetype has already been activated (i.e. b:did_ftplugin= 1) and therefore this plugin is disabled? However running echo b:did_ftplugin gives a value of 1 on both vim and neovim when running with --clean flag - why therefore is vim not disabling this plugin and neovim is? Fix is to change the variable name, which does not seem to have any negative consequences, but unsure why neovim is now behaving this way. May submit an issue with neovim - but need to determine exactly what problem is first.

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.