Skip to content

An advanced Vim emulation layer for Sublime Text (Vintageous fork).

License

Notifications You must be signed in to change notification settings

simonmares/NeoVintageous

 
 

Repository files navigation

NeoVintageous Logo

An advanced Vim emulation layer for Sublime Text.

Build Status Build status Coverage Status Minimum Sublime Version Latest Stable Version GitHub stars Downloads

Neovintageous is project that seeks to continue the development of Vintageous as an open source project.

  • Open source
  • Highly configurable
  • Plugins out-of-the-box
  • Strong defaults
  • Drop-in replacement for Vintageous

OVERVIEW

INSTALLATION

Package Control installation

The preferred method of installation is Package Control.

Manual installation

  1. Close Sublime Text.
  2. Download or clone this repository to a directory named NeoVintageous in the Sublime Text Packages directory for your platform:
    • Linux: git clone https://github.com/NeoVintageous/NeoVintageous.git ~/.config/sublime-text-3/Packages/NeoVintageous
    • OS X: git clone https://github.com/NeoVintageous/NeoVintageous.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/NeoVintageous
    • Windows: git clone https://github.com/NeoVintageous/NeoVintageous.git %APPDATA%\Sublime/ Text/ 3/Packages/NeoVintageous
  3. Done!

DOCUMENTATION

A complete guide to vim usage can be found in the Vim documentation.

Command Context Description Notes
j Sidebar Move down e.g. ctrl+0 focuses the sidebar
k Sidebar Move up e.g. ctrl+0 focuses the sidebar
h Sidebar Close node / Go to parent node e.g. ctrl+0 focuses the sidebar
l Sidebar Open node e.g. ctrl+0 focuses the sidebar
ctrl+n or ctrl+j Overlay, Auto-complete Next / Move down e.g. ctrl+p and ctrl+shift+p invoke overlays
ctrl+p or ctrl+k Overlay, Auto-complete Previous / Move up e.g. ctrl+p and ctrl+shift+p invoke overlays

Some commands have dependencies. All dependencies are optional and can be installed via Package Control.

Command Description Documentation Dependencies Notes
[c Jump backwards to the previous start of a change. diff Git Gutter Disable wrapping: set git_gutter_next_prev_change_wrap to false (Preferences > Settings)
]c Jump forwards to the next start of a change. diff Git Gutter Disable wrapping: set git_gutter_next_prev_change_wrap to false (Preferences > Settings)
ctrl-w s Split current window in two windows Origami
ctrl-w v Split current window in two (vertically) windows Origami

Command Palette

Command Description
NeoVintageous: Open My .vintageousrc File Open the runtime configuration file for editing
NeoVintageous: Reload My .vintageousrc File Reload the runtime configuration file
NeoVintageous: Open Changelog Open the changelog in a view
NeoVintageous: Open Readme Open the readme in a view
Preferences: NeoVintageous Settings – Default Open the default settings
Preferences: NeoVintageous Settings – User Open the settings file for editing

Toggle command

Use the official ToggleNeoVintageous plugin which provides a command to toggle NeoVintageous.

The .vintageousrc file

A feature comparative to the .vimrc file.

The file is located at Packages/User/.vintageousrc and is read during startup. It can be opened for editing via the Command Palette: NeoVintageous: Open My .vintageousrc File. It can be reloaded too: NeoVintageous: Reload My .vintageousrc File.

There is limited support. The following are supported in basic use-cases: let mapleader=, noremap, nnoremap, onoremap, vnoremap, map, nmap, omap, and vmap.

It's important to note that currently map, nmap, omap, vmap work the same as their *remap variants, this is a known issue.

" The character " (the double quote mark) starts a comment

let mapleader=,

" Enter command line mode
nnoremap <space> :

" Visually select all content
nnoremap <leader>a ggvG

" " Sort with ,s in visual mode
" vnoremap <leader>s <F9>

" Scroll viewport faster with ctrl+e and ctrl+y
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>

" " Make j and k work file linewise instead of screen linewise.
" " http://stevelosh.com/blog/2010/09/coming-home-to-vim/
" " Important! There is a potential performance hit
" " navigating with j and k with these mappings enabled.
" nnoremap j gj
" nnoremap k gk

" " Scroll down using shift+enter
" noremap <S-cr> <C-d>

Read more about mappings and the .vimrc file in the Vim documentation.

Modeline

A feature comparative to Vim Modeline: a number of lines at the beginning and end of the file are checked for "modelines", the modelines are settings that will be applied to the view when it's opened.

# sublime: gutter false
# sublime: translate_tab_to_spaces true
# sublime: rulers [80, 120]
# sublime: tab_size 4

Read more about modeline in the Vim documentation.

Multiple cursors

There two ways to use multiple selections.

The first is to enter insert mode, i, then use ctrl+d to make multiple selections, press Esc to enter normal mode, from here you can use NeoVintageous normally e.g. $ will jump the cursors to the end of line, ^ all cursors to the start of line, v enters all cursors into visual mode, f{char} makes all cursors visually select to {char}, etc.

The second way is enter select mode, a non-standard mode that is used for multiple selections. This mode is not the same as select mode in Vim.

Key Sequence Command
gh Enter select mode (from normal or visual mode)
j Add selection
k Remove selection
l Skip current selection
A Select all instances
i Enter visual mode (preserving selections)
J Clear multiple selections and enter normal mode
gH After a search with / or ?, select all matches.

Once you've created visual selections in select mode, you must return to insert mode by pressing i in order to edit text. Once in insert mode, you can switch to normal mode, etc. If you press Esc while in select mode, you will return to normal mode, but multiple carets won't be destroyed. If you press Esc a second time, you will be left with one single caret in normal mode.

Plugins out-of-the-box

A number of plugins are provided out-of-the-box. Please open issues about other plugins you would like to see implemented and about plugins you're thinking of writing because we may be willing to add it out-of-the-box.

Command Description Documentation
gc{motion} Comment or uncomment lines that {motion} moves over. commentary.vim
gcc Comment or uncomment current line. commentary.vim
{Visual}gc Comment or uncomment the highlighted lines. commentary.vim
Command Description Documentation
ds Delete surroundings. surround.vim
cs Change surroundings. surround.vim
ys Yank surroundings. surround.vim
Command Description Documentation Dependency
[l Jump to [count] next error. unimpaired.vim SublimeLinter
]l Jump to [count] previous error.. unimpaired.vim SublimeLinter
[<Space> Add [count] blank lines before the cursor. unimpaired.vim
]<Space> Add [count] blank lines after the cursor. unimpaired.vim
[e Exchange the current line with [count] lines above it. unimpaired.vim
]e Exchange the current line with [count] lines below it. unimpaired.vim
On Off Toggle Option Documentation
[oc ]oc coc 'cursorline' unimpaired.vim
[ol ]ol col 'list' unimpaired.vim
[on ]on con 'number' unimpaired.vim
[os ]os cos 'spell' unimpaired.vim
[ow ]ow cow 'wrap' unimpaired.vim
Command Description Documentation
crm Coerce word under cursor to MixedCase. abolish.vim
crc Coerce word under cursor to camelCase. abolish.vim
crs Coerce word under cursor to snake_case. abolish.vim
cr_ Coerce word under cursor to snake_case. abolish.vim
cru Coerce word under cursor to SNAKE_UPPERCASE. abolish.vim
crU Coerce word under cursor to SNAKE_UPPERCASE. abolish.vim
cr- Coerce word under cursor to dash-case. abolish.vim
crk Coerce word under cursor to kebab-case. abolish.vim
cr. Coerce word under cursor to dot.case. abolish.vim
cr<Space> Coerce word under cursor to space case. abolish.vim
crt Coerce word under cursor to Title Case. abolish.vim

CONFIGURATION

Key Description Type Default
vintageous_autoindent Enable auto indentation. boolean true
vintageous_enable_cmdline_mode Enable ':' and ex commands. boolean true
vintageous_enable_surround Enable surround.vim plugin. Provides mappings to easily delete, change and add such surroundings in pairs e.g. "cs", "ds", and "ys" actions. boolean true
vintageous_hlsearch Highlight searches in '/', '?', etc. boolean true
vintageous_ignorecase Ignore case in '/', '?', '*', and '#'. boolean true
vintageous_incsearch Apply search patterns incrementally as they are typed. boolean true
vintageous_magic Use regular expressions in '/' and '?' otherwise uses smart case, interpret pattern literally, and ignore case. boolean true
vintageous_reset_mode_when_switching_tabs Reset to normal mode when a tab is activated. boolean true
vintageous_surround_spaces Enable surround.vim plugin pair opener spaces, otherwise the pair closes have spaces i.e. if true then ysw( and ysw) -> ( things ) and (things), otherwise if false then ysw( and ysw) -> (things) and ( things )` boolean false
vintageous_use_ctrl_keys Enable key bindings prefaced by the CTRL modifier. boolean false
vintageous_use_sys_clipboard Propagate copy actions to the system clipboard. boolean false
vintageous_visualbell Enable visual bell. boolean true
vintageous_visualyank Enable visual bell when yanking. boolean true

Use CTRL keys

Preferences > Settings

{
    "vintageous_use_ctrl_keys": true
}

Project > Edit Project

{
    "settings": {
        "vintageous_use_ctrl_keys": true
    }
}

Mapping CapsLock to Escape

NeoVintageous cannot remap the CapsLock, however it can be remapped at an OS level e.g. in Ubuntu Gnome you can remap the CapsLock to Escape at the terminal.

gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"

Mapping jj to Esc

Add the following custom keybinding: Preferences > Key Bindings

{
    "keys": ["j", "j"],
    "command": "_enter_normal_mode",
    "args": {"mode": "mode_insert"},
    "context": [{"key": "vi_insert_mode_aware"}]
}

Other key bindings can also be mapped.

{
    "keys": ["ctrl+["],
    "command": "_enter_normal_mode",
    "args": {"mode": "mode_insert"},
    "context": [{"key": "vi_insert_mode_aware"}]
}

Holding down a key like j does not repeat the command

This is a feature of OS X Lion and newer versions.

To make a key repeat a command when holding it down, run this once at the terminal:

defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false

Better search highlighting support

Color schemes can support better search highlighting via the following scopes:

 <dict>
    <key>scope</key>
    <string>string.search</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#000000</string>
        <key>background</key>
        <string>#C4BE89</string>
    </dict>
</dict>
<dict>
    <key>scope</key>
    <string>string.search.occurrence</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#000000</string>
        <key>background</key>
        <string>#FFE792</string>
    </dict>
</dict>

Disable arrow keys

Add as many of the following key bindings as you would like to disable. Use the force.

[
    {"keys": ["left"],              "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["right"],             "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["up"],                "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["down"],              "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["alt+left"],          "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["alt+down"],          "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["alt+up"],            "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["alt+right"],         "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+left"],         "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+down"],         "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+up"],           "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+right"],        "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+shift+left"],   "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+shift+down"],   "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+shift+up"],     "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+shift+right"],  "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+tab"],          "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+shift+left"],   "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+shift+down"],   "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+shift+up"],     "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["ctrl+shift+right"],  "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["shift+left"],        "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["shift+down"],        "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["shift+up"],          "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]},
    {"keys": ["shift+right"],       "command": "null", "context": [{"key": "setting.neovintageous_disable_arrow_keys"}, {"key": "auto_complete_visible", "operand": false}, {"key": "overlay_visible", "operand": false}, {"key": "popup_visible", "operand": false}, {"key": "setting.is_widget", "operator": "equal", "operand": false}]}
]

Preferences > Settings

{
    "neovintageous_disable_arrow_keys": true
}

Project > Edit Project

{
    "settings": {
        "neovintageous_disable_arrow_keys": true
    }
}

CONTRIBUTING

Your issue reports and pull requests are welcome.

Tests

The UnitTesting package is used to run the tests. Install it, open the Command Palette, type "UnitTesting", press Enter and input "NeoVintageous" as the package to test.

Debugging

The Sublime Text startup log can be read by going to Menu > View > Show Console.

Sublime Text command and input logging can be enabled in the console (run the commands in input box at the bottom of the console panel): sublime.log_commands(True); sublime.log_input(True). Other logging such as regex results, indexing, and build systems can be enabled too: sublime.log_result_regex(True); sublime.log_indexing(True); sublime.log_build_systems(True).

Neovintageous debug messages are disabled by default. To enable them set an environment variable named SUBLIME_NEOVINTAGEOUS_DEBUG to a non-blank value. See Set a Sublime Text environment variable for a step by step guide on how to set an environment variable for Sublime Text. The debug message log is located at Packages/User/NeoVintageous.log. Debug messages are also printed to the console: Menu > View > Show Console.

Reverting to a freshly installed state

For Linux and OSX this script can be used to clean caches, indexes, workspaces, sessions, etc. Check back soon for a Windows compatible script.

Note: cleaning and reverting are two different tasks. Reverting will remove installed packages and configurations, cleaning will only remove files generated by Sublime Text at runtime like caches, indexes, workspaces, sessions, etc.

CHANGELOG

See CHANGELOG.md.

CREDITS

This project is a fork of Vintageous.

LICENSE

Released under the MIT License.

About

An advanced Vim emulation layer for Sublime Text (Vintageous fork).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%