Git Product home page Git Product logo

better-escape.vim's People

Contributors

jdhao 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

better-escape.vim's Issues

tmap (Terminal mapping) support

First of all, thank you for your plugin!
The part I most appreciate is that it is written in VimL (making it not python3 dependent and backwards compatible)

I will love to see this plugin working on vim/nvim built in terminal.

This is not good enough, I need short interval (which this plugin provides)

tmap jk <c-\><c-n>
tmap kj <c-\><c-n>

Thanks in advance :3

Issues when updating the plugin using vim-plug

In the first commit a19e3c0, I accidentally committed the doc/tags file to this repo. In commit 19870e3, I added the .gitignore file and removed doc/tags file.

After that, when I update the plugin using vim-plug. I see an error about merging. Because the remote change will overwrite the local tags file. The solution is to go to where better-escape.vim is installed and remove doc/tags file.

Then vim-plug should work without any errors.

Buffer is marked changed after exiting insert mode

When I open a file, go into insert mode and press jk, the buffer is marked as changed, even though I clearly did not do any changes to the file.
It does not happen in each file, but I can't figure out what causes the problem. It happens repeatedly with init.vim.
I'm using nvim 0.5.0. Let me know if I can give you any debug information.

Multiple escape keys

Thanks for the plugin!

I tend to map jk and it's variant kj to esc. It would be nice to be able to map multiple versions to esc

idea: extends the plugin to support other similar insert mode mappings

For example, if we use the following mapping:

inoremap ;; <Esc>A;

We also experience lagging when we press ; in insert mode. So we can also do the same thing. We check if the time interval between pressing the two chars is below the time threshold. If that is the case, we execute its original intended mapping, otherwise, we just insert the character literally.

Here is a crude implementation:

let g:my_map = {";;": "\<Esc>mmA;\<Esc>`ma"}

let g:char_press_time = {}

inoremap <expr> ; My_map()

augroup log_press_time
  autocmd!
  autocmd InsertCharPre * call Log_char()
augroup END

function! Log_char() abort
  if v:char == ';'
    let g:char_press_time[';'] = reltime()
  endif
endfunction

function! My_map() abort
  let idx = col('.')
  let pre_idx = idx-1
  let pre_char = getline('.')[pre_idx-1]

  if pre_char == ';'
    let interval = reltimefloat(reltime(g:char_press_time[";"])) * 1000
    echomsg "interval:" interval

    if interval < 200
      return "\b" . g:my_map[";;"]
    else
      return ";"
    endif
  else
    return ";"
  endif

endfunction

New errors on load using neovim 4.4

FYI, I am checking out d3db183 to avoid the errors

Error detected while processing /Users/xxxxx/.local/share/nvim/plugged/better-escape.vim/autoload/better_escape.vim:
line 47:
E475: Invalid argument: msg, level = 'msg') abort
line 48:
E121: Undefined variable: a:level
E15: Invalid expression: a:level ==# 'err'
line 51:
E121: Undefined variable: a:msg
line 52:
E121: Undefined variable: a:level
E15: Invalid expression: a:level ==# 'err'
line 55:
E193: :endfunction not inside a function
Press ENTER or type command to continue

Handling Non-ascii shortcuts in Vim

Hi!

I have below in my configuration

" non-ASCII shortcuts are also supported for non-English keyboard
let g:better_escape_shortcut = ['kk', 'лл']
let g:better_escape_interval = 190 "default is 150

And I use set keymap= setting, so that I can switch insert mode layout to Russian using <C-^> shortcut.

It's also possible to change current layout using system (Windows) shortcut.

The issue is with gVim, with Russian layout activated with <C-^> (through keymap setting above), when I type лл it still stays in Insert mode.

This works fine with Neovim, and it works in Vim/Neovim when Russian layout is activated through system shortcut.

Thank you!

Map shortcut to escape while Ibus turn on

Dear,

Can we map "jk" to escape while the iBus mode is switch to another input method (here is Vietnamse Ibus-bamboo input method)

function! IBusOff()
  " Lưu engine hiện tại
  let g:ibus_prev_engine = system('ibus engine')
  " switch to english engine
  execute 'silent !ibus engine xkb:us::eng'
endfunction
function! IBusOn()
  let l:current_engine = system('ibus engine')
  " if engine is set in normal mode then use it 
  " in insert mode

  if l:current_engine !~? 'xkb:us::eng'
    echo "hello world"
    let g:ibus_prev_engine = l:current_engine
  endif
  " restore the last engine
  execute 'silent !' . 'ibus engine ' . g:ibus_prev_engine
endfunction
augroup IBusHandler
    autocmd CmdLineEnter [/?] call IBusOn()
    autocmd CmdLineLeave [/?] call IBusOff()
    autocmd InsertEnter * call IBusOn()
    autocmd InsertLeave * call IBusOff()
augroup END

call IBusOff()
better-escapeibus.mp4

Thanks,

E475, E121, E15, E193, after update Jun 26, 2021

image

Error detected while processing /home/master/dotfiles/nvim/plugged/better-escape.vim/autoload/better_escape.vim:
line   47:
E475: Invalid argument: msg, level = 'msg') abort
line   48:
E121: Undefined variable: a:level
E15: Invalid expression: a:level ==# 'err'
line   51:
E121: Undefined variable: a:msg
line   52:
E121: Undefined variable: a:level
E15: Invalid expression: a:level ==# 'err'
line   55:
E193: :endfunction not inside a function

image

bug: not working with Cyrillic letters

works:
let g:better_escape_shortcut = ['jk', 'kj']
and this works too:
let g:better_escape_shortcut = ['jj', 'kk']

but if add Cyrillic letters plugin not working:
let g:better_escape_shortcut = ['jj', 'kk', 'оо', 'лл']

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.