Code Monkey home page Code Monkey logo

lexima.vim's People

Contributors

4513echo avatar aiya000 avatar akinsho avatar blueyed avatar cohama avatar crazymaster avatar creasty avatar daveyarwood avatar eight04 avatar emilyst avatar hrsh7th avatar k-takata avatar kuuote avatar mopp avatar mrshu avatar notuxic avatar pasela avatar perrin4869 avatar rexagod avatar ryym avatar tarohi24 avatar thalesmello avatar thinca avatar tsuyoshicho avatar ujihisa avatar uplus avatar vheon avatar yasunori0418 avatar yuntan 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

lexima.vim's Issues

<C-h> mapping

Hi, I was just wondering about the <C-h> mapping in the plugin. I found that in line 99 of autoload/lexima you are mapping <C-h> to <BS>... only it conflicts with another mapping of mine, so it's a problem. I do not see the relevance of the mapping... is there a reason why it's there?

Neovim : <C-h> needs to be overridden

I want to bind <C-h> in neovim to move cursor left in insert mode. But it can't work.

nnoremap <C-h> <C-w>h " only C-h does not work.
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

This is what I added to my .vimrc to try to make it work and it still doesn't work :

if has('nvim')
  " Hack to get C-h working in NeoVim
  nmap <BS> <C-W>h
endif

verbose imap <BS> gives me this result

i  <BS>        * lexima#expand('<BS>', 'i')
        Last set from ~/.vim/plugged/lexima.vim/autoload/lexima/insmode.vim

Someone here told me this :

@aemb You are mapping in normal mode, not insert mode, so the plugin takes over. It might override it even if you do map it in insert mode, but that will depend on how well behaved it is.

How can I override the plugin mapping ?

[discussion] New Line Rules getting on the way

I've been using this plugin for a while now, and I am really happy with how it works, except when it comes to one of the New Line Rules:

Before        Input         After~
------------------------------------
{|            <CR>          {
                                |
                            }
------------------------------------

Now, the problem here is that there is no way to disable this rule without disabling the other new line rule. This rule can get really annoying when pressing <CR> after a bracket which already had a closing bracket, and since the default rules take care of that case, this rule seems rather redundant. Is there a way you could add a way to disable this rule? Or maybe even remove it completely, because I cannot really see the point of having it provided the default rule:

Before        Input         After~
------------------------------------
|             {             {|}

unexpected behavior after pressing ESC

If I press a key within a second of pressing ESC, that key usually interacts with the text I input in some undesirable way.

For example, using arrow keys inserts something like A or D at the line above the cursor. Using h,j,k,l re-enters insert mode and inserts the character at the cursor location.

Problem with <tab> and / or <right> in custom rules

I've played with a few custom rules.

call lexima#add_rule({'char': '<tab>', 'at': '\%#)', 'input': '<right>'})
call lexima#add_rule({'char': '<tab>', 'at': '\%#]', 'input': '<right>'})
call lexima#add_rule({'char': '<tab>', 'at': '\%#}', 'input': '<right>'})

However, after updating the plugin, this no longer works. I've tried to debug the problem, but my knowledge is lacking.

Rule suggestion

After playing around with custom rules and reading docs, I'm wondering if you could help me out. I'm trying to add a rule with char being ESC. However, the rule doesn't apply.

Basically, I would like to make a rule so that when I press in insert mode and I'm surrounded by some sort of pair('', (), "", ('')) it moves the cursor to the end of the last pair and enters insert mode. Is this possible with Lexima?

Cursor shape changes briefly when space bar pressed

I use t_SI and t_EI to change the shape of my cursor when entering insert or normal modes. I notice that with lexima active, the cursor shape changes perceptibly whenever I hit the space bar in insert mode. I assume lexima is entering and exiting normal mode behind the scenes. I don't know if it's feasible, but it would be nice if this didn't happen perceptibly.

breaks undo

This looks like a promising plugin. I would like to make you aware of Raimondi/delimitMate#138 which has discussion about fixing undo/redo with these types of plugins. I just tried lexima.vim, and although dot-repeat seems to work, it still breaks undo.

The key to solving undo/redo is in this comment: Raimondi/delimitMate#138 (comment)

There is an edge case with visual-block mode: Raimondi/delimitMate#138 (comment)

But fixing undo is vastly more important in my opinion. No one has taken the time to implement the solution yet, though.

Breaks abbreviations triggering on rule-chars

Normally, pressing ( in insert mode also triggers vim's abbreviations (:help abbreviations). With lexima (and its default rules in place), this is no longer the case.

Is there a way to make abbreviations work with lexima?

Disable the backtick rule

In OCaml, the backtick is used for polymorphic variants, e.g: ``Something` so it is never terminated. Is it possible to disable this particular rule somehow just for the ocaml filetype?

lexima.vim causes <CR> to insert newline when insert completion popup menu is in "state 2"

Problem Summary

<CR> both makes a selection and inserts a newline character when the insertion completion popup menu is in "state 2." From :help ins-completion-menu:

There are three states:
1. A complete match has been inserted, e.g., after using CTRL-N or CTRL-P.
2. A cursor key has been used to select another match.  The match was not
   inserted then, only the entry in the popup menu is highlighted.
3. Only part of a match has been inserted and characters were typed or the
   backspace key was used.  The list of matches was then adjusted for what is
   in front of the cursor.

To get to state 2. first bring up the insert completion popup menu with <C-P>, then use the up or down arrows to select a different entry. If an entry is highlighted but the text in the buffer has not been updated to match that entry, you know you've reached state 2. At this point, a <CR> is supposed to behave exactly like <C-Y>, that is the following actions occur:

  1. It selects the entry and put its contents into the buffer
  2. It closes the popup menu
  3. It leaves the cursor in insert mode immediately following the completed word; no newline is inserted

When lexima.vim is present in the runtimepath, a newline is inserted, which is not the expected behavior for state 2.

Example VIMRC

set nocompatible
set hidden

set runtimepath+=~/.vim/plugins/repos/github.com/Shougo/dein.vim

" Required:
call dein#begin('~/.vim/plugins')

" Let dein manage dein
call dein#add('Shougo/dein.vim')
call dein#add('cohama/lexima.vim')
call dein#end()

filetype plugin indent on
syntax enable

if dein#check_install()
  call dein#install()
endif

Environment

OS

OS X 10.11 El Capitan

Vim version

MacVim

macvim: stable 8.0-114 (bottled), HEAD
GUI for vim, made for macOS
https://github.com/macvim-dev/macvim
/usr/local/Cellar/macvim/8.0-113 (2,102 files, 33.5M)
  Built from source on 2016-10-26 at 20:13:15 with: --with-python3 --without-python --with-lua --with-luajit
/usr/local/Cellar/macvim/8.0-114 (2,107 files, 33.6M) *
  Built from source on 2016-10-30 at 11:10:06 with: --with-python3 --without-python --with-lua --with-luajit
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/macvim.rb
==> Dependencies
Recommended: cscope
Optional: lua, luajit
==> Requirements
Build: xcode
Recommended: python
Optional: python3
==> Options
--with-custom-python
	Build with a custom Python 2 instead of the Homebrew version.
--with-lua
	Build with lua support
--with-luajit
	Build with luajit support
--with-override-system-vim
	Override system vim
--with-python3
	Build with python3 support
--without-cscope
	Build without cscope support
--without-python
	Build without python support
--HEAD
	Install HEAD version
==> Caveats
.app bundles were installed.
Run `brew linkapps macvim` to symlink these to /Applications.
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 30 2016 11:09:57)
MacOS X (unix) version
Included patches: 1-52
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +find_in_path    -mouse_sysmouse  -tag_any_white
+arabic          +float           +mouse_urxvt     +tcl
+autocmd         +folding         +mouse_xterm     +termguicolors
+balloon_eval    -footer          +multi_byte      +terminfo
+browse          +fork()          +multi_lang      +termresponse
++builtin_terms  +fullscreen      -mzscheme        +textobjects
+byte_offset     -gettext         +netbeans_intg   +timers
+channel         -hangul_input    +num64           +title
+cindent         +iconv           +odbeditor       +toolbar
+clientserver    +insert_expand   +packages        +transparency
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua             +rightleft       +writebackup
+diff            +menu            +ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      +mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary      
+file_in_path    +mouse_sgr       +tag_old_static  
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework Cocoa  -pagezero_size 10000 -image_base 100000000 -L/usr/local/opt/luajit/lib -lluajit-5.1 -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m -lpython3.5m -framework CoreFoundation -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby    

Plugin version

This is on commit 0aa05cb

Steps to reproduce

  1. Edit a new file with the following contents:

    ab
    abcd
    abcdef
    
  2. In insert mode, on a new line, type a, then activate keyword completion with <C-P> (state 1.)

  3. Push the Up arrow to highlight a different entry (state 2.)

  4. Hit Enter key to issue a <CR>

  5. Observe that the entry was selected and used, but that a newline was entered and the cursor is now on the line below the completion

Retry the following steps without lexima.vim in the runtimepath and you will observe in step 5 that no newline is inserted and that the cursor remains immediately after the insertion.

Own <CR> mapping should invoke as fallback lexima.vim

delimitmate provides following possibility:

 inoremap <expr> <CR> delimitMate#WithinEmptyPair() ?
   \ "\<C-R>=delimitMate#ExpandReturn()\<CR>" :
    \ "external_mapping"

Does lexima provide something similar?

My mapping looks as follows:

let g:ulti_expand_or_jump_res = 0
function! ExpandSnippetOrReturnCR()
        let snippet = UltiSnips#ExpandSnippetOrJump()
        if g:ulti_expand_or_jump_res > 0
                return snippet
        else
                return "\<CR>"
        endif
endfunction


inoremap <expr> <CR>
    \ pumvisible() ?
    \ "<C-R>=ExpandSnippetOrReturnCR()<CR>" : "\<CR>"

How can I adapt it if pumvisible is false that lexima is called?

CR inserts new line when deoplete's completion menu is displayed in Neovim.

Minimal config:

call plug#begin('~/.config/nvim/minimal-plugged')

Plug 'Shougo/deoplete.nvim'
Plug 'cohama/lexima.vim'

call plug#end()

let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_refresh_always = 1
let g:deoplete#enable_ignore_case = 1
let g:deoplete#enable_smart_case = 1
let g:deoplete#enable_camel_case = 1
let g:deoplete#file#enable_buffer_path = 1
call deoplete#custom#set('_', 'matchers', ['matcher_full_fuzzy'])
set omnifunc=syntaxcomplete#Complete
set completeopt=longest,menuone,preview,noinsert

Steps to reproduce:

  1. Start nvim by nvim -u minimal.init.vim.
  2. Insert couple of string to populate buffer completion for Deoplete.
  3. Attempt word completion, let deoplete preselect first completion candidate.
  4. Press to accept completion.

Outcome:
Upon completion accepted by cursor is moved to new line.

Expected outcome:
Completion should happen without entering new line.

Both lexima and deoplete are latest versions. Neovim is 0.1.5.

Please see gif demonstrating the issue:
lexima_cr_issue

Commenting auto-added } on Escape

Hi! Fantastic plugin you've written. Far better, consistency-wise, than delimitMate, at least in my experience.

I've noticed behavior which is almost certainly wrong, but I'm not sure if it's lexima.vim's fault. When I type the following (| is the cursor):

void foo() {|

then it correctly expands to the following:

void foo() {
    |
}

But a common thing for me to do is to type out a bunch of empty functions and just put a comment in them, getting the skeleton ready for actual implementation later. From the above expansion, still in Insert mode, I type:

void foo() {
    // Frobnicate the bar.|
}

When I hit Escape, this happens:

void foo() {
    // Frobnicate the bar.|
    // }

Obviously this is not what I meant to happen; I'd rather the closing brace stay uncommented. Pressing u at this point corrects the issue, for whatever reason:

void foo() {
    // Frobnicate the bar.|
}

This only happens in files where a source code filetype is set (such as c, cpp, or rust). That is, in an empty buffer, the closing brace stays put.

Do you have any idea what could be causing this behavior, and how to make it stop?

arrow key display ABCD in insert mode

NeoBundle 'cohama/lexima.vim' した際、
インサートモード時にカーソルキーを使うと、ABCD と表示されてしまいます。

以下の .vimrc でも発動しました。

filetype plugin indent off
set rtp&
let s:neobundle_dir = expand('~/.vim/bundle')

if has('vim_starting')
  set nocompatible               " Be iMproved
  set rtp+=~/.vim/bundle/neobundle.vim/
endif

call neobundle#rc(expand(s:neobundle_dir))

" Let NeoBundle manage NeoBundle
NeoBundleFetch 'Shougo/neobundle.vim'

NeoBundle 'cohama/lexima.vim'

"NeoBundleCheck

filetype plugin indent on

GUIのMacVimは問題ないのですが、
CUIだとダメです。

/usr/local/Cellar/vim/7.4.430_1 (1600 files, 28M) *
  Built from source with: --with-lua, --with-luajit, --override-system-vi
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/vim.rb
==> Dependencies
Optional: lua ✔, luajit ✔

Breaks moving with arrow keys in insert mode

In insert mode, moving with arrow keys inserts letters A/B/C/D when using lexima.

If it is not your plugin by itself, it is how it interact with the others plugins I have. I tested this by uninstalling and installing again just your plugin.

Adding all tpope/endwise default rules

I try to reduce the number of vim plugins I use. Therefore I'd like to see that all default endwise rules are also shipped with lexima.vim. I would assume that is not too daunting. What is your opinion about this?

日本語入力が途中で確定されてしまう

便利なプラグインありがとうございます。

日本語入力が途中で確定されてしまう問題に遭遇しました。

++++++++++++++++++
環境:
vim : macvim kaoriya 7.4 1-527
OS : Mac OSX Yosemite
インプットメソッド : GoogleJapaneseInput-2.16.2007.101
+++++++++++++++++++

1)gvim上の挿入モードに移行。インプットメソッドを日本語入力に設定
2)「あいうえお」(aiueo)と入力しようとする

望まれる動作としてEnterキー押下で確定になりますが、
lexima.vimを読み込んでいると、
「あい」入力時点で確定されたことになり、バッファに出力されてしまいます。

インプットメソッド関係の設定

set noimdisable
set imsearch=0
set iminsert=0
if exists('+imdisableactivate')
  set imdisableactivate
endif

手元gvimで再現率は100%で再現し、iTerm2上のvimでは再現しませんでした。

Syntax blacklisting

While the syntax option is really useful, currently it is not possible to set any "blacklisted" syntax, where the rule shouldn't apply.

It would be really helpful on code-specific situations e.g. the rule inputs a <cr> expecting the next line to become indented, but the rule shouldn't apply inside comments (where a <cr> would start the next line as the comment continuation or an <cr> on input_after... both probably breaking the indentation).

Space is broken in text/mail format

Given

  • neovim 0.1.1

  • the following init.vim:

    call plug#begin()
    Plug 'cohama/lexima.vim'
    call plug#end()
    
  • Any filetype of "", "text", or "mail" (may be present in other filetypes)

Then

The input

hello␣world

produces the output

helloworld␣

where denotes a space.

Workaround

The behavior disappears if lexima_enable_space_rules = 0, or all three of the <Space> rules are deleted from lexima.vim; any one of them remaining is enough to trigger the behavior.

Characters after cursor deleted in error in a C style function scope due to bad rule

For example, if you have:

function dummy() {
(asd|)
}

and you press <BS> once the right paren ')' get deleted when it is not suppose to. The cause is the bad rule below which is causing overmatching. Escaping the [] characters fixes it. Please check.

diff --git a/autoload/lexima.vim b/autoload/lexima.vim
index 82bff0f..f41e8e6 100644
--- a/autoload/lexima.vim
+++ b/autoload/lexima.vim
@@ -84,7 +84,7 @@ let g:lexima#space_rules = [
 \ {'char': '<Space>', 'at': '{\%#}', 'input_after': '<Space>'},
 \ {'char': '<BS>', 'at': '{ \%# }', 'delete': 1},
 \ {'char': '<Space>', 'at': '\[\%#\]', 'input_after': '<Space>'},
-\ {'char': '<BS>', 'at': '[ \%# ]', 'delete': 1},
+\ {'char': '<BS>', 'at': '\[ \%# \]', 'delete': 1},
 \ ]

Lexima inserts piece of its own source-code into buffer on <CR> in neovim

After setting up Lexima, I've noticed a bizarre bug… when typing <CR> in insert mode, a lexima rule will automatically enter its own source code into the buffer. This happens on any filetypes repeatably.

The code in question is:

pumvisible() ? "\u" : lexima#expand('
', 'i')

I believe the culpable code is this:

if has('nvim') && a:rule.char == '<CR>'
execute printf("inoremap <expr><silent> %s pumvisible() ? \"\\<C-y>\" : lexima#expand(%s, 'i')",
\ a:rule.char,
\ string(lexima#string#to_mappable(a:rule.char))
\ )
else

    if has('nvim') && a:rule.char == '<CR>'
      execute printf("inoremap <expr><silent> %s pumvisible() ? \"\\<C-y>\" : lexima#expand(%s, 'i')",
                    \ a:rule.char,
                    \ string(lexima#string#to_mappable(a:rule.char))
                    \ )
    else

My guess is that the rule.char is interpreted as a newline in the command, breaking the command, instead of the characters <CR> indicating the carriage return.

Add ability to move cursor after closing bracket in new line

When you are writing for example a function like so:

public function helloWorld() {|}

When you press it will be like so:

public function helloWorld() {
    |
}

Which is all ok but once you finish everything it would be ideal to be able to press } and then the cursor move to the position after the closing parentheses like so:

public function helloWorld() {
    return "hello world";
}|

The same would apply to () and [] as those can be used in many languages (I am a PHP dev) to denote things like arrays, and function parameters etc.

Thanks.

nowrapscan breaks plugin

I have set nowrapscan and when I enter an opening parenthesis, the closing one is not recognized. I end up with (foo)).

Not sure if this can be fixed, but I guess it's good to know about it.

Allow this plugin to be disabled per buffer

First of all... thank you! This plugin is impressive and I found it a lot more flexible/powerful than the any of the alternatives... really, thank you for the effort :)

As this plugin conflicts with some features of paredit.vim (it provides superpowered bindings for brackets/square brackets/parens for LISP dialects), maybe it would be better to allow this plugin to be disabled per buffer, e.g.:

autocmd FileType clojure let b:lexima_enabled=0

So we can use each one where it fits better.

leave not working after esc + insert

Well, the title says everything. A simple example that can reproduce the issue is the {'char': ')', 'at': '\%#)', 'leave': 1} rule:

Before           Input         After
-----------------------------------------
|                (             (|)
-----------------------------------------
(|)              )             ()|
-----------------------------------------
         (after esc + insert)
(|)              )             ()|)

Don't expand if popup menu is available (on completion menu) on <CR>

Hi! I'm really enjoying your plugin, but because I'm using the AutoComplPop plugin things were not working correctly when I pressed enter to select a completion from the pop up menu.

So, I had to change this one line in autoload/lexima/insmode.vim inside the function lexima#insmode#_expand(char) Line 93 from:

if !has_key(s:map_dict, char) || mode() !=# 'i'

to

if !has_key(s:map_dict, char) || mode() !=# 'i' || pumvisible() && a:char ==# ''

That way, if the pop up menu for completion is visible (AutoComplPop shows it while typing a letter/word) then the mapping for will return the default instead of going to a new line. After this change it all works fantastically!

Conflict with deoplete and pressing <CR> on completion

Hi,
Thanks for the plugin!

I recently updated lexima and found that when I press enter on a deoplete autocompletion (in insert mode), the completion is no longer inserted into the text. I traced it back to this change. I believe it happens because deoplete uses abbreviations in the pop-up menu causing some sort of conflict...

Any ideas for a workaround? Also I'm using neovim. Let me know if you need more info.

Thanks!

Jumping over closing brackets

Using Neovim (NVIM v0.2.0-1171-g4566f7c) and a clean configuration (only runtimepath for lexima set) the plug-in does not show the described behavior:

Before        Input         After~     
------------------------------------
|             (             (|)             works
------------------------------------
|             "             "|"             works
------------------------------------
""|           "             """|"""        works
------------------------------------
''|           '             '''|'''            works
------------------------------------
\|            [             \[|             works, but \[| input: <cr> gives \[\n|]
------------------------------------
\|            "             \"|             works
------------------------------------
\|            '             \'|              works
------------------------------------
I|            'm            I'm|         works
------------------------------------
(|)           )             ()|             doesn't work, gives: (|
------------------------------------
'|'           '             ''|               doesn't work, gives '|
------------------------------------
(|)           <BS>          |          works
------------------------------------
'|'           <BS>          |           works
------------------------------------

Mysterious errors when adding newline

In the following buffer (cursor indicated by "|" at the end of the last line), pressing return gives me a series of errors.


---
id: vkegrjzo
key: vimscript_vim-sneak.lib.vkegrjzo
type:
- library
title: vim-sneak
language: vimscript.pgl.bxsevhau
github: justinmk/vim-sneak

---|

These are the errors:

=<SNR>79_map_impl('
E115: Missing quote: '
E116: Invalid arguments for function <SNR>79_map_impl('
E15: Invalid expression: <SNR>79_map_impl('

I am using lexima with no custom configuration.

Global except rule to prevent autoclose when next character is non-whitespace

In sublime and textmate (as well as the vim plugin snipmate which lacks repeat support), if the character after the cursor is non-whitespace, the closing brace is not automatically inserted:

foo |bar + ( => foo (bar

In lexima the brace is always inserted:

foo |bar + ( => foo ()bar

I prefer the sublime behavior. My reading of the documentation is an "except" rule is applied locally to a single rule.

Is there a way to add a global except rule that affects all default rules?
Would my best bet be to set g:lexima_no_default_rules = 0 and then respecify them all in my vimrc?
Would you be open to having the behavior I describe be toggleable with a variable?

Love the plugin, auto-closing braces are great, and repeat is even better.

Typing quotes in replace mode does not overwrite

If I have this document:

|This is a document.

and have the cursor (|) at the beginning, entering replace mode and typing " causes the single character to be inserted:

"|This is a document.

I would expect lexima.vim to be disabled in replace mode. Is this behavior by design?

Quotes added again after entering the quoted text

Hi.

If I type "hello" I get the expected "hello"| (with the | being the cursor as usual). However, if I enter back the cursor inside the quote, and I type the "at "hello|", I expect the cursor to advance, and instead it adds a quote sign.

In other words: "hello"<left>" gives "hello"|" instead of "hello"|. Is this expected? If I do "hello<right><left>" I get the correct result.

I have no configuration added to lexima (no variables nor rules), and I think I have no conflicting mappings with those characters.

Thanks for the plugin!

Closing chars in multiple lines

Hi, I like this plugin pretty much.
Now, the ideal behavior for me is to type code just the same as in the case that the plugin is disabled.

This issue is about closing the char like '}' in the next line.

Suppose the following case

func() {|}

And if you enter, you get

func() {
  |
}

Then you type '}' to get

func() {
}|
}

But what I really want is

func() {
}|

I tried to write rules for this without any success.
Maybe it is out of the scope of just rules.

Any suggestions? Thanks.

Mishandled Space with custom rule

I tried to add the following rule:

call lexima#add_rule({'char': '<Space>', 'at': '( \+.*\%# \+)', 'leave': ' '})

This should allow me to continue typing after opening parentheses with an added space:

foo( | )

should now become

foo(  |)

instead of the stock behavior:

foo(  | )

This works fine... once. But if I have another set of parentheses with spaces anywhere in the file above the cursor, I cannot insert spaces in parentheses at all! Pressing spacebar in this file does nothing:

foo(  )
bar(|)

This is very weird. Does the regex match beyond the current line?

Add custom characters to be autoclosed

Is it possible to allow for adding custom characters to be autoclosed by lexima?

For example, I would like to add '$' to be autoclosed when working on latex files.

Document interactions between lexima and neocomplete

In issue #65, @cohama said

In the past, I introduced some codes to hide popup menu forcely because some auto completion plugins (e.g. neocomplete) conflict with lexima.vim.

and

If you use any auto completion plugin, conflicts lexima's one.
It requires more time to solve both 2 problems simultaneously.

I recently started using neocomplete. I would like to know more about the interactions between lexima and neocomplete. I can see from this search there has been discussion of the two, but I don't find any documentation in lexima's Vim documentation. I'm especially interested in how users can minimize the negative interactions between these plugins.

For example, does the order of loading the plugins matter (e.g., do I need to load lexima before I load neocomplete, or vice versa)?

If I want to define <CR> behavior in the insert mode popup completion, as described in this comment,

imap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"

does this need to be defined after setting some configurations for lexima e.g.,

let g:lexima_no_default_rules = 1
call lexima#set_default_rules()

or can it be defined before those lexima configurations? (It seems like it must happen after lexima configuration.)

Space rules break abbreviations

Since 5498cff insert-mode abbreviations are no longer expanded when typing <Space>. Abbreviations expand as expected by reverting to the previous commit or setting g:lexima_enable_space_rules = 0.

Example

:iabbrev test testxxx
itest foo<Esc>

Result with g:lexima_enable_space_rules = 0:

testxxx foo

Result with g:lexima_enable_space_rules = 1:

test foo

Mapping <Esc> breaks special chars / use InsertLeave?

Because of the <Esc> mapping, special keys that use escape codes in the terminal are broken, e.g. cursor keys.

While it can be disabled, it's meant to serve a purpose, I guess?!

if !g:lexima_no_map_to_escape
  inoremap <silent> <Esc> <C-r>=lexima#insmode#escape()<CR><Esc>
endif

Would using InsertLeave be an alternative here?

neovim: rightside expansion get deleted after <ESC>

On current neovim-git expansions get deleted after pressing g:lexima_map_escape. Everything seems to work fine with the same configuration on vim8.

peek

Versions:

  • neovim: NVIM v0.2.0-1193-g3a6b8c28c
  • vim: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 6 2017 14:11:23)
  • distro: arch linux

delete + input_after not working

I have the following settings:

{'char': '<cr>', 'at': '{\%#}$', 'input': '<cr>\<space>', 'input_after': ',<cr>\', 'filetype': 'vim'},
{'char': '<cr>', 'at': '{ \%# }$', 'input': '<bs><cr>\<space>', 'input_after': ',<cr>\', 'delete': 1, 'filetype': 'vim'},

The first one works correctly, but the second one doesn't. The behavior (just to make it easier to read) should be like this:

Before           Input         After
-----------------------------------------
let a = {|}     <cr>          let a = {
                                \ |,
                                \}
-----------------------------------------
let a = { | }   <cr>          let a = {
                                \ |,
                                \}

In the end, both would do the same... de only difference is that the second one handles the { | } case, that's very common on my case.

Expose the <CR> function

I would love to have access to the function, and an option to disable the default auto mapping.
Here is the use case I am thinking of: A multipurpose functiono that routes to the proper call based on neocomplete popup, selected snippet, or default, lexima .

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.