Giter Site home page Giter Site logo

autocomplete-all-the-things's Introduction

Name

autocomplete-ALL-the-things - an urxvt plugin allowing user to easily complete arbitrary text

Installation

Copy the autocomplete-ALL-the-things file to the urxvt perl-lib directory (default: ~/.urxvt/ext/).

Add the following lines to your ~/.Xresources (or ~/.Xdefaults):

URxvt.perl-ext-common:    ...,autocomplete-ALL-the-things
URxvt.keysym.M-C-slash:   perl:aAtt:word-complete
URxvt.keysym.M-question:  perl:aAtt:fuzzy-complete
URxvt.keysym.M-quotedbl:  perl:aAtt:undo

Description

Completes the currently typed word using the other words visible in the urxvt window.

For example the terminal looks like this:

Preview

It was strongly inspired by dabbrev feature in GNU Emacs and later by skeleton-complete by Bao Haojun.

Basic usage

Just press the key bound to aAtt:complete (in the example above: Alt-Ctrl-slash) to complete the word at point. Subsequent uses cycle through other possible completions.

It is not recommended to bind the completion actions to the alphanumeric keys. The symbol keys should be preferred. See the issue #13.

Key bound to aAtt:undo (Alt-Shift-quote) undoes the completion. Additionally, pressing Escape undoes the completion too regardless of this setting.

Advanced usage

For more advanced completions use aAtt:fuzzy-word-complete (Alt-Shift-slash) and aAtt:skeleton-complete. It's behavior is inspired by skeleton-complete, please see its readme for a more detailed explanation.

Available functions

  • aAtt:word-complete -- classical prefix-based completion for words
  • aAtt:WORD-complete -- completion for WORDS (in the Vim meaning)
  • aAtt:fuzzy-word-complete -- fuzzy completion for words
  • aAtt:fuzzy-WORD-complete -- fuzzy completion for WORDS
  • aAtt:fuzzy-complete -- fuzzy completion for arbitrary strings
  • aAtt:suffix-complete -- fuzzy completion for suffixes, disrespecting prefixes of both completion and given strings
  • aAtt:surround-complete -- fuzzy completion for surrounded by quotes or braces strings, excluding surrounding.
  • aAtt:undo -- undo the completion (must be used right after a completion)

Acknowledgments

Thanks to Stanislav Seletskiy for various contributions.

Thanks to Bao Haojun for the great idea of skeleton-complete.

Copyright

Copyright (C) 2012-2017 Wojciech Siewierski

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

autocomplete-all-the-things's People

Contributors

seletskiy avatar vifon 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

autocomplete-all-the-things's Issues

Not completing file paths with slashes

This is a fantastic project and really enjoying this script. Could you change the code though to deal with slashes though? Say the buffer contained the below:

/some/path/some/file.txt
../some/other/path/
and/another/one/../back/a/directory/file.txt
more text etc

Now, if I want to complete /some/path/some/file.txt, currently this is not supported; however I have changed the regex to support this, any chance this could be added? Below is a diff from the current master:

diff --git a/autocomplete-ALL-the-things b/autocomplete-ALL-the-things
index 2dedac2..2661732 100755
--- a/autocomplete-ALL-the-things
+++ b/autocomplete-ALL-the-things
@@ -59,10 +59,10 @@ sub on_user_command {
         if ($cmd eq 'word-complete') {
             # Basic word completion. Completes the current word
             # without any special matching.
-            $char_class_before      = '[^-\w]';
+            $char_class_before      = '[^-\w/]';
             $matcher                = sub { quotemeta shift }; # identity
-            $char_class_at_end      = '[-\w]';
-            $char_class_to_complete = '[-\w]';
+            $char_class_at_end      = '[-\w./]';
+            $char_class_to_complete = '[-\w/.]';
         } elsif ($cmd eq 'WORD-complete') {
             # The same as above but in the Vim meaning of a "WORD" --
             # whitespace delimited.

Only map aAtt:undo when in completion mode

I'd like to map perl:aAtt:undo to Esc but obviously if I do URxvt.keysym.Escape: perl:aAtt:undo, I will not be able to use Esc anymore for anything else.

Do you think there is a way to do this? I fear not.

Unable to map `undo` to `C-S-BackSpace`

The following does not work:

URxvt.keysym.C-S-BackSpace: perl:aAtt:undo

I suppose it is because undo will emulate a backspace press, but with the Ctrl+Shift still pressed, it doesn't register.

2nd call to WORD-completion eats command line

Here's a reproducible example on my machine:

#Step1 
$cat temp.txt
comple1
compl2
noitelpomc34
#Step 2
$echo comp<C-M-/><Enter>
compl2
#Step 3
$echo noi<C-M-/>
# after calling WORD-complete the command line looks like this :
$echcomple1

What is a word?

So, I'm a bit confused by this new completion. Dash (-) is no longer part of a word? So i cannot complete normal-things-like-this? (talking about normal complete). This is because you use \b ? I last year's aAtt, words at least included the dash.

Disappearing highlights

Sometimes the match highlights are disappearing just after they appear. I've been able to reproduce it on the same text over and over again but it was at my workplace so I can't diagnose it properly. I've not encountered it at home.

If someone has any idea what could be the cause or any hint, please give me a hand.

Only completes words from above

Only words from above the current position appear to be completed.

This can be seen when using tmux, where words from the panes below are not being considered for completion.

Previews in overlay

Right now, when the user is cycling through the possible completions, each one is pasted into the terminal after backspace-ing the previous one. It's not very elegant solution. I consider replacing (probably as an option) this approach with an overlay overshadowing the actual text and pasting the text only once.

Not getting any completions.

The error from urxvt is:

urxvt: Can't use an undefined value as an ARRAY reference at .../autocomplete-ALL-the-things line 162.

What is the font used in the demo gif?

Nobody so far was able to recognize this font. What is this weird travesty of a font that you use in the screencast? Xresources entries would be very welcome as well.

Thanks!

What is a WORD?

The README.md says

aAtt:WORD-complete -- completion for WORDS (in the Vim meaning)

Can we define for the non-Vim-user what a "WORD" is, as compared to a "word"?

Missing license

Without a license, it's implicitly copyrighted, which means I can't package it.

Please add a license if you want this plugin to be usable for others.

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.