name-assign

所属分类:数值算法/人工智能
开发工具:Vim Script
文件大小:0KB
下载次数:0
上传日期:2020-06-03 05:18:24
上 传 者sh-1993
说明:  Vim插件,在任何编程语言中自动用分配的变量替换表达式
(Vim plugin to automate replacing expressions with assigned variables in any programming language)

文件列表:
autoload/
doc/
plugin/
LICENSE

# name-assign.vim ## Short introduction This repository provides a Vim plugin to automate replacing expressions with assigned variables in multiple programming language. An animated Gif is worth a 1,000 words: ## Description In many programming languages, a common editing operation is to move subexpressions out of a nested expression into their own assigned names. To illustrate, suppose we want to transform the following: ```c call_func(some_code, some_complex_and_long_expression); ``` Into the following: ```c let var = some_complex_and_long_expression; ... call_func(some_code, var); ``` There can be any amount of lines between the top expression and the variable assignment. The plugin supports the following languages: Rust, C, C++, Go, VimScript, JavaScript, TypeScript, Python, LISP, Scheme, Racket, Clojure, Erlang, Elixir, Haskell and PureScript. ## Usage instructions First, note that the default kbd combination is Alt - =, and it is bound in visual mode. Each usage has four steps: * Mark the expression to replace with a visual selection. * Hit the key combination, pick the name of the expression. * Now in 'placement mode', move the assignment expression with Up or Down, or using k or j. * End placing the assignment with Esc or Return. ### Overriding mappings The trigger to activate can be set to a different key: ```viml vmap b NameAssign ``` It is also possible to override mappings done for the placement mode to different keys, for example: ```viml let g:name_assign_mode_maps = { "up" : ["n"], "down" : ["N"] } ``` These mappings are temporary and buffer local, so they will not affect any global mappings for the specified keys. Here's the full list of actions: * `up` : For moving the placement up * `down` : For moving the placement down * `settle` : For ending placement ## To Do * Extend support to more languages. * Allow to customize the content of the `@` register after the operation. Currently it will contain the entered name. * Don't liter the undo history too much with the movement, or try to rely on [vim-schlepp](https://github.com/zirrostig/vim-schlepp) that probably does it better.

近期下载者

相关文件


收藏者