Git Product home page Git Product logo

vintageex's Introduction

VintageEx

A rendition of Vim's command-line mode for Sublime Text 2.

License

This whole package is distributed under the MIT license (see LICENSE.txt).

Compatibility

VintageEx aims at full cross-platform compatibility. Howerver, I cannot test under OS X, so patches and feedback are welcome.

Installation

Download the latest version, put it under Installed Packages and restart Sublime Text.

VintageEx doesn't replace Vintage: To use vi key bindings, you need to enable the Vintage package (shipped with Sublime Text and ignored by default).

VintageEx extends the vi-like functionality provided py Vintage by adding a command-line mode that tries to remain close to Vim's.

Also, because VintageEx uses commands in the Vintage package, this package must be under your Packages folder with that name. This is mostly important to keep in mind if you contribute code to Vintage and have deleted the original package.

Overview

To open the command line, press :.

VintageEx offers tab completion of top-level commands, so you can type a letter and press Tab to cycle through available commands.

To see the implemented commands, you can look through ex_commands.py.

Configuration

These settings should be stored in your personal preferences (Packages/User/Preferences.sublime-settings).

vintageex_linux_shell

The name of the shell through which commands should be executed (bash, ksh, etc.). If empty, the $SHELL variable will be read when a shell is needed.

vintageex_linux_terminal

The name of the preferred terminal emulator (gnome-terminal, xterm, etc.). If empty, the variables $COLORTERM and $TERM will be read in turn when a terminal is needed.

Donations

If you want to show your appreciation, you can tip me through Gittip: guillermooo.

vintageex's People

Contributors

danghvu avatar ghedamat avatar guillermooo avatar ignacysokolowski avatar sehe avatar weslly 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vintageex's Issues

REPLACE MODE

I am wondering if there is REPLACE MODE functionality within VintageEx. I would like to use my INSERT key as a toggle between the two modes.

Currently, I am using the following keymapping setting to use INSERT to enable INSERT MODE:

{ "keys": ["insert"], "command": "enter_insert_mode",
  "context":
  [
        {"key": "setting.command_mode"},
        {"key": "selection_empty"}
  ]
},

I imagine the mode I am looking for would require the following additions:

{ "keys": ["insert"], "command": "enter_insert_mode",
  "context":
  [
        {"key": "setting.replace_mode"},
        {"key": "selection_empty"}
  ]
},
{ "keys": ["insert"], "command": "enter_replace_mode",
  "context":
  [
        {"key": "setting.insert_mode"},
        {"key": "selection_empty"}
  ]
},

My question is: Does this functionality exist, and if so, how can I utilize it? and If not, are there any plans to bring this functionality to VintageEx?

Advanced search

Thanks for this plugin! Small bug/feature-request:

returns "No Range Allowed" error if /joe/s-2 is attempted (or any advanced search).

Seems to have all the advanced search and replace features, but not advance search, such as many of the search examples found in:

http://www.rayninfo.co.uk/vimtips.html

Regex escape characters missing in substitute

Regexes in substitute don't seem to act in the same way as either search and replace in sublime text or substitute in vim itself. Specifically:

.s/(.*)/\u\1/

ought to capitalise the first character of the line. Other missing commands are \U, \l, \L and so on.

http://boost.sourceforge.net/libs/regex/doc/format_perl_syntax.html

This is the link for the escape characters etc. in the sublime text 2 regex engine, many of which seem not to be present in vintageex substitute.

Wall, buffers, registers, files.... commands dont work

Some of the commands don't do anything: wall, buffers (ls works), files, registers, x.

Console output:

ex_command(name=u'files', command='ex_prompt_select_open_file', forced=False, args={}, parse_errors=[], line_range={'right_ref': None, 'left_offset': None, 'text_range': u'', 'right_offset': None, 'left_ref': None, 'left_search_offsets': [], 'separator': None, 'right_search_offsets': []}, can_have_range=True)
Traceback (most recent call last):
File ".\sublime_plugin.py", line 356, in run_
TypeError: run() got an unexpected keyword argument 'line_range'

All command have the same output (last 2 lines). Window 7 64x, Dev channel build 2220

use :q to close current buffer and not the editor

I just want to notify you that in
ghedamat/VintageEx@4e5e31b

I've changed the behavior of :q command to close the current buffer and not sublime_text itself
to make it similar to what happens if you use vim with nerdtree or with vimtabs

Don't know if it can be interesting to you to implement :q in this way

Anyway many thanks for this great plugin, now I can enjoy sublime_text even more :)

Ranges not working for yank

If I type :1,10d it deletes lines 1 through 10.

If I type :1,10y it gives an error of "VintageEx: E492 Not an editor command. (:1,10y)

This is on OSX.

:sh not working

when using Vintage and VintageEx (beutiful, mind blowing editing experience), one thing is not working; :sh to execute shell, i get an error saying :

VintageEx: Error while executing command through shell

I've took a look at the relevant code, the error must arise from either:

p = subprocess.Popen([the_shell, '-c', name],
stdout=subprocess.PIPE)

or

try:
self.open_shell([term, '-e', 'bash']).wait()
except Exception as e:
print e
sublime.status_message("VintageEx: Error while executing command through shell.")
return

I'm pretty sure i have bash installed

This is ubuntu 12.10 x86_64, sublime 2.0.1 build 2217

Problem installing/running VintageEx

I run latest Sublime 2181 on OSX 10.7.3. I installed it by copying VintageEx.sublime-package into "Installed Packages". When I run Sublime the Ex commands are not working. I tried simply :q and nothing. Inspection of the Console does reveal some errors while loading VintageEx.

=== console output ===

startup, version: 2181 osx x64 channel: stable
executable: /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
working dir: /
packages path: /Users/miki/Library/Application Support/Sublime Text 2/Packages
settings path: /Users/miki/Library/Application Support/Sublime Text 2/Settings
error parsing session: No data at: 0:0
PackageSetup not required
catalogue loaded
found 7 files for base name Default.sublime-keymap
found 1 files for base name Default.sublime-mousemap
found 1 files for base name Main.sublime-menu
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/comment.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/copy_path.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/delete_word.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/detect_indentation.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/duplicate_line.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/echo.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/exec.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/fold.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/font.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/goto_line.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/indentation.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/kill_ring.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/mark.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/new_templates.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/open_file_settings.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/paragraph.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/save_on_focus_lost.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/scroll.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/set_unsaved_view_name.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/side_bar.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/sort.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/swap_line.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/switch_file.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/transform.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/transpose.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Default/trim_trailing_white_space.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Diff/diff.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/HTML/encode_html_entities.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/HTML/html_completions.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Vintage/vintage.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Vintage/vintage_commands.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/Vintage/vintage_motions.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/VintageEx/ex_command_parser.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/VintageEx/ex_commands.py
Traceback (most recent call last):
File "./sublime_plugin.py", line 62, in reload_plugin
File "./ex_commands.py", line 18, in
import shell
File "./shell.py", line 1, in
import plat
ImportError: No module named plat
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/VintageEx/ex_error.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/VintageEx/ex_location.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/VintageEx/ex_range.py
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/VintageEx/shell.py
Traceback (most recent call last):
File "./sublime_plugin.py", line 62, in reload_plugin
File "./shell.py", line 1, in
import plat
ImportError: No module named plat
Reloading plugin /Users/miki/Library/Application Support/Sublime Text 2/Packages/VintageEx/vintage_ex.py
plugin init time: 0.13851
loading bindings
loading pointer bindings
found 1 files for base name Default.sublime-theme
theme loaded
app ready
pre session restore time: 0.299545
using gamma: 2 (err: 6.9282)
startup cache, total files: 92 cache hits: 92
startup time: 0.428839 (package setup was not run)
loaded 934 snippets
ex_command(name=u'q', command='ex_quit', forced=False, range=None, args={}, parse_errors=[])
ex_command(name=u'q', command='ex_quit', forced=False, range=None, args={}, parse_errors=[])
ex_command(name=u'q', command='ex_quit', forced=False, range=None, args={}, parse_errors=[])

substitute command replaces non-selected lines

Thanks for this great plugin. The lack of the :s/ command was keeping me from using Sublime full-time.

Also, FYI: I'm using Sublime 2 build #2161 on Ubuntu 10.04 64-bit. My VintageEx version is 11.10.3 according to PKG-INFO

Sorry I don't have the expertise to patch this myself ..

Say you have this code:

foo.bar = foo.baz;
bar.foo = baz;

Let's say I need to rename the foo variable on the first line.

If I enter visual-line-mode (shift+v), then :s/foo/whatever/g, the output is:

whatever.bar = whatever.baz;
bar.whatever = baz;

The expected output is:

whatever.bar = whatever.baz;
bar.foo = baz;

The bug only "bleeds over" 1 extra line. Also, the bug does not happen in regular visual mode.

Please let me know if I can help further.

Thanks again,
-- Matt

executing shell commands fails on linux with SubLime Text 2 Build 2181

tried: :!ls

error message:
Package Control: No updated packages
ex_command(name=u'!', command='ex_shell_out', forced=False, range=None, args={'shell_cmd': u'ls'}, parse_errors=[])
Traceback (most recent call last):
File "./sublime_plugin.py", line 344, in run_
File "./ex_commands.py", line 134, in run
File "./shell.py", line 10, in run_and_wait
File "./plat/linux.py", line 9, in run_and_wait
File ".\subprocess.py", line 633, in init
File ".\subprocess.py", line 1139, in _execute_child
OSError: [Errno 2] No such file or directory

SublimeText 3 support

Hi,

I have a fork which works in ST3 here - the downside is it breaks in ST2.

The changes are:

  • automated 2to3 Python stdlib changes - not sure these can be made backwards compatible,
  • changes to imports to make them relative - not sure these can be made backwards compatible,
  • one SublimeText API change (add_regions) which (I believe) is backwards compatible as it changes a positional to a named keyword.

I don't know if this is helpful to the project. Obviously it can't be merged as is because it breaks ST2 compatibility.

I know there are efforts underway to rewrite Vintage and VintageEx to ST3, but I'm not sure how far along they are, or what the transition process will be. Can anyone address this?

Search via / is not realtime anymore?

Before this change: 5094ff3

Typing /foobar would make the search realtime. Now, I have to press enter. Is there a way to revert this to the previous behaviour?

Second, doing /foobar. In the past, is non case sensitive. Now, it's case sensitive...

Vintage's "*" and "#" are not repeatable anymore

VintageEx breaks Vintage * and # (search under the cursor) commands, so you cant repeat them with "n" or "N" (it probably breaks "n" commands, because search works). You have to repeat them in order to find next occurrences.

I have tried with VintageEx disabled and they work as they should

Make search with '/' act like in vim, e.g. as movement command

One of really fast ways to move in vim is to use '/'. At the moment it is practically difficult in VintageEx. Suggestion:

  1. '/' search shouldn't interfere with selection, it should act as a movement command
    • if in normal mode then just move - without selecting anything (see vim)
    • if in visual mode then extend selection
  2. Act as movement command and be combinable with other commands, e.g.

There is a fox in the forest.
^
d/for leads to
forest.

Command Mode

I have been exclusively using VIM for quite some time, but I've decided to to see what st2 is all about. In Vim, I have mapped the spacebar to entering the command line from command mode. Is this possible with VintageEx? I can't for the life of me figure out what commands I should be mapping to with the keybindings.

Error at startup

When Sublime text starts, there is an error in console:

Reloading plugin C:\Users\Peter\AppData\Roaming\Sublime Text 2\Packages\VintageEx\setup.py
Traceback (most recent call last):
File ".\sublime_plugin.py", line 62, in reload_plugin
File ".\setup.py", line 11, in
from distutils import log, dir_util, dep_util, file_util, archive_util
ImportError: No module named distutils

The plugin still works, but maybe this error is connected with some other bugs

Window management commands

I know almost nothing about Python OR the internals of SublimeText otherwise I'd do this as a pull request but I'd love to see window management commands such as :vs and :sp added. The basic windowing approach seems somewhat different from vim so this may not be able to work exactly as vim does but being able to open a new file in a vertical or horizontal split window would be fantastic.

Command/Search Bar should be closed after hitting enter

After running a search (via / or ?), or issuing a command (:s), the bar should be closed. Not closing the bar prevents you from immediately pressing 'n' or 'N' to re-run the last search. Generally it prevents you from doing anything without first hitting 'Esc', which can be frustrating when coming from a vim background (or going to vim in the future).

Search + Visual

Is it possible that with the Search functionality you added to VintageEx add some way to "highlight to match"?

On Vim you can enter visual mode and use search to highlight till the given match.

":" not working in CSS syntax

After Set Syntax: CSS, ":" key inserts ":" instead of going into Command-line mode when cursor is next to the closing "}" brackets.

e.g.

Before:
.classA {
width:10px;
height:10px;
}
^-- Cursor on "}", hit ":" key under Command mode

After:
.classA {
width:10px;
height:10px;
:}
^--- inserted a ":" instead of going into Command-line mode.

Environment:
OSX Lion
Sublime Text v2.0.1 Build 2217
BracketHighlighter (possibly related?)

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.