Code Monkey home page Code Monkey logo

vibreoffice's Introduction

vibreoffice

(Unfortunately, vibreoffice is still in an experimental stage, and I no longer have much time to work on it. Hope you enjoy it anyway!)

vibreoffice is an extension for Libreoffice and OpenOffice that brings some of your favorite key bindings from vi/vim to your favorite office suite. It is obviously not meant to be feature-complete, but hopefully will be useful to both vi/vim neophytes and experts alike.

Installation/Usage

The easiest way to install is to download the latest extension file and open it with LibreOffice/OpenOffice.

To enable/disable vibreoffice, simply select Tools -> Add-Ons -> vibreoffice.

If you really want to, you can build the .oxt file yourself by running

# replace 0.0.0 with your desired version number
VIBREOFFICE_VERSION="0.0.0" make extension

This will simply build the extension file from the template files in extension/template. These template files were auto-generated using Extension Compiler.

Features

vibreoffice currently supports:

  • Insert (i, I, a, A, o, O), Visual (v), Normal modes
  • Movement keys: hjkl, w, W, b, B, e, $, ^, {}, (), C-d, C-u
    • Search movement: f, F, t, T
  • Number modifiers: e.g. 5w, 4fa
  • Replace: r
  • Deletion: x, d, c, s, D, C, S, dd, cc
    • Plus movement and number modifiers: e.g. 5dw, c3j, 2dfe
    • Delete a/inner block: e.g. di(, da{, ci[, ci", ca', dit
  • Undo/redo: u, C-r
  • Copy/paste: y, p, P (using system clipboard, not vim-like registers)

Known differences/issues

If you are familiar with vi/vim, then vibreoffice should give very few surprises. However, there are some differences, primarily due to word processor-text editor differences or limitations of the LibreOffice API and/or my patience.

  • Currently, I am using LibreOffice's built-in word/sentence movement which differs from vi's. It's sort of broken now but I plan to fix it eventually.
  • The concept of lines in a text editor is not quite analogous to that of a word processor. I made my best effort to incorporate the line analogy while keeping the spirit of word processing.
    • Unlike vi/vim, movement keys will wrap to the next line
    • Due to line wrapping, you may find your cursor move up/down a line for commands that would otherwise leave you in the same position (such as dd)
  • vibreoffice does not have contextual awareness. What I mean by that is that it does not keep track of which parentheses/braces match. Hence, you may have unexpected behavior (using commands such as di() if your document has syntatically uneven parentheses/braces or nesting of such symbols. I don't intend to fix this for now, as I don't believe this is a critical feature for word processing.
  • Using d, c (or any of their variants) will temporarily bring you into Visual mode. This is intentional and should not have any noticeable effects.

vibreoffice is new, so it is bound to have plenty of bugs. Please let me know if you run into anything!

License

vibreoffice is released under the MIT License.

vibreoffice's People

Contributors

seanyeh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vibreoffice's Issues

Enable pattern matching

Not as useful in a document as opposed to writing code, but there are still circumstances where it'd be nice to switch between matching parenthesis.

Esc with jk

Thanks a lot for this amazing plugin (I've been waiting that for a long time).

Is it possible to map jk on Esc (very popular mapping in vimrc) ?

"p" not working

I've installed the plugin for libreoffice 4.4 (in french langage). Unfortunately, p (for past) doesn't work. If I copy a line using yy or dd, and I press p after, nothing happens.

request: easyclip style operations for delete vs move

vim-easyclip is so great, I don't want to use Vim without it, but now I can't stand other vi implementations.

Regardless of clipboard history etc. (can be handled by system-level tools), the primary key issue is that I really really really want to be able to us the d related delete operations as the normal delete functions in LibreOffice, i.e. do not copy the deleted stuff to the clipboard! and have m functions (for "move") work the same as the d functions normally do in Vi.

This will be the difference to whether I feel comfortable using vibreoffice. It should be pretty easy to do. It's just duplicating the d-related functions, swapping the letter m, and then do delete instead of cut for all the d stuff.

Thanks, excited about this project

Cursor display issues when clicking document

From Normal mode, when clicking on text anywhere in the document with the mouse, the cursor switches to it's Insert mode appearance (a single line) instead of it's Normal mode appearance (single character selected) despite Normal mode still being in effect.

Personally I would prefer that it switch to insert mode, or better yet allow the user to set this behavior in a config file somewhere, but regardless the cursor appearance should stay consistent.

e not behaving as expected

When I press e in vim, it behaves the same as w but puts me at the end of successive words. e is only jumping me to the end of the word I'm on, then it doesn't work anymore.

Some missing keys

Vibreoffice is a great idea however there are a couple of things that I find missing that can hopefully get added at some stage.

Probably easy to implement:

  • gg to get to the start of the document and G to get to the end
  • 0 as an alternative to ^ to go to the start of the line
  • ~ to toggle the case of the letter under the cursor

Probably harder to implement:

  • V for visual line mode
  • / to jump to the next match of a word. This is the main way I get around in vim

As an aside that is not worth creating a separate issue for: it would be nice for the README to state that you have to enable vibreoffice in Tools→Add-Ons, as I didn't work that out straight away. (After reading the README again, it looks like this was in there)

Broken on LibreOffice 6.04

I've been trying to run this on lb but i couldn't.
i don't know how it works but if someone can fix this please help us. :c

"0" should go to the start of the line

This might be trickier than some of the other issues due to the way Libreoffice handles Line endings, but hopefully there's a way since "$" works fine.

Support for Calc?

Most of my daily work in LibreOffice uses spreadsheets/Calc, not documents/Writer. My initial glance at loading vibreoffice was in Calc, and at least hjkl just typed the letters into whatever cell had input focus, rather than moving the input focus to another cell. It also doesn't look like it's in the Add-Ons section for Calc like it is in Writer.

If I get some free time I'll see if I can make a patch.

Is it possible to rebind commands? (Colemak/Dvorak/etc. support)

I am a Colemak touch typist (http://colemak.com/ There are dozens of us! DOZENS!), and I have gotten used to lightly modified keybinds. It would be nice to be able to rebind some of the keys in Vibreoffice, and use my non-standard muscle memory more fluidly.

Is this already possible? A config file, such as ~/.vibreofficerc would be great!

If it's not possible yet, there's no rush, and if this functionality is low priority or undesired, I would understand.

Here's an excerpt from my .vimrc to demonstrate what I mean (it looks much more complicated than it is in practice):

"""""""""""""""""
" Colemak-Vim Mappings
"
" Vi's traditional Qwerty-centric H J K L "arrow" keybinds are swapped for the Colemak
" homerow equivalent H N E I. As little else as possible is changed. As such, J K L are
" free to use and N E I need new keys.
"
" Therefore, we shall assign:
"
" - k/K as the new n/N.
" - s/S as the new i/I ["inSert"].
" - j/J as the new e/E ["Jump" to end of word].
" - l/L to skip to the beginning and end of lines. More intuitive than ^ and $.
" - Ctrl-l to join lines, making l/L the veritable "Line" key.
" - r to replace i as the "inneR" modifier [e.g. "diw" becomes "drw"].
"""""""""""""""""
" HNEI arrows. Swap 'gn'/'ge' and 'n'/'e'.
noremap n gj|noremap e gk|noremap i l|noremap gn j|noremap ge k
" In(s)ert. (The default s/S is synonymous with cl/cc and is not very useful.)
noremap s i|noremap S I
" Last search.
noremap k n|noremap K N
" Beginning of line / End of line / Join Lines.
noremap l ^|noremap L $|noremap J
" r = inneR text objects.
onoremap r i
" 'Jump' to end of word
noremap j e|noremap J E

Is working vibreoffice on linux ?

Hello,

I have libreoffice from Debian Sid, and I installed your extension. But I'm not sure how get it working.

How do you flip from insert mode to normal mode ? In my installation no key has changed its behaviour

Thank you developping such extension !

Dw deletes trailing punctuation

Typing dw from the start of "word," also deletes the comma/whatever punctuation you have there. In vim it doesn't, that's more like dW behaviour.

Ctrl-A not working

Occasionally I have to change the font size or something for the document as a whole, and I'm in the habit of just pressing Ctrl-A to select everything. With Vibreoffice enabled, Pressing Ctrl-A simply moves the cursor to the top of the document after what I can only describe as a strange flicker onscreen. This might just be an unavoidable conflict, but I don't think Ctrl-A does anything in Vim. (That I can think of at least.)

} doesn't really go to paragraph breaks

From my brief half hour testing I noticed that } seems to exhibit the exact same behavior as ). If I have several sentences with a single line break between each (but no blank line), pressing } just takes me to the next sentence, not to the line break at the end of this chunk of text. I have a hunch that this is an issue with the underlying Libreoffice API (perhaps it should look for two line breaks instead of 1?) but it would be helpful if a workaround could be found.

Annotation insertion error.

While trying to insert an Annotation, it returns the following error:

BASIC runtime error!
Type: com.sun.star.uno.RuntimeException
Message: no text selection.

This is the excert of the code where it seems to crash.

' -----------
' Singletons
' -----------
Function getCursor
    getCursor = VIEW_CURSOR
End Function

Function getTextCursor
    dim oTextCursor
    oTextCursor = getCursor().getText.createTextCursorByRange(getCursor())
    ' oTextCursor.gotoRange(oTextCursor.getStart(), False)

    getTextCursor = oTextCursor
End Function

allow ctrl+[ to act as excape

First off, thank you for this! LibreOffice is awesome, and this extension turns it into an amazing word processor!

In vim, I typically use ctrl+[ to exit insert mode. It's easier on my pinkies. Any chance of getting it added as an escape sequence?

Esc not working

I downloaded .ext on Windows 8.1. Shows active under Tools. Esc doesn't seem to work. How to get out of input mode and into movement mode?
Thank you. This is a dream come true when I get it working.

Feature Request: p and P / would love to be able to use vim keys for yank paste etc...

Would really like to be able to kill some lines (can't remember the correct terminology, I've used so much Emacs and vim that kill, pull, yank, etc are blurred... I think it's yank then put right?) I'd love to be able to D or dd a line and then move and p a line back in.

OT: I love the plug in though. While I prefer to write in LaTeX when I can, there's just some times that I have to use a WYSIWG for my job. I bounce around between Libre, Pages, and Word depending on the application. But, your plugin is going to have me permanently switching to Libre for just about everything.

Now to find time to learn how this program is coded to send you a few pulls.

Keybinding: J for join lines

Thank you for your time and effort, just wanted to document a missing normal mode binding for J, which joins the current and next line in vim.

A few things

Hello Sean,

The e command doesn't work. Would compiling it myself be a possible work around (LO 5.2)?

This little tool is awesome. Thank you so much! I don't like WSIWYG text processors, but occasionally reviewing someone else's stuff is necessary. It is great to still feel at home.

It is too bad you aren't tinkering with this more. I am considering picking this up. Any tips?

Thanks again,
Brian

Contributing Docs / Tutorials / Other Resources

This isn't so much an issue with vibreoffice as it is with Libreoffice's lack of documentation (that I can find at least), so I was wondering what resources you used @seanyeh to get familiar with Libreoffice's API. I'm interested in contributing if I can, since a vim plugin for libreoffice is an idea I had a while back but never figured out where to start. What would you recommend as far as getting familiar with how vibreoffice actually interacts with Libreoffice?

Also, (and this is a terribly newbish question, I'm sorry) is this written in Visual Basic or Visual Basic Script, or is there a difference? GitHub is telling me that it's Visual Basic, but a quick google search on the .vbs extension tells me it's VBScript. Are those the same thing? Pardon the newbishness.

w movement doesn't advance if there is no space.

There is a slight difference between vim movement and the plugin right now,

i aoeu <esc> b w

On Vim, the w movement would advance to the 'u' (as if e movement was used), but Vibreoffice doesn't move at all.

:<commands> not enabled

It would be really handy if the usual :wq, :q!, /searchItem, etc. commands could be used in addition to standard keybindings. Not a bug so much as a feature request, but this would definitely be something to implement.

repeat commands with .

Hey thanks for putting this together it's great to get vim commands in libreoffice.

This is a feature request to add vims "." repeat last action command, its just the key I use the most often in vim and can't stop doing it instinctively now...

Using "find" or "till" doesn't detect fancy quotes.

This isn't a bug, but a feature request. A lot of people use the fancy left and right single and double quotes in LibreOffice, but this means that using f, F, t, or T on ' or " will not jump to those characters.

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.