Giter Site home page Giter Site logo

lh-brackets's Introduction

lh-brackets Last release Build Status Project Stats

Features

lh-brackets (ex- map-tool) provides various commands and functions to help design smart and advanced mappings dedicated to text insertion.

It is made of three sub-systems:

The bracketing subsystem

Brackets insertion

This subsystem provides a command that helps define INSERT-, NORMAL-, and VISUAL-mode mappings to insert any pairs of brackets-like characters.

  • The INSERT-mode mappings will
    • insert the pair of brackets-like characters when the opening one is triggered, add a placeholder after the closing character, and move the cursor between the two bracket characters;
    • insert the closing character when pressed, or move after it if it is the next character after the cursor ;
    • delete the current pair of empty brackets when <BS> is hit from within the brackets (following placeholders will also be deleted) (this can be disabled by setting [gb]:cb_delete_empty_brackets to 0)
    • insert an extra newline when <CR> is hit within an empty pair of curly-brackets {} (this can be disabled by setting [gb]:cb_newline_within_empty_brackets to 0)
  • The VISUAL-mode mapping will surround the current selection with the pair of bracket-like characters ;
  • The NORMAL-mode mapping will select the current word (or the current line depending on the use of the newline (-nl) option), and then surround this selection with the pair of bracket-like characters.

It is possible to:

  • tune what is exactly inserted in INSERT-mode (thanks to the -open and -close options),
  • not insert the placeholder (depending on b:usemark value),
  • specify which keys sequence actually triggers the mappings defined (thanks to the -trigger option),
  • define the mappings only in some modes (thanks to the options -insert, -visual, and also -normal)
  • make the mappings line-wise (thanks to the -nl option),
  • tune how the NORMAL-mode mapping select a current anything (thanks to the -normal option),
  • toggle the definitions of all the brackets mappings by pressing <F9> (:h <Plug>ToggleBrackets) ;
  • make the mappings global with :Brackets!, or local to a buffer with :Brackets. ;
  • neutralize the INSERT-mode mappings:
    • for specific filetypes with -but option
    • when the cursor is not under a space, coma, (semi-)colon, a equal sign, a closing pair character or at the end of line by default -- it will be possible to tune this feature in a later version
  • specify exactly which is the canonical pair for deletion when it's not immediate from the context (thanks to the -pair option)

Here is an excerpt from the C&C++ brackets definitions, see the documentation for more help.

let b:usemarks         = 1
let b:cb_jump_on_close = 1

:Brackets { } -visual=0 -nl
:Brackets { } -visual=0 -trigger=#{
:Brackets { } -visual=1 -insert=0 -nl -trigger=<localleader>{
:Brackets { } -visual=1 -insert=0

:Brackets ( )
:Brackets [ ] -visual=0
:Brackets [ ] -insert=0 -trigger=<localleader>[
:Brackets " " -visual=0 -insert=1 -escapable
:Brackets " " -visual=1 -insert=0 -trigger=""
:Brackets ' ' -visual=0 -insert=1
:Brackets ' ' -visual=1 -insert=0 -trigger=''
:Brackets < > -open=function('lh#cpp#brackets#lt') -visual=0

Note: This feature has been completely rewritten for the version 1.0.0 of map-tools. The old way of tuning the brackets insertion is no longer available.

By default, the mappings are active for most filetypes.

Brackets replacement

lh-brackets provides mappings (originally from auctex.vim) to replace a pair of bracket-characters by another pair of bracket-characters. See :h brackets_manipulations for more information.

The placeholder subsystem

This subsystem provides functions and mappings to:

  • mark places in the code where we could jump to later,
    See the help about !mark!, lh#marker#txt(), and <Plug>MarkersMark
  • jump forward and backward to those places.
    See the help about !jump!, and <Plug>MarkersJumpF
  • close all placeholders on the same line that are after closing bracket-like characters and jump to the last one -- see <Plug>MarkersCloseAllAndJumpToLast which is binded by default to <M-End> (or <C-L>$ in terminal instancef of Vim).

The marker/placeholder characters:

  • default to the French quote characters («»),
  • can be specified on a filetype basis,
  • are converted to match the current encoding,
  • can be shared with the ones from imaps.vim (:h g:use_place_holders).

Jumping to the next/previous placeholder:

  • is binded to <M-Del> (GUI) or <C-J> (terminal) by default (see :h <Plug>MarkersJumpF), or <M-S-Del>/<C-L><S-Del> to jump backward. Can be disabled by setting g:marker_define_jump_mappings to 0.
  • can be tuned to delete or select the placeholder the cursor is jumping to (:h g:marker_prefers_select, :h g:marker_select_empty_marks),
  • can select or ignore the placeholder where the cursor is currently within (if any) (:h g:marker_select_current, :h g:marker_select_current_fwd),
  • may move the line of the placeholder (we jump to) to the middle of the window (:h g:marker_center),
  • respects 'wrapscan',
  • opens the folder where the placeholder, we jump to, is,
  • doesn't break redo (is the case of empty placeholders, when placeholders are deleted instead of selected) ; this feature requires Vim 7.4-849.

The Vim library

As lh-vim-lib, map-tools provides a few functions of its own. All these functions are specialized into the definition of smart abbreviations and INSERT-mode mappings.

Function Purpose
lh#map#no_context(), lh#map#no_context2() Core functions to define mappings that only expand outside of string, comment, and character contexts
lh#map#4_these_contexts() Like lh#map#no_context(), except this time we can specify which text must be returned depending on the current context
lh#map#insert_around_visual() This is the core surrounding function ; the surrounding text is not interpreted
lh#map#surround() Interprets the !.*! mappings that are passed to lh#map#insert_around_visual() (!cursorhere! tells were to put the cursor). This function also recognises when the selected area is actually a marker/placeholder in order to not surround, but expand instead.
lh#map#build_map_seq() Core function that interprets !.*! mappings
lh#map#eat_char(), :I(nore)abbr Permits to define abbreviations that do not insert a whitespace when the <space> key is used to trigger the abbreviation
lh#map#insert_seq() High level function that interprets !.*! mappings, and take the context into account

Installation

  • Requirements: Vim 7.+ (7.4-849 in order to support redo), lh-vim-lib v5.3.0+, lh-style v1.0.0+ for unit testing.
  • With vim-addon-manager, install lh-brackets (this is the preferred method because of the dependencies)
ActivateAddons lh-brackets
  • or with vim-flavor (which also support dependencies)
flavor 'LucHermitte/lh-brackets'
  • or you can clone the git repositories
git clone [email protected]:LucHermitte/lh-vim-lib.git
git clone [email protected]:LucHermitte/lh-brackets.git
  • or with Vundle/NeoBundle:
Bundle 'LucHermitte/lh-vim-lib'
Bundle 'LucHermitte/lh-brackets'

Credits

  • This bracketing system is actually a variation on Stephen Riehm's original bracketing system ;
  • The brackets manipulation comes from Saul Lubkin code, also present in auctex.vim ;
  • Using SELECT-mode when reaching a placeholder was a suggestion from Gergely Kontra.

See also

lh-brackets's People

Contributors

luchermitte avatar troycurtisjr 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

Watchers

 avatar  avatar  avatar  avatar

Forkers

troycurtisjr

lh-brackets's Issues

I'm getting an error

after having used visual mode to select some text I press shift + 9 to get a left bracket, however I get the following errors in the vim command line:

Error detected while processing function lh#tags#ctags_flavor[3]..<SNR>147_System:
line    4:
E605: Exception not caught: Cannot execute system call (ctags --version): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ctags: illegal opt
ion -- -^@usage: ctags [-BFadtuwvx] [-f tagsfile] file ...^@
Press ENTER or type command to continue
Error detected while processing /Users/Thermatix/.vim/bundle/lh-dev/autoload/lh/dev.vim:
line  100:
E171: Missing :endif
Press ENTER or type command to continue
Error detected while processing function lh#map#surround:
line   43:
E171: Missing :endif
Press ENTER or type command to continue

if it helps I'm working on an empty unsaved file, here's a link to my vim files, the entry point is vimrc.vim

Brackets command not available in vimrc

I added the following line in my vimrc as instructed in the home page

:Brackets < > -open=function('lh#cpp#brackets#lt') -visual=1 -nl

but it generated the following error when I opened vim

E492: Not an editor command: :Brackets < > -open=function('lh#cpp#brackets#lt') -visual=1 -nl

Running the same command after opening vim works

The reason why I added it is that I could not type > in my markdown page. It keeps jumping to find the next > character

The command :imap > Enter shows

 i  >           *@lh#brackets#closer(">",function('lh#html#brackets#gt'),"")

Also, could you please advise why I could not get the following mappings work (no bracket around the current word is deleted, or changed for the other commands)

noremap        ,bx         <Plug>DeleteBrackets
noremap        ,b<del>     <Plug>DeleteBrackets
noremap        ,b(         <Plug>ChangeToRoundBrackets
noremap        ,b[         <Plug>ChangeToSquareBrackets
noremap        ,b{         <Plug>ChangeToCurlyBrackets
noremap        ,b<         <Plug>ChangeToAngleBrackets
noremap        ,b\         <Plug>ToggleBackslash

The command :map ,bx Enter shows

,bx         * <Plug>DeleteBrackets

which shows the mapping is correct

Many thanks

Using lh-brackets with Go

Is your feature request related to a problem? Please describe.
I am annoyed with how vim works with brackets when programming in Go. I think that lh-bracket might be in help here but it looks like I don't understand how to configure it. Main problem is when I try to create a new struct. When I type opening bracket { and hit I get what I've expected. Unfortunately after typing all member I've left with unwanted mark after closing bracket }.

Describe the solution you'd like
I would like that when I type all the members and then hit <cr>} I have cursor after closing bracket } and no mark after it.

Describe alternatives you've considered
I am able to have expected result If I hit <C-J>, but this is counter intuitive for me.

Additional context
Situation I am describing is when struct looks like below and cursor is in marked position <cursor>

type struct foo {
    member int<cursor>
}

Now hitting <cr> and } (or even shorter only }) I would like to have cursor after closing } bracket and no placeholder mark.

How can I change default mapping in lh-brackets?

Hi,
i have a problem because e.g. Ctrl+J mapping is already defined in Latex-Suite
and there is an error:
Cannot define imap toMarkersJumpFin (:source):{(unset )}: a previous global mapping on was defined in /home/przemek/.vim/bundl e/vim-latex-suite/plugin/imaps.vim.

I read the documentation about Brackets-default but I did not find how to change default
mappings e.g. into Ctrl+G.
Can you help me?

Multiple errors when usemarks is off

If I :let b:usemarks = 0 or :let g:usemarks = 0, the following occurs when I type a bracket:

Error detected while processing function lh#brackets#opener[71]..lh#map#insert_seq[15]..lh#map#smart_insert_seq2:
line    6:
E871: (NFA regexp) Can't have a multi follow a multi !
Press ENTER or type command to continue
Error detected while processing function lh#brackets#opener[71]..lh#map#insert_seq[15]..lh#map#smart_insert_seq2:
line    6:
E62: Nested +
Press ENTER or type command to continue
Error detected while processing function lh#brackets#opener:
line   71:
E171: Missing :endif
Press ENTER or type command to continue

The error disappears if I :unlet b:usemarks

Suggested alternative keybindings cause issues

The suggested alternative keybindings don’t work too well for me. I’m talking about what is suggested in https://github.com/LucHermitte/lh-brackets/blob/master/doc/lh-map-tools.txt#L584:

If you'd rather use other keybindings, then add into your |.vimrc| something
like: >
        imap <C-J>      <Plug>MarkersJumpF
         map <C-J>      <Plug>MarkersJumpF
        imap <C-K>      <Plug>MarkersJumpB
         map <C-K>      <Plug>MarkersJumpB
        imap <C-<>      <Plug>MarkersMark
        nmap <C-<>      <Plug>MarkersMark
        xmap <C-<>      <Plug>MarkersMark
Note: all default mappings can be disabled by setting
|g:marker_define_jump_mappings| to 0.

What happens is that e.g. when editing my ~/.vimrc pressing <C-<> does what I expect and inserts

<>«»

and places the cursor between < and >.

Editing a .tex file has a different result, though: pressing <C-<> inserts a literal <.

Changing the binding to use <C-n> instead makes it work correctly in .tex files as well.

To Reproduce
Steps to reproduce the behavior:

  1. I use the package vim-nox from debian stable for this.
  2. put the following in ~/.vimrc, which sets up vim-addon-manager as recommended in their instructions to install lh-brackets as recommended in its instructions:
" put this line first in ~/.vimrc
set nocompatible | filetype indent plugin on | syn on

fun! SetupVAM()
  let c = get(g:, 'vim_addon_manager', {})
  let g:vim_addon_manager = c
  let c.plugin_root_dir = expand('$HOME', 1) . '/.vim/vim-addons'

  " Force your ~/.vim/after directory to be last in &rtp always:
  " let g:vim_addon_manager.rtp_list_hook = 'vam#ForceUsersAfterDirectoriesToBeLast'

  " most used options you may want to use:
  " let c.log_to_buf = 1
  " let c.auto_install = 0
  let &rtp.=(empty(&rtp)?'':',').c.plugin_root_dir.'/vim-addon-manager'
  if !isdirectory(c.plugin_root_dir.'/vim-addon-manager/autoload')
    execute '!git clone --depth=1'
        \       'https://github.com/MarcWeber/vim-addon-manager'
        \       shellescape(c.plugin_root_dir.'/vim-addon-manager', 1)
  endif

  " This provides the VAMActivate command, you could be passing plugin names, too
  call vam#ActivateAddons([], {})
endfun
call SetupVAM()

" ACTIVATING PLUGINS

" OPTION 1, use VAMActivate
VAMActivate lh-brackets

" " OPTION 2: use call vam#ActivateAddons
" call vam#ActivateAddons([PLUGIN_NAME], {})
" " use <c-x><c-p> to complete plugin names
"
" " OPTION 3: Create a file ~/.vim-scripts putting a PLUGIN_NAME into each line (# for comments)
" " See lazy loading plugins section in README.md for details
" call vam#Scripts('~/.vim-scripts', {'tag_regex': '.*'})

" we disable those because they conflict with C-L from vim-sensible which does
" nohlsearch and diffupdate, etc.
let g:marker_define_jump_mappings = 0
" but I still want those functions on some keys
imap <C-J>      <Plug>MarkersJumpF
 map <C-J>      <Plug>MarkersJumpF
imap <C-K>      <Plug>MarkersJumpB
 map <C-K>      <Plug>MarkersJumpB
imap <C-<>      <Plug>MarkersMark
nmap <C-<>      <Plug>MarkersMark
xmap <C-<>      <Plug>MarkersMark
imap <C-$>      <Plug>MarkersCloseAllAndJumpToLast
nmap <C-$>      <Plug>MarkersCloseAllAndJumpToLast
vmap <C-$>      <Plug>MarkersCloseAllAndJumpToLast
imap <C-)>      <Plug>MarkersJumpOutside
nmap <C-)>      <Plug>MarkersJumpOutside
vmap <C-)>      <Plug>MarkersJumpOutside
  1. open ~/.vimrc and press C-<: it should insert
<>«»
  1. open ~/foo.tex and press C-<: it should insert
<

which is not the expected result. Also, in an existing .tex file, the same happens.
5. Change the mappings for <Plug>MarkersMark in ~/.vimrc:

imap <C-n>      <Plug>MarkersMark
nmap <C-n>      <Plug>MarkersMark
xmap <C-n>      <Plug>MarkersMark
  1. Repeat step 3, result should be the same.
  2. Repeat step 4, result should be:
«»
  1. Open an existing .tex file, result is:
<++>

Expected behavior
Explained above.

Context (please complete the following information):

  • Vim version:
% vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 04 2023 10:24:44)
Included patches: 1-1378, 1499
  • Other plugins installed: only VAM, as mentioned above

Additional context
Curiously, even with the mapping changed to <C-<>, when I press that keycombo in my ~/.vimrc, it still inserts:

<>«»

even though the command :imap <C-<> says No mapping found.
EDIT: I think this is explained by the mapping for a single < having almost the same effect as <Plug>MarkersMark, so please disregard this comment, unless my interpretation is wrong.

Everything in this report seems to apply equally to neovim, which is my usual editor.

The comment about mapping conflict with vim-sensible comes from my neovim config but is irrelevant here because for reproducing the issue in "proper" vim, I did not install that plugin.

I’m happy to provide more information if you let me know what is needed to find the cause for this unexpected behaviour.

Thank you very much.

Opening bracket on indented line moves cursor to first column

After the change at a45b9e4 and all the way to 7df6e69, typing the following with :setl noet:

int main() {
	if*
}

(where * is the cursor) then typing (, the parentheses appear fine, but the cursor moves to the first column right after.

The problem is only present under setl noet and behaves as expected with setl et.


VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 23 2017 12:10:29)
Included patches: 1-197, 322, 377-378, 550
Modified by [email protected]
Compiled by [email protected]
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +cmdline_hist    -ebcdic          +gettext         +listcmds        +mouse_sgr       +persistent_undo +smartindent     +textobjects     +wildmenu
+arabic          +cmdline_info    +emacs_tags      -hangul_input    +localmap        -mouse_sysmouse  +postscript      +startuptime     +timers          +windows
+autocmd         +comments        +eval            +iconv           +lua             +mouse_urxvt     +printer         +statusline      +title           +writebackup
+balloon_eval    +conceal         +ex_extra        +insert_expand   +menu            +mouse_xterm     +profile         -sun_workshop    +toolbar         +X11
+browse          +cryptv          +extra_search    +job             +mksession       +multi_byte      -python          +syntax          +user_commands   -xfontset
++builtin_terms  +cscope          +farsi           +jumplist        +modify_fname    +multi_lang      +python3         +tag_binary      +vertsplit       +xim
+byte_offset     +cursorbind      +file_in_path    +keymap          +mouse           -mzscheme        +quickfix        +tag_old_static  +virtualedit     +xpm
+channel         +cursorshape     +find_in_path    +lambda          +mouseshape      +netbeans_intg   +reltime         -tag_any_white   +visual          +xsmp_interact
+cindent         +dialog_con_gui  +float           +langmap         +mouse_dec       +num64           +rightleft       +tcl             +visualextra     +xterm_clipboard
+clientserver    +diff            +folding         +libcall         +mouse_gpm       +packages        +ruby            +termguicolors   +viminfo         -xterm_save
+clipboard       +digraphs        -footer          +linebreak       -mouse_jsbterm   +path_extra      +scrollbind      +terminfo        +vreplace
+cmdline_compl   +dnd             +fork()          +lispindent      +mouse_netterm   +perl            +signs           +termresponse    +wildignore

Weird behaviour when using Latex-suite

Not sure if it is my fault or a general thing but when I do not edit Latex files the plugin seems to be working normally. When I edit Latex files (with latex-suite) the closing bracket appears correctly with the placeholder but if I type the closing bracket, another placeholder appears with a second closing bracket. When I hit only the character before the cursor gets deleted.
Any help will be appreciated,
Thanks.

cd_disable_default disables additional brackets

Description
cb_disable_default disables additional brackets. After adding the line below, double quote completion and paren completion are disabled even though they are not explicitly disabled.
To Reproduce
Steps to reproduce the behavior:

  1. Add let g:cb_disable_default = { '[': 'n', '{': 'nv' } to .vimrc
  2. Open a new file and hit (
  3. [, { completion are still enabled.

Expected behavior
Hitting ( should close to ( )<++>

I am trying to disable automatically closing single quotes. From reading the docs I would expect let g:cb_disable_default = { '''': 'i'} to disable single quotes but leave everything else the same as the default behavior, am I missing something?

Version
NVIM v0.5.0-718-g090551a80

Please don't define mappings beginning with '!'

This leads to strange behavior when typing '!' in normal usage, and vim is trying to decide whether a mapping applies. These mappings are clearly not intended to be typed by a user, so please use mappings instead.

Weird behaviour when there are an unequal amount of opening/closing braces.

Is your feature request related to a problem? Please describe.
Suppose I had a C++ file:

int main()
{
    if (...)
    {
        for (...)
        {
            if (...)
            {
             <cursor here>   
        }
    }
}

(Notice the missing closing bracket). Currently, there is no easy way to insert a closing bracket at <cursor here>, as attempting to type a } will jump to the next bracket, rather than insert a new one. I've been unable to find anything in the documentation to deal with a situation like this.

Describe the solution you'd like
A new bracket is inserted rather than jump to the next bracket when there is a bracket mismatch (or perhaps a manual toggle if this is too computational expensive).

Describe alternatives you've considered
One way I've currently been dealing with this situation is by following the jumps to the end, in which case a new bracket would be inserted, and then moving the bracket up to the place where it should be. However, this is suboptimal, as it can become a hassle when nested very deeply.

Additional context
None.

Move `lh#map#*` and `lh#marker#*` to lh-vim-lib

The idea is to reduce dependency to lh-brackets from mu-template or lh-refactor.

This way those plugins can be used without necessarily using lh-brackets that define/impose mappings on brackets.

TODO: check how to import history from a few files from one project to the other.

Opt-out / Disable Default Mappings

The following mappings conflict with my existing mappings, and produce this warning text every time I start nvim.

I'd like to be able to turn them off with a global variable, similar to the other ones already present (g:cb_no_default_brackets, etc).

I believe they start here:
https://github.com/LucHermitte/lh-brackets/blob/master/plugin/bracketing.base.vim#L200

Warning: While defining nmap `<C-L><Ins>` to `<Plug>MarkersMark`: there already exists another mapping starting as `<C-L><Ins>` to `:tabnext <CR>`.
Warning: While defining vmap `<C-L><Ins>` to `<Plug>MarkersMark`: there already exists another mapping starting as `<C-L><Ins>` to `:tabnext <CR>`.
Warning: Cannot define nmap `<C-J>` to `<Plug>MarkersJumpF`: a previous global mapping on `<C-J>` was defined in /nix/store/kzmvis2xfahj8bdmi7r717drd0xq5n41-vimrc.
Warning: Cannot define vmap `<C-J>` to `<Plug>MarkersJumpF`: a previous global mapping on `<C-J>` was defined in /nix/store/kzmvis2xfahj8bdmi7r717drd0xq5n41-vimrc.
Warning: While defining nmap `<C-L><S-Del>` to `<Plug>MarkersJumpB`: there already exists another mapping starting as `<C-L><S-Del>` to `:tabnext <CR>`.
Warning: While defining vmap `<C-L><S-Del>` to `<Plug>MarkersJumpB`: there already exists another mapping starting as `<C-L><S-Del>` to `:tabnext <CR>`.
Warning: While defining nmap `<C-L>$` to `<Plug>MarkersCloseAllAndJumpToLast`: there already exists another mapping starting as `<C-L>$` to `:tabnext <CR>`.
Warning: While defining vmap `<C-L>$` to `<Plug>MarkersCloseAllAndJumpToLast`: there already exists another mapping starting as `<C-L>$` to `:tabnext <CR>`.
Warning: While defining nmap `<C-L><End>` to `<Plug>MarkersJumpOutside`: there already exists another mapping starting as `<C-L><End>` to `:tabnext <CR>`.
Warning: While defining smap `<C-L><End>` to `<Plug>MarkersJumpOutside`: there already exists another mapping starting as `<C-L><End>` to `:tabnext <CR>`.
Warning: While defining xmap `<C-L><End>` to `<Plug>MarkersJumpOutside`: there already exists another mapping starting as `<C-L><End>` to `:tabnext <CR>`.

lh-brackets won't work in nvim

Describe the bug
A clear and concise description of what the bug is.
After installing these two plugins, an error message popped up which prevented the plugin to work properly.

vim/_editor.lua:0: /Users/at8i/.config/nvim/init.lua..nvim_exec2() called at /Users/at8i/.config/nvim/init.lua:0../Users/at8i/.local/share/nvim/lazy/lh-brackets/plugin/bracketing.base.vim[196]..
function lh#mapping#plug[33]..
<SNR>20_callsite[1]..lh#exception#get_callstack[4]..lh#exception#decode[2]
..lh#exception#callstack[61]..lh#askvim#where_is_function_defined[13]..lh#askvim#execute, line 1: Vim(function):E123: Undefined function: 0

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - ~/.config/nvim/init.lua:19

And also when I press ", it prints out the following;

""<Plug>MarkersInsertMark

To Reproduce
Steps to reproduce the behavior:

  1. Go to your init file and install lh-brackets and lh-vim-lib
  2. Installing these two plugins using lazynvim plugin manger and setting lh-vim-lib as a dependency for lh-brackets
  3. Starting nvim with any file will cause the above error to pop out.

** Context (please complete the following information):**

  • nvim v0.9.0

Line inserted above current line with typing '('

Hi,

thank you for providing this plugin.

I wanted to try it with a C++ file and here is what happens:

  • I type void foo
  • when I type (, my line gets broken into two lines and I get
void
foo(|)«»

(| represent the cursor position).

How can I avoid this behavior and obtain

void foo(|)«»

?

Thanks for your help!

deprecated methods from lh-vim-lib

~/.vim/plugged/lh-brackets/after/ftplugin/c/c_brackets.vim:98
~/.vim/plugged/lh-brackets/plugin/common_brackets.vim:199

fix plz
change #dev# to #ft#

Disable normal mode default bracket mappings

I want to use the default vim key mappings in normal mode.
But I cannot find a way to disable only some specific keymap ((, {).
Only way to disable them is to disable all default mapping (g:cb_no_default_brackets).
Is there a way to disable only some specific default keymap?

E705: Variable name conflicts with an existing function: Close

Обнаружена ошибка при обработке function lh#brackets#define[3]..209_DecodeDefineOptions:
строка 37:
E705: Имя переменной конфликтует с существующей функцией: Close


An error was encountered while processing function lh # brackets # define [3] .. 209_DecodeDefineOptions:
line 37:
E705: Variable name conflicts with an existing function: Close


I think conflict with ctrlp.vim plugin, when try open php files, maybe I'm wrong

After setting g:cb_no_default_brackets to 1, backspace goes to start of line

Describe the bug
After setting g:cb_no_default_brackets to 1, backspace in insert mode moves the cursor to start of line.

To Reproduce
Steps to reproduce the behavior:

  1. Put "let g:cb_no_default_brackets = 1" in vimrc, and reload
  2. Open any text file and move cursor to any text
  3. Press "i" to go to insert mode
  4. Press "Backspace"
  5. See error: the cursor goes to start of the line

Expected behavior
Backspace should remove a character.

Context

  • VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan 6 2019 22:28:49), Included patches: 1-700 macOS version, Compiled by Homebrew
  • NVIM v0.3.4

Additional context
vimrc:

if has('nvim')
    set runtimepath^=~/.vim runtimepath+=~/.vim/after
    let &packpath = &runtimepath
endif

set nocompatible
filetype off
syntax on
filetype plugin indent on
set modelines=0
set number
set ruler
set backspace=eol,start,indent

call plug#begin('~/.vim/plugged')
Plug 'LucHermitte/lh-vim-lib' | Plug 'LucHermitte/lh-brackets'
call plug#end()

let g:cb_no_default_brackets = 1

It's unclear how to jump to placeholders

The placeholders that get inserted by lh-brackets after typing brackets characters seem to not work in the way they're supposed to.
I can't find any shortcuts to jump to a placeholder, nor do they get deleted when I go from insert mode to normal mode. So for me the placeholder characters don't seem to do anything and only get in the way.
There isn't a lot of documentation that can help me with this.
So my question is: How are you supposed to work with these placeholder characters?

Neovim bug with lh-brackets

Describe the bug
I am switching to neovim.
I don't know it your plugins are supposed to be working with neovim or not. If ther are , then this is a bug. if not you can close the issue. Thanks for the Plugins it made working in vim much easier.
******** This is not a bug in vim but in neovim *************
To Reproduce
Steps to reproduce the behavior:

  1. After installing lh-refactor thus installing lh-brackets
  2. If you open any .cpp or . tex file and write anything and press enter in insert mode (I tried with .cpp and .tex files not sure about the others)
  3. It writes a function from lh-brackets
  4. The function is : lh#mapping#_switch('''
    ''', [{'action': 'lh#brackets#_add_newline_between_brackets()', 'condition': 'getline(".")[col(".")-2:col(".")-1]=="{}"'}])

Expected behavior
I did not want anything to happen. It was supposed to go to next line. If I remove the bracket plugin, the refactor is actually working at least for getters and setters.

Context

  • NeoVim v0.05.0-dev
  • I have lots of plugins installed but they all work just fine in vim 8.1

Additional context
The only Plugin that I use in neovim and I don't have it in vim is coc.vim which might be causing some problems.
If you think that it is a problem from neovim, I will open an issue there as well.

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.