28 changed files with 1575 additions and 98 deletions
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
~ |
||||
.. |
||||
.- |
||||
su |
||||
ls |
||||
cd |
||||
g st |
||||
g ls |
||||
g lf |
||||
g lu |
||||
g u |
||||
g p |
||||
g add . |
||||
mc |
||||
mutt |
||||
,w,w |
||||
,ww |
||||
startx |
||||
geeqie . |
||||
,m |
||||
:q |
||||
shutdown -h now |
||||
./Downloads/ |
||||
killall zathura |
||||
kz |
||||
dus |
||||
dus . |
||||
dus * |
||||
mpd |
||||
reload |
||||
easytag . |
||||
alsamixer |
||||
vifm |
||||
htop |
||||
vim |
||||
ping ya.ru |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
startx |
||||
.shellrc/ |
||||
dus |
||||
alsamixer |
||||
,ww |
||||
ping ya.ru |
||||
,w,w |
||||
htop |
||||
g url |
||||
g df . |
||||
g p |
||||
g u |
||||
vifm |
||||
hstr |
||||
dus * |
||||
dus . |
||||
vim |
||||
docker ps |
||||
make |
||||
mpd |
||||
.shellrc |
||||
g lf |
||||
g st |
||||
g lu |
||||
g ls |
||||
docker images |
||||
,m |
||||
.. |
||||
.- |
||||
g add . |
||||
~ |
||||
reload |
||||
:q |
||||
g u | sh |
||||
geeqie . |
||||
mutt |
||||
g df |
||||
easytag . |
||||
./Downloads/ |
||||
cd |
||||
hh |
||||
kz |
||||
mc |
||||
ls |
||||
g st . |
||||
su |
||||
shutdown -h now |
Binary file not shown.
@ -0,0 +1,210 @@
@@ -0,0 +1,210 @@
|
||||
{ |
||||
"parserOptions": { |
||||
"ecmaVersion": 2020, |
||||
"ecmaFeatures": { |
||||
"jsx": true |
||||
}, |
||||
"sourceType": "module" |
||||
}, |
||||
|
||||
"env": { |
||||
"es6": true, |
||||
"node": true |
||||
}, |
||||
|
||||
"globals": { |
||||
"document": "readonly", |
||||
"navigator": "readonly", |
||||
"window": "readonly" |
||||
}, |
||||
|
||||
"rules": { |
||||
"accessor-pairs": "error", |
||||
"array-bracket-spacing": ["error", "never"], |
||||
"arrow-spacing": ["error", { "before": true, "after": true }], |
||||
"block-spacing": ["error", "always"], |
||||
"brace-style": ["error", "1tbs", { "allowSingleLine": true }], |
||||
"camelcase": ["off", { "properties": "never" }], |
||||
"comma-dangle": ["error", { |
||||
"arrays": "never", |
||||
"objects": "never", |
||||
"imports": "never", |
||||
"exports": "never", |
||||
"functions": "never" |
||||
}], |
||||
"comma-spacing": ["error", { "before": false, "after": true }], |
||||
"comma-style": ["error", "last"], |
||||
"computed-property-spacing": ["error", "never"], |
||||
"constructor-super": "error", |
||||
"curly": ["error", "multi-line"], |
||||
"dot-location": ["error", "property"], |
||||
"dot-notation": ["error", { "allowKeywords": true }], |
||||
"eol-last": "error", |
||||
"eqeqeq": ["error", "always", { "null": "ignore" }], |
||||
"func-call-spacing": ["error", "never"], |
||||
"generator-star-spacing": ["error", { "before": true, "after": true }], |
||||
"handle-callback-err": ["error", "^(err|error)$" ], |
||||
"indent": ["off", 2, { |
||||
"SwitchCase": 1, |
||||
"VariableDeclarator": 1, |
||||
"outerIIFEBody": 1, |
||||
"MemberExpression": 1, |
||||
"FunctionDeclaration": { "parameters": 1, "body": 1 }, |
||||
"FunctionExpression": { "parameters": 1, "body": 1 }, |
||||
"CallExpression": { "arguments": 1 }, |
||||
"ArrayExpression": 1, |
||||
"ObjectExpression": 1, |
||||
"ImportDeclaration": 1, |
||||
"flatTernaryExpressions": false, |
||||
"ignoreComments": false, |
||||
"ignoredNodes": ["TemplateLiteral *"] |
||||
}], |
||||
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }], |
||||
"keyword-spacing": ["error", { "before": true, "after": true }], |
||||
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], |
||||
"new-cap": ["error", { "newIsCap": true, "capIsNew": false, "properties": true }], |
||||
"new-parens": "error", |
||||
"no-array-constructor": "error", |
||||
"no-async-promise-executor": "error", |
||||
"no-caller": "error", |
||||
"no-case-declarations": "error", |
||||
"no-class-assign": "error", |
||||
"no-compare-neg-zero": "error", |
||||
"no-cond-assign": "error", |
||||
"no-const-assign": "error", |
||||
"no-constant-condition": ["error", { "checkLoops": false }], |
||||
"no-control-regex": "error", |
||||
"no-debugger": "error", |
||||
"no-delete-var": "error", |
||||
"no-dupe-args": "error", |
||||
"no-dupe-class-members": "error", |
||||
"no-dupe-keys": "error", |
||||
"no-duplicate-case": "error", |
||||
"no-empty-character-class": "error", |
||||
"no-empty-pattern": "error", |
||||
"no-eval": "error", |
||||
"no-ex-assign": "error", |
||||
"no-extend-native": "error", |
||||
"no-extra-bind": "error", |
||||
"no-extra-boolean-cast": "error", |
||||
"no-extra-parens": ["error", "functions"], |
||||
"no-fallthrough": "error", |
||||
"no-floating-decimal": "error", |
||||
"no-func-assign": "error", |
||||
"no-global-assign": "error", |
||||
"no-implied-eval": "error", |
||||
"no-inner-declarations": ["error", "functions"], |
||||
"no-invalid-regexp": "error", |
||||
"no-irregular-whitespace": "error", |
||||
"no-iterator": "error", |
||||
"no-labels": ["error", { "allowLoop": false, "allowSwitch": false }], |
||||
"no-lone-blocks": "error", |
||||
"no-misleading-character-class": "error", |
||||
"no-prototype-builtins": "error", |
||||
"no-useless-catch": "error", |
||||
"no-mixed-operators": ["error", { |
||||
"groups": [ |
||||
["==", "!=", "===", "!==", ">", ">=", "<", "<="], |
||||
["&&", "||"], |
||||
["in", "instanceof"] |
||||
], |
||||
"allowSamePrecedence": true |
||||
}], |
||||
"no-mixed-spaces-and-tabs": "error", |
||||
"no-multi-spaces": "off", |
||||
"no-multi-str": "off", |
||||
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }], |
||||
"no-negated-in-lhs": "error", |
||||
"no-new": "error", |
||||
"no-new-func": "error", |
||||
"no-new-object": "error", |
||||
"no-new-require": "error", |
||||
"no-new-symbol": "error", |
||||
"no-new-wrappers": "error", |
||||
"no-obj-calls": "error", |
||||
"no-octal": "error", |
||||
"no-octal-escape": "error", |
||||
"no-path-concat": "error", |
||||
"no-proto": "error", |
||||
"no-redeclare": ["error", { "builtinGlobals": false }], |
||||
"no-regex-spaces": "error", |
||||
"no-return-assign": ["error", "except-parens"], |
||||
"no-return-await": "error", |
||||
"no-self-assign": ["error", { "props": true }], |
||||
"no-self-compare": "error", |
||||
"no-sequences": "error", |
||||
"no-shadow-restricted-names": "error", |
||||
"no-sparse-arrays": "error", |
||||
"no-tabs": "off", |
||||
"no-template-curly-in-string": "error", |
||||
"no-this-before-super": "error", |
||||
"no-throw-literal": "error", |
||||
"no-trailing-spaces": "error", |
||||
"no-undef": "error", |
||||
"no-undef-init": "error", |
||||
"no-unexpected-multiline": "error", |
||||
"no-unmodified-loop-condition": "error", |
||||
"no-unneeded-ternary": ["error", { "defaultAssignment": false }], |
||||
"no-unreachable": "error", |
||||
"no-unsafe-finally": "error", |
||||
"no-unsafe-negation": "error", |
||||
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true, "allowTaggedTemplates": true }], |
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }], |
||||
"no-use-before-define": ["error", { "functions": false, "classes": false, "variables": false }], |
||||
"no-useless-call": "error", |
||||
"no-useless-computed-key": "error", |
||||
"no-useless-constructor": "error", |
||||
"no-useless-escape": "error", |
||||
"no-useless-rename": "error", |
||||
"no-useless-return": "error", |
||||
"no-void": "error", |
||||
"no-whitespace-before-property": "error", |
||||
"no-with": "error", |
||||
"object-curly-newline": ["error", { "multiline": true, "consistent": true }], |
||||
"object-curly-spacing": ["error", "always"], |
||||
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }], |
||||
"one-var": ["error", { "initialized": "never" }], |
||||
"operator-linebreak": ["off", "after", { "overrides": { "?": "before", ":": "before", "|>": "before" } }], |
||||
"padded-blocks": ["error", { "blocks": "never", "switches": "never", "classes": "never" }], |
||||
"prefer-const": ["error", {"destructuring": "all"}], |
||||
"prefer-promise-reject-errors": "error", |
||||
"quote-props": ["error", "as-needed"], |
||||
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": false }], |
||||
"rest-spread-spacing": ["error", "never"], |
||||
"semi": ["off", "never"], |
||||
"semi-spacing": ["error", { "before": false, "after": true }], |
||||
"space-before-blocks": ["error", "always"], |
||||
"space-before-function-paren": ["off", "always"], |
||||
"space-in-parens": ["error", "never"], |
||||
"space-infix-ops": "error", |
||||
"space-unary-ops": ["error", { "words": true, "nonwords": false }], |
||||
"spaced-comment": ["error", "always", { |
||||
"line": { "markers": ["*package", "!", "/", ",", "="] }, |
||||
"block": { "balanced": true, "markers": ["*package", "!", ",", ":", "::", "flow-include"], "exceptions": ["*"] } |
||||
}], |
||||
"symbol-description": "error", |
||||
"template-curly-spacing": ["error", "never"], |
||||
"template-tag-spacing": ["error", "never"], |
||||
"unicode-bom": ["error", "never"], |
||||
"use-isnan": "error", |
||||
"valid-typeof": ["error", { "requireStringLiterals": true }], |
||||
"wrap-iife": ["error", "any", { "functionPrototypeMethods": true }], |
||||
"yield-star-spacing": ["error", "both"], |
||||
"yoda": ["error", "never"], |
||||
|
||||
"import/export": "off", |
||||
"import/first": "off", |
||||
"import/no-absolute-path": ["off", { "esmodule": true, "commonjs": true, "amd": false }], |
||||
"import/no-duplicates": "off", |
||||
"import/no-named-default": "off", |
||||
"import/no-webpack-loader-syntax": "off", |
||||
|
||||
"node/no-deprecated-api": "off", |
||||
"node/process-exit-as-throw": "off", |
||||
|
||||
"promise/param-names": "off", |
||||
|
||||
"standard/no-callback-literal": "off" |
||||
} |
||||
} |
||||
|
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
# Cheat40: a cheat sheet for Vim |
||||
|
||||
Cheat40 is a foldable extensible 40-column cheat sheet that you may open in Vim |
||||
by pressing `<leader>?` (the mapping is customizable, of course). Mappings and |
||||
commands are organized like the menus of a GUI app: there is a File section, an |
||||
Edit section, a View section, and so on. For each item the description comes |
||||
first, because one typically wants to find how to execute a task, not what the |
||||
meaning of a key sequence is (there is Vim's help for that). Syntax coloring and |
||||
the use of `conceal` keep the cheat sheet clutter-free and easy to read. |
||||
|
||||
|
||||
## Installation |
||||
|
||||
If your Vim supports packages (`echo has('packages')` prints `1`), I strongly |
||||
recommend that you use them. Just clone this repo inside `pack/*/start`, e.g., |
||||
|
||||
cd ~/.vim |
||||
git clone https://github.com/lifepillar/vim-cheat40.git pack/bundle/start/cheat40 |
||||
|
||||
Otherwise, use your preferred installation method. |
||||
|
||||
|
||||
## Extending the cheat sheet |
||||
|
||||
You may extend the cheat sheet by putting one or more files called `cheat40.txt` |
||||
anywhere in your `runtimepath` (e.g., in `~/.vim`). Cheat40 searches |
||||
`runtimepath` for such files and concatenates their content. This allows plugin |
||||
developers to provide a cheat sheet for their plugins by putting a `cheat40.txt` |
||||
file in the top folder of their plugins. |
||||
|
||||
If you do not want to use the default cheat sheet that comes with this plugin, |
||||
set the following variable in your `.vimrc`: |
||||
|
||||
let g:cheat40_use_default = 0 |
||||
|
||||
In this case, I recommend that you copy `cheat40.txt` into your `.vim` folder |
||||
and modify it to suit your needs. |
||||
|
||||
The syntax of a cheat sheet is very simple: |
||||
|
||||
- foldable sections use Vim's default markers (`{{{` and `}}}`) (see `:h |
||||
fold-marker`); |
||||
- sections of the form `About … {{{ … }}}` are interpreted as block comments; |
||||
- lines starting with a `#` are interpreted as line comments; |
||||
- each line, except for comments and section markers, should be 40 columns wide |
||||
(comments and section markers may be shorter than that); |
||||
- each item consists of a description, a key sequence, and a label; |
||||
- the description must fit in columns 1–25 (long descriptions may be split into |
||||
several lines); |
||||
- the key sequence and the label must fit in columns 26–40 (long key sequences |
||||
should be split into several lines); |
||||
- the label is a right-justified sequence of one or more characters (e.g., `N` |
||||
for Normal mode, `I` for Insert mode, and so on). |
||||
|
||||
See the cheat sheet inside the plugin for the details. |
||||
|
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
" Author: Lifepillar |
||||
" Maintainer: Lifepillar |
||||
" License: Distributed under the same terms as Vim itself. See :help license. |
||||
|
||||
let s:cheat40_dir = fnamemodify(resolve(expand('<sfile>:p')), ':h:h') |
||||
|
||||
" Courtesy of Pathogen |
||||
function! s:slash() abort |
||||
return !exists("+shellslash") || &shellslash ? '/' : '\' |
||||
endfunction |
||||
|
||||
|
||||
" Split a path into a list. Code from Pathogen. |
||||
function! s:split(path) abort |
||||
if type(a:path) == type([]) | return a:path | endif |
||||
if empty(a:path) | return [] | endif |
||||
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,') |
||||
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")') |
||||
endfunction |
||||
|
||||
fun! cheat40#open(newtab) |
||||
if a:newtab |
||||
tabnew +setlocal\ buftype=nofile\ bufhidden=hide\ nobuflisted\ noswapfile\ winfixwidth |
||||
else |
||||
botright 40vnew +setlocal\ buftype=nofile\ bufhidden=hide\ nobuflisted\ noswapfile\ winfixwidth |
||||
endif |
||||
if get(g:, 'cheat40_use_default', 1) |
||||
execute '$read' s:cheat40_dir.s:slash().'cheat40.txt' |
||||
endif |
||||
for glob in reverse(s:split(&runtimepath)) |
||||
for cs in filter(map(filter(split(glob(glob), "\n"), 'v:val !~ "cheat40"'), 'v:val.s:slash()."cheat40.txt"'), 'filereadable(v:val)') |
||||
execute "$read" cs |
||||
endfor |
||||
endfor |
||||
norm ggd_ |
||||
setlocal foldmethod=marker foldtext=substitute(getline(v:foldstart),'\\s\\+{{{.*$','','') |
||||
execute 'setlocal foldlevel='.get(g:, 'cheat40_foldlevel', 1) |
||||
setlocal concealcursor=nc conceallevel=3 |
||||
setlocal expandtab nonumber norelativenumber nospell nowrap textwidth=40 |
||||
setlocal fileencoding=utf-8 filetype=cheat40 nomodifiable |
||||
setlocal iskeyword=@,48-57,-,/,.,192-255 |
||||
execute "setlocal" "tags=".s:cheat40_dir.s:slash()."tags" |
||||
nnoremap <silent> <buffer> <tab> <c-w><c-p> |
||||
nnoremap <silent> <buffer> q <c-w><c-p>@=winnr("#")<cr><c-w>c |
||||
endf |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
" Author: Lifepillar |
||||
" Maintainer: Lifepillar |
||||
" License: Distributed under the same terms as Vim itself. See :help license. |
||||
|
||||
if exists("g:loaded_cheatsheet") || &cp || v:version < 700 |
||||
finish |
||||
endif |
||||
let g:loaded_cheatsheet = 1 |
||||
|
||||
command -bar -nargs=0 -bang Cheat40 call cheat40#open("<bang>" ==# '!') |
||||
|
||||
"if mapcheck("<leader>?", "n") == "" |
||||
"nmap <unique> <leader>? :<c-u>Cheat40<cr> |
||||
"endif |
||||
|
||||
nmap <leader>? :<c-u>Cheat40<cr> |
||||
|
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
" Author: Lifepillar |
||||
" Maintainer: Lifepillar |
||||
" License: Distributed under the same terms as Vim itself. See :help license. |
||||
|
||||
if exists("b:current_syntax") |
||||
finish |
||||
endif |
||||
|
||||
syntax case ignore |
||||
syntax sync fromstart |
||||
|
||||
syn match Cheat40Descr /\%1v.*\%<26v./ |
||||
syn match Cheat40Command /\%26v.*\%<41v./ contains=Cheat40Mode,Cheat40Angle,Cheat40DblAngle |
||||
syn match Cheat40Header /^.*{{{\d*$/ contains=Cheat40BeginSection |
||||
syn region Cheat40About start=/^About.*{{{\d*$/ end=/^}}}$/ keepend contains=Cheat40BeginSection,Cheat40EndSection,Cheat40Tag,Cheat40Angle,Cheat40DblAngle |
||||
syn match Cheat40FirstLine /\%1l.*/ |
||||
syn match Cheat40BeginSection /{{{\d*/ contained conceal |
||||
syn match Cheat40EndSection /^}}}$/ conceal |
||||
syn match Cheat40Tag /`[^` \t]\+`/hs=s+1,he=e-1 contained contains=Cheat40Backtick,Cheat40Runtime |
||||
syn match Cheat40Backtick /`/ contained conceal |
||||
syn match Cheat40Mode /[NICVTOM*]\+\%>40v/ |
||||
syn match Cheat40Angle /‹[^› \t]\+›/ contained |
||||
syn match Cheat40DblAngle /«[^» \t]\+»/ contained |
||||
syn match Cheat40Comment /^#.*$/ contains=Cheat40Hash |
||||
syn match Cheat40Hash /^#\s*/ contained conceal |
||||
syn match Cheat40Runtime /\$VIMRUNTIME\/doc\// contained conceal |
||||
|
||||
hi def link Cheat40Descr Normal |
||||
hi def link Cheat40Command Constant |
||||
hi def link Cheat40Header Title |
||||
hi def link Cheat40About Comment |
||||
hi def link Cheat40FirstLine Statement |
||||
hi def link Cheat40BeginSection Ignore |
||||
hi def link Cheat40EndSection Ignore |
||||
hi def link Cheat40Tag Tag |
||||
hi def link Cheat40Backtick Ignore |
||||
hi def link Cheat40Mode Type |
||||
hi def link Cheat40Angle Identifier |
||||
hi def link Cheat40DblAngle Label |
||||
hi def link Cheat40Comment Comment |
||||
hi def link Cheat40Hash Ignore |
||||
hi def link Cheat40Runtime Ignore |
||||
|
||||
let b:current_syntax = "cheat40" |
||||
|
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
MIT License |
||||
|
||||
Copyright (c) 2019 voldikss |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,127 @@
@@ -0,0 +1,127 @@
|
||||
# vim-floaterm |
||||
|
||||
[](https://travis-ci.org/voldikss/vim-floaterm) |
||||
|
||||
Use neovim terminal in the floating window. |
||||
|
||||
 |
||||
|
||||
## Installation |
||||
|
||||
- vim-plug |
||||
|
||||
```vim |
||||
Plug 'voldikss/vim-floaterm' |
||||
``` |
||||
|
||||
- dein.nvim |
||||
|
||||
```vim |
||||
call dein#add('voldikss/vim-floaterm') |
||||
``` |
||||
|
||||
## Keymaps |
||||
|
||||
This plugin doesn't supply any default mappings. |
||||
|
||||
```vim |
||||
""" Example configuration |
||||
let g:floaterm_keymap_new = '<F7>' |
||||
let g:floaterm_keymap_prev = '<F8>' |
||||
let g:floaterm_keymap_next = '<F9>' |
||||
let g:floaterm_keymap_toggle = '<F10>' |
||||
``` |
||||
|
||||
## Features |
||||
|
||||
- Toggle terminal window quickly |
||||
- Multiple terminal instances |
||||
- Customizable floating terminal style |
||||
- Switch/Preview floating terminal buffer using [vim-clap](https://github.com/liuchengxu/vim-clap)(try `:Clap floaterm`) |
||||
|
||||
## Configurations |
||||
|
||||
#### **`g:floaterm_type`** |
||||
|
||||
- Available: `'floating'`(neovim only), `'normal'`(vim8 and neovim) |
||||
|
||||
- Default: `'floating'` |
||||
|
||||
#### **`g:floaterm_width`** |
||||
|
||||
- Type: `int` (number of columns) or `float` (between 0 and 1). If `float`, the width is relative to `&columns`. |
||||
- Default: `0.6` |
||||
|
||||
#### **`g:floaterm_height`** |
||||
|
||||
- Type: `int` (number of lines) or `float` (between 0 and 1). If `float`, the height is relative to `&lines`. |
||||
- Default: `0.6` |
||||
|
||||
#### `g:floaterm_winblend` |
||||
|
||||
- Description: The opacity of the floating terminal |
||||
|
||||
- Default: `0` |
||||
|
||||
#### **`g:floaterm_position`** |
||||
|
||||
- Available: `'center'`, `'topleft'`, `'topright'`, `'bottomleft'`, `'bottomright'`, `'auto'(at the cursor place)` |
||||
|
||||
- Default: `'center'` |
||||
|
||||
#### **`g:floaterm_background`** |
||||
|
||||
- Type: string(e.g. `'#000000'`, `'black'`) |
||||
|
||||
- Default: background color of normal floating window |
||||
|
||||
#### **`g:floaterm_borderchars`** |
||||
|
||||
- Default: `['─', '│', '─', '│', '┌', '┐', '┘', '└']` |
||||
|
||||
#### **`g:floaterm_border_color`** |
||||
|
||||
- Type: string(e.g. `'#FFFFFF'`, `'blue'`) |
||||
|
||||
- Default: foreground color of normal floating window |
||||
|
||||
## Commands |
||||
|
||||
- `:FloatermNew` |
||||
|
||||
- `:FloatermToggle` |
||||
|
||||
- `:FloatermPrev` |
||||
|
||||
- `:FloatermNext` |
||||
|
||||
## Q & A |
||||
|
||||
- #### This plugin leaves an empty buffer on startify window |
||||
|
||||
Put this code in `vimrc` |
||||
|
||||
```vim |
||||
autocmd User Startified setlocal buflisted |
||||
``` |
||||
|
||||
- #### I want to use another shell in the terminal. (e.g. Use fish instead of bash) |
||||
|
||||
Set `shell` option in your `vimrc`: |
||||
|
||||
```vim |
||||
set shell=/path/to/shell |
||||
``` |
||||
|
||||
- #### I would like to customize the style of the floating terminal window |
||||
|
||||
Use `autocmd`. For example |
||||
|
||||
```vim |
||||
function s:floatermSettings() |
||||
setlocal number |
||||
" more settings |
||||
endfunction |
||||
|
||||
autocmd FileType floaterm call s:floatermSettings() |
||||
``` |
@ -0,0 +1,323 @@
@@ -0,0 +1,323 @@
|
||||
" ============================================================================ |
||||
" FileName: autocmd/floaterm.vim |
||||
" Description: |
||||
" Author: voldikss <dyzplus@gmail.com> |
||||
" GitHub: https://github.com/voldikss |
||||
" ============================================================================ |
||||
|
||||
" `hidden` option must be set, otherwise the floating terminal would be wiped |
||||
" out, see #17 |
||||
set hidden |
||||
|
||||
" Note: |
||||
" The data structure of the floaterm chain is a double circular linkedlist |
||||
" g:floaterm.count is the count of the terminal node |
||||
" g:floaterm.index is the pointer |
||||
" g:floaterm.head is the HEAD node which only have 'prev' and 'next' |
||||
" g:floaterm_node is the node prototype to create a terminal node |
||||
let g:floaterm = {} |
||||
let g:floaterm.count = 0 |
||||
let g:floaterm.head = {} |
||||
let g:floaterm.head.next = g:floaterm.head |
||||
let g:floaterm.head.prev = g:floaterm.head |
||||
let g:floaterm.index = g:floaterm.head |
||||
|
||||
let g:floaterm_node = { |
||||
\ 'bufnr': 0, |
||||
\ 'border_bufnr': 0, |
||||
\ 'next': v:null, |
||||
\ 'prev': v:null |
||||
\ } |
||||
|
||||
if g:floaterm_border_color == v:null |
||||
let g:floaterm_border_color = floaterm#util#get_normalfloat_fg() |
||||
endif |
||||
|
||||
if g:floaterm_background == v:null |
||||
let g:floaterm_background = floaterm#util#get_normalfloat_bg() |
||||
endif |
||||
|
||||
" Remove a node if it was closed(the buffer doesn't exist) |
||||
function! g:floaterm.kickout() dict abort |
||||
if self.count == 0 | return | endif |
||||
let self.index.prev.next = self.index.next |
||||
let self.index.next.prev = self.index.prev |
||||
let self.count -= 1 |
||||
endfunction |
||||
|
||||
function! g:floaterm.toggle() dict abort |
||||
let found_winnr = self.find_term_win() |
||||
if found_winnr > 0 |
||||
if &buftype ==# 'terminal' |
||||
execute found_winnr . ' wincmd q' |
||||
else |
||||
execute found_winnr . ' wincmd w | startinsert' |
||||
endif |
||||
else |
||||
while v:true |
||||
if self.count == 0 |
||||
call self.open(0) |
||||
return |
||||
endif |
||||
" If the current node is HEAD(which doesn't have 'bufnr' key), |
||||
" skip and point to the node after HEAD |
||||
if self.index == self.head |
||||
let self.index = self.head.next |
||||
endif |
||||
let found_bufnr = self.index.bufnr |
||||
if found_bufnr != 0 && bufexists(found_bufnr) |
||||
call self.open(found_bufnr) |
||||
return |
||||
else |
||||
call self.kickout() |
||||
let self.index = self.index.next |
||||
endif |
||||
endwhile |
||||
endif |
||||
endfunction |
||||
|
||||
function! g:floaterm.new() dict abort |
||||
call self.hide() |
||||
call self.open(0) |
||||
endfunction |
||||
|
||||
function! g:floaterm.next() dict abort |
||||
call self.hide() |
||||
while v:true |
||||
if self.count == 0 |
||||
call floaterm#util#show_msg('No more terminal buffers', 'warning') |
||||
return |
||||
endif |
||||
" If the current node is the end node(whose next node is HEAD), |
||||
" skip and point to the HEAD's next node |
||||
if self.index.next == self.head |
||||
let self.index = self.head.next |
||||
else |
||||
let self.index = self.index.next |
||||
endif |
||||
let next_bufnr = self.index.bufnr |
||||
if next_bufnr != 0 && bufexists(next_bufnr) |
||||
call self.open(next_bufnr) |
||||
return |
||||
else |
||||
call self.kickout() |
||||
endif |
||||
endwhile |
||||
endfunction |
||||
|
||||
function! g:floaterm.prev() dict abort |
||||
call self.hide() |
||||
while v:true |
||||
if self.count == 0 |
||||
call floaterm#util#show_msg('No more terminal buffers', 'warning') |
||||
return |
||||
endif |
||||
" If the current node is the node after HEAD(whose previous node is HEAD), |
||||
" skip and point to the HEAD's prev node(the end node) |
||||
if self.index.prev == self.head |
||||
let self.index = self.head.prev |
||||
else |
||||
let self.index = self.index.prev |
||||
endif |
||||
let prev_bufnr = self.index.bufnr |
||||
if prev_bufnr != 0 && bufexists(prev_bufnr) |
||||
call self.open(prev_bufnr) |
||||
return |
||||
else |
||||
call self.kickout() |
||||
endif |
||||
endwhile |
||||
endfunction |
||||
|
||||
" Hide the current terminal before opening another terminal window |
||||
" Therefore, you cannot have two terminals displayed at once |
||||
function! g:floaterm.hide() dict abort |
||||
while v:true |
||||
let found_winnr = self.find_term_win() |
||||
if found_winnr > 0 |
||||
execute found_winnr . ' wincmd q' |
||||
else |
||||
break |
||||
endif |
||||
endwhile |
||||
endfunction |
||||
|
||||
" Find if there is a terminal among all opened windows |
||||
" If found, hide it or jump into it |
||||
function! g:floaterm.find_term_win() abort |
||||
let found_winnr = 0 |
||||
for winnr in range(1, winnr('$')) |
||||
if getbufvar(winbufnr(winnr), '&filetype') ==# 'floaterm' |
||||
let found_winnr = winnr |
||||
endif |
||||
endfor |
||||
return found_winnr |
||||
endfunction |
||||
|
||||
function! g:floaterm.open(found_bufnr) dict abort |
||||
let height = g:floaterm_height == v:null ? 0.6 : g:floaterm_height |
||||
if type(height) == v:t_float | let height = height * &lines | endif |
||||
let height = float2nr(height) |
||||
|
||||
let width = g:floaterm_width == v:null ? 0.6 : g:floaterm_width |
||||
if type(width) == v:t_float | let width = width * &columns | endif |
||||
let width = float2nr(width) |
||||
|
||||
if g:floaterm_type ==# 'floating' |
||||
let [bufnr, border_bufnr] = s:open_floating_terminal(a:found_bufnr, height, width) |
||||
else |
||||
let bufnr = s:open_floating_normaml(a:found_bufnr, height, width) |
||||
let border_bufnr = 0 |
||||
endif |
||||
if bufnr != 0 |
||||
" Build a terminal node |
||||
let node = deepcopy(g:floaterm_node) |
||||
let node.bufnr = bufnr |
||||
let node.prev = self.index |
||||
let node.next = self.index.next |
||||
" If current node is the end node, let HEAD's prev point to the new node |
||||
if self.index.next == self.head |
||||
let self.head.prev = node |
||||
endif |
||||
let self.index.next = node |
||||
let self.index = self.index.next |
||||
let self.count += 1 |
||||
endif |
||||
if border_bufnr != 0 |
||||
let self.index.border_bufnr = border_bufnr |
||||
endif |
||||
call s:on_open() |
||||
endfunction |
||||
|
||||
function! s:on_open() abort |
||||
setlocal cursorline |
||||
setlocal filetype=floaterm |
||||
|
||||
" Find the true background(not 'hi link') for floating |
||||
if has('nvim') |
||||
execute 'setlocal winblend=' . g:floaterm_winblend |
||||
execute 'hi FloatTermNormal term=NONE guibg='. g:floaterm_background |
||||
setlocal winhighlight=NormalFloat:FloatTermNormal,FoldColumn:FloatTermNormal |
||||
|
||||
augroup close_floaterm_window |
||||
autocmd! |
||||
autocmd TermClose <buffer> if &filetype ==# 'floaterm' | |
||||
\ bdelete! | |
||||
\ endif |
||||
autocmd TermClose,BufHidden <buffer> if exists('g:floaterm.index.border_bufnr') |
||||
\ && bufexists(g:floaterm.index.border_bufnr) |
||||
\ && g:floaterm.index.border_bufnr != 0 | |
||||
\ execute 'bw ' . g:floaterm.index.border_bufnr | |
||||
\ endif |
||||
augroup END |
||||
endif |
||||
|
||||
startinsert |
||||
endfunction |
||||
|
||||
function! s:open_floating_terminal(found_bufnr, height, width) abort |
||||
let [row, col, vert, hor] = floaterm#util#floating_win_pos(a:width, a:height) |
||||
|
||||
let border_opts = { |
||||
\ 'relative': 'editor', |
||||
\ 'anchor': vert . hor, |
||||
\ 'row': row, |
||||
\ 'col': col, |
||||
\ 'width': a:width + 2, |
||||
\ 'height': a:height + 2, |
||||
\ 'style':'minimal' |
||||
\ } |
||||
let top = g:floaterm_borderchars[4] . |
||||
\ repeat(g:floaterm_borderchars[0], a:width) . |
||||
\ g:floaterm_borderchars[5] |
||||
let mid = g:floaterm_borderchars[3] . |
||||
\ repeat(' ', a:width) . |
||||
\ g:floaterm_borderchars[1] |
||||
let bot = g:floaterm_borderchars[7] . |
||||
\ repeat(g:floaterm_borderchars[2], a:width) . |
||||
\ g:floaterm_borderchars[6] |
||||
let lines = [top] + repeat([mid], a:height) + [bot] |
||||
let border_bufnr = nvim_create_buf(v:false, v:true) |
||||
call nvim_buf_set_option(border_bufnr, 'synmaxcol', 3000) " #27 |
||||
call nvim_buf_set_lines(border_bufnr, 0, -1, v:true, lines) |
||||
call nvim_open_win(border_bufnr, v:false, border_opts) |
||||
" Floating window border highlight |
||||
augroup floaterm_border_highlight |
||||
autocmd! |
||||
autocmd FileType floaterm_border ++once execute printf( |
||||
\ 'syn match Border /.*/ | hi Border guibg=%s guifg=%s', |
||||
\ g:floaterm_background, |
||||
\ g:floaterm_border_color |
||||
\ ) |
||||
augroup END |
||||
call nvim_buf_set_option(border_bufnr, 'filetype', 'floaterm_border') |
||||
|
||||
"" |
||||
" TODO: |
||||
" Use 'relative': 'cursor' for the border window |
||||
" Use 'relative':'win'(which behaviors not as expected...) for content window |
||||
let opts = { |
||||
\ 'relative': 'editor', |
||||
\ 'anchor': vert . hor, |
||||
\ 'row': row + (vert ==# 'N' ? 1 : -1), |
||||
\ 'col': col + (hor ==# 'W' ? 1 : -1), |
||||
\ 'width': a:width, |
||||
\ 'height': a:height, |
||||
\ 'style':'minimal' |
||||
\ } |
||||
|
||||
if a:found_bufnr > 0 |
||||
call nvim_open_win(a:found_bufnr, v:true, opts) |
||||
return [0, border_bufnr] |
||||
else |
||||
let bufnr = nvim_create_buf(v:false, v:true) |
||||
call nvim_open_win(bufnr, v:true, opts) |
||||
terminal |
||||
return [bufnr, border_bufnr] |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:open_floating_normaml(found_bufnr, height, width) abort |
||||
if a:found_bufnr > 0 |
||||
if &lines > 30 |
||||
execute 'botright ' . a:height . 'split' |
||||
execute 'buffer ' . a:found_bufnr |
||||
else |
||||
botright split |
||||
execute 'buffer ' . a:found_bufnr |
||||
endif |
||||
return |
||||
else |
||||
if &lines > 30 |
||||
if has('nvim') |
||||
execute 'botright ' . a:height . 'split term://' . &shell |
||||
else |
||||
botright terminal |
||||
resize a:height |
||||
endif |
||||
else |
||||
if has('nvim') |
||||
execute 'botright split term://' . &shell |
||||
else |
||||
botright terminal |
||||
endif |
||||
endif |
||||
return bufnr('%') |
||||
endif |
||||
endfunction |
||||
|
||||
function! floaterm#start(action) abort |
||||
if !floaterm#util#is_floaterm_available() |
||||
return |
||||
endif |
||||
|
||||
if a:action ==# 'new' |
||||
call g:floaterm.new() |
||||
elseif a:action ==# 'next' |
||||
call g:floaterm.next() |
||||
elseif a:action ==# 'prev' |
||||
call g:floaterm.prev() |
||||
elseif a:action ==# 'toggle' |
||||
call g:floaterm.toggle() |
||||
endif |
||||
endfunction |
@ -0,0 +1,149 @@
@@ -0,0 +1,149 @@
|
||||
" ============================================================================ |
||||
" FileName: autoload/floaterm/util.vim |
||||
" Description: |
||||
" Author: voldikss <dyzplus@gmail.com> |
||||
" GitHub: https://github.com/voldikss |
||||
" ============================================================================ |
||||
|
||||
function! floaterm#util#floating_win_pos(width, height) abort |
||||
if g:floaterm_position ==# 'topright' |
||||
let row = 0 |
||||
let col = &columns |
||||
let vert = 'N' |
||||
let hor = 'E' |
||||
elseif g:floaterm_position ==# 'topleft' |
||||
let row = 0 |
||||
let col = 0 |
||||
let vert = 'N' |
||||
let hor = 'W' |
||||
elseif g:floaterm_position ==# 'bottomright' |
||||
let row = &lines |
||||
let col = &columns |
||||
let vert = 'S' |
||||
let hor = 'E' |
||||
elseif g:floaterm_position ==# 'bottomleft' |
||||
let row = &lines |
||||
let col = 0 |
||||
let vert = 'S' |
||||
let hor = 'W' |
||||
elseif g:floaterm_position ==# 'center' |
||||
let row = (&lines - a:height)/2 |
||||
let col = (&columns - a:width)/2 |
||||
let vert = 'N' |
||||
let hor = 'W' |
||||
|
||||
if row < 0 |
||||
let row = 0 |
||||
endif |
||||
if col < 0 |
||||
let col = 0 |
||||
endif |
||||
else " at the cursor place |
||||
let curr_pos = getpos('.') |
||||
let row = curr_pos[1] - line('w0') |
||||
let col = curr_pos[2] |
||||
|
||||
if row + a:height <= &lines |
||||
let vert = 'N' |
||||
else |
||||
let vert = 'S' |
||||
endif |
||||
|
||||
if col + a:width <= &columns |
||||
let hor = 'W' |
||||
else |
||||
let hor = 'E' |
||||
endif |
||||
endif |
||||
|
||||
return [row, col, vert, hor] |
||||
endfunction |
||||
|
||||
function! floaterm#util#is_floaterm_available() abort |
||||
if exists('*nvim_win_set_config') |
||||
if g:floaterm_type == v:null |
||||
let g:floaterm_type = 'floating' |
||||
endif |
||||
elseif has('terminal') |
||||
let g:floaterm_type = 'normal' |
||||
else |
||||
let message = 'Terminal feature is required, please upgrade your vim/nvim' |
||||
call floaterm#util#show_msg(message, 'error') |
||||
return v:false |
||||
endif |
||||
return v:true |
||||
endfunction |
||||
|
||||
function! s:echo(group, msg) abort |
||||
if a:msg ==# '' | return | endif |
||||
execute 'echohl' a:group |
||||
echo a:msg |
||||
echon ' ' |
||||
echohl NONE |
||||
endfunction |
||||
|
||||
function! s:echon(group, msg) abort |
||||
if a:msg ==# '' | return | endif |
||||
execute 'echohl' a:group |
||||
echon a:msg |
||||
echon ' ' |
||||
echohl NONE |
||||
endfunction |
||||
|
||||
function! floaterm#util#show_msg(message, ...) abort |
||||
if a:0 == 0 |
||||
let msg_type = 'info' |
||||
else |
||||
let msg_type = a:1 |
||||
endif |
||||
|
||||
if type(a:message) != 1 |
||||
let message = string(a:message) |
||||
else |
||||
let message = a:message |
||||
endif |
||||
|
||||
call s:echo('Constant', '[vim-floaterm]') |
||||
|
||||
if msg_type ==# 'info' |
||||
call s:echon('Normal', message) |
||||
elseif msg_type ==# 'warning' |
||||
call s:echon('WarningMsg', message) |
||||
elseif msg_type ==# 'error' |
||||
call s:echon('Error', message) |
||||
endif |
||||
endfunction |
||||
|
||||
function! floaterm#util#get_normalfloat_fg() abort |
||||
let hiGroup = 'NormalFloat' |
||||
while v:true |
||||
let hiInfo = execute('hi ' . hiGroup) |
||||
let fgcolor = matchstr(hiInfo, 'guifg=\zs\S*') |
||||
let hiGroup = matchstr(hiInfo, 'links to \zs\S*') |
||||
if fgcolor !=# '' || hiGroup ==# '' |
||||
break |
||||
endif |
||||
endwhile |
||||
" If the foreground color isn't found eventually, use white |
||||
if fgcolor ==# '' |
||||
let fgcolor = '#FFFFFF' |
||||
endif |
||||
return fgcolor |
||||
endfunction |
||||
|
||||
function! floaterm#util#get_normalfloat_bg() abort |
||||
let hiGroup = 'NormalFloat' |
||||
while v:true |
||||
let hiInfo = execute('hi ' . hiGroup) |
||||
let bgcolor = matchstr(hiInfo, 'guibg=\zs\S*') |
||||
let hiGroup = matchstr(hiInfo, 'links to \zs\S*') |
||||
if bgcolor !=# '' || hiGroup ==# '' |
||||
break |
||||
endif |
||||
endwhile |
||||
" If the background color isn't found eventually, use black |
||||
if bgcolor ==# '' |
||||
let bgcolor = '#000000' |
||||
endif |
||||
return bgcolor |
||||
endfunction |
@ -0,0 +1,160 @@
@@ -0,0 +1,160 @@
|
||||
*floaterm.txt* Neovim's floating terminal plugin Last change: 2019-12-28 |
||||
|
||||
Author : voldikss <https://github.com/voldikss> |
||||
License: MIT license |
||||
============================================================================== |
||||
CONTENTS *floaterm-contents* |
||||
|
||||
Introduction |floaterm-introduction| |
||||
Install |floaterm-install| |
||||
Features |floaterm-features| |
||||
Variables |floaterm-variables| |
||||
Keymappings |floaterm-key-mappings| |
||||
Commands |floaterm-commands| |
||||
Q-A |floaterm-q&a| |
||||
Repository |floaterm-repository| |
||||
|
||||
|
||||
============================================================================== |
||||
INTRODUCTION *floaterm-introduction* |
||||
|
||||
Use neovim terminal in the floating window. |
||||
|
||||
|
||||
============================================================================== |
||||
INSTALL *floaterm-install* |
||||
|
||||
With vim-plug: |
||||
> |
||||
Plug 'voldikss/vim-floaterm' |
||||
< |
||||
|
||||
============================================================================== |
||||
FEATURES *floaterm-features* |
||||
|
||||
- Toggle terminal window quickly |
||||
|
||||
- Multiple terminal instances |
||||
|
||||
- Customizable floating terminal style |
||||
|
||||
- Switch/Preview floating terminal buffer using [vim-clap](https://github.com/liuchengxu/vim-clap)(try `:Clap floaterm`) |
||||
|
||||
|
||||
============================================================================== |
||||
VARIABLES *floaterm-variables* |
||||
|
||||
g:floaterm_type *g:floaterm_type* |
||||
|
||||
Available:`'floating'`(neovim only), `'normal'`(vim8 and neovim) |
||||
|
||||
Default: `'floating'` |
||||
|
||||
g:floaterm_width *g:floaterm_width* |
||||
|
||||
Type: `int` (number of columns) or `float` (between 0 and 1). |
||||
If `float`, the width is relative to `&columns`. |
||||
Default: `0.6` |
||||
|
||||
g:floaterm_height *g:floaterm_height* |
||||
|
||||
|
||||
Type: `int` (number of lines) or `float` (between 0 and 1). |
||||
If `float`, the height is relative to `&lines`. |
||||
Default: `0.6` |
||||
|
||||
|
||||
g:floaterm_winblend *g:floaterm_winblend* |
||||
|
||||
Description: The opacity of the floating terminal |
||||
|
||||
Default: `0` |
||||
|
||||
g:floaterm_position *g:floaterm_position* |
||||
|
||||
Available: `'center'`, `'topleft'`, `'topright'`, `'bottomleft'`, |
||||
`'bottomright'`, `'auto'` |
||||
|
||||
Default: `'center'` |
||||
|
||||
g:floaterm_background *g:floaterm_background* |
||||
|
||||
Type: string(e.g. `'#000000'`, `'black'`) |
||||
|
||||
Default: background color of normal floating window |
||||
|
||||
g:floaterm_borderchars *g:floaterm_borderchars* |
||||
|
||||
Default: `['─', '│', '─', '│', '┌', '┐', '┘', '└']` |
||||
|
||||
g:floaterm_border_color *g:floaterm_border_color* |
||||
|
||||
Type: string(e.g. `'#FFFFFF'`, `'white'`) |
||||
|
||||
Default: foreground color of normal floating window |
||||
|
||||
============================================================================== |
||||
|
||||
MAPPINGS *floaterm-key-mappings* |
||||
|
||||
This plugin doesn't supply any default mappings. |
||||
> |
||||
""" Example configuration |
||||
let g:floaterm_keymap_new = '<F7>' |
||||
let g:floaterm_keymap_prev = '<F8>' |
||||
let g:floaterm_keymap_next = '<F9>' |
||||
let g:floaterm_keymap_toggle = '<F10>' |
||||
< |
||||
|
||||
|
||||
============================================================================== |
||||
COMMANDS *floaterm-commands* |
||||
|
||||
:FloatermNew *:FloatermNew* |
||||
|
||||
|
||||
:FloatermNext *:FloatermNext* |
||||
|
||||
|
||||
:FloatermPrev *:FloatermPrev* |
||||
|
||||
|
||||
:FloatermToggle *:FloatermToggle* |
||||
|
||||
|
||||
============================================================================== |
||||
Q-A *floaterm-q&a* |
||||
|
||||
- This plugin leaves an empty buffer on startify window |
||||
|
||||
Put this code in `vimrc` |
||||
> |
||||
autocmd User Startified setlocal buflisted |
||||
< |
||||
- I want to use another shell in the terminal. (e.g. Use fish instead of bash) |
||||
|
||||
Set `shell` option in your `vimrc`: |
||||
> |
||||
set shell=/path/to/shell |
||||
|
||||
- I would like to customize the style of the floating terminal window |
||||
|
||||
Use `autocmd`. For example |
||||
> |
||||
function s:floatermSettings() |
||||
setlocal number |
||||
" more settings |
||||
endfunction |
||||
|
||||
autocmd FileType floaterm call s:floatermSettings() |
||||
|
||||
============================================================================== |
||||
REPOSITORY *floaterm-repository-page* |
||||
|
||||
|vim-floaterm| is developed on GitHub. |
||||
|
||||
https://github.com/voldikss/vim-floaterm |
||||
|
||||
|
||||
============================================================================== |
||||
vim:tw=78:nosta:noet:ts=8:sts=0:ft=help:noet:fen:fdm=marker: |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
" ============================================================================ |
||||
" FileName: plugin/floaterm.vim |
||||
" Description: |
||||
" Author: voldikss <dyzplus@gmail.com> |
||||
" GitHub: https://github.com/voldikss |
||||
" ============================================================================ |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let g:floaterm_type = get(g:, 'floaterm_type', v:null) |
||||
let g:floaterm_width = get(g:, 'floaterm_width', v:null) |
||||
let g:floaterm_height = get(g:, 'floaterm_height', v:null) |
||||
let g:floaterm_winblend = get(g:, 'floaterm_winblend', 0) |
||||
let g:floaterm_position = get(g:, 'floaterm_position', 'auto') |
||||
let g:floaterm_background = get(g:, 'floaterm_background', v:null) |
||||
let g:floaterm_borderchars = get(g:, 'floaterm_borderchars', ['─', '│', '─', '│', '┌', '┐', '┘', '└']) |
||||
let g:floaterm_border_color = get(g:, 'floaterm_border_color', v:null) |
||||
|
||||
let g:floaterm_keymap_new = get(g:, 'floaterm_keymap_new', v:null) |
||||
let g:floaterm_keymap_prev = get(g:, 'floaterm_keymap_prev', v:null) |
||||
let g:floaterm_keymap_next = get(g:, 'floaterm_keymap_next', v:null) |
||||
let g:floaterm_keymap_toggle = get(g:, 'floaterm_keymap_toggle', v:null) |
||||
|
||||
command! -nargs=0 FloatermNew call floaterm#start('new') |
||||
command! -nargs=0 FloatermPrev call floaterm#start('prev') |
||||
command! -nargs=0 FloatermNext call floaterm#start('next') |
||||
command! -nargs=0 FloatermToggle call floaterm#start('toggle') |
||||
|
||||
function! s:install_keymap() |
||||
if g:floaterm_keymap_new != v:null |
||||
exe printf('nnoremap <silent> %s :FloatermNew<CR>', g:floaterm_keymap_new) |
||||
exe printf('tnoremap <silent> %s <C-\><C-n>:FloatermNew<CR>', g:floaterm_keymap_new) |
||||
endif |
||||
if g:floaterm_keymap_prev != v:null |
||||
exe printf('nnoremap <silent> %s :FloatermPrev<CR>', g:floaterm_keymap_prev) |
||||
exe printf('tnoremap <silent> %s <C-\><C-n>:FloatermPrev<CR>', g:floaterm_keymap_prev) |
||||
endif |
||||
if g:floaterm_keymap_next != v:null |
||||
exe printf('nnoremap <silent> %s :FloatermNext<CR>', g:floaterm_keymap_next) |
||||
exe printf('tnoremap <silent> %s <C-\><C-n>:FloatermNext<CR>', g:floaterm_keymap_next) |
||||
endif |
||||
if g:floaterm_keymap_toggle != v:null |
||||
exe printf('nnoremap <silent> %s :FloatermToggle<CR>', g:floaterm_keymap_toggle) |
||||
exe printf('tnoremap <silent> %s <C-\><C-n>:FloatermToggle<CR>', g:floaterm_keymap_toggle) |
||||
endif |
||||
endfunction |
||||
call s:install_keymap() |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
Press q to dismiss, <Tab> to lose focus |
||||
|
||||
Перемещение {{{1 |
||||
|
||||
В начало экрана H N |
||||
В центр экрана M N |
||||
В конец экрана L N |
||||
|
||||
Вперёд на один экран ^F N |
||||
Назад на один экран ^B N |
||||
Вперёд на полэкрана ^D N |
||||
Назад на полэкрана ^U N |
||||
|
||||
Строку наверх экрана z<ENTER> N |
||||
Строку в центр экрана z. N |
||||
Строку вниз экрана z- N |
||||
|
||||
ex {{{1 |
||||
|
||||
Замена в найденных стр. :g/../s/a/b/g C |
||||
Замена с подтверждением :s/a/b/gc C |
||||
Повтор последней замены :%&g C |
||||
|
||||
Регистры {{{1 |
||||
|
||||
Содержимое регистров :registers N |
||||
Копировать строку в `a` "ayy N |
||||
Добавить строку в `a` "Ayy N |
||||
|
||||
Разное {{{1 |
||||
|
||||
Открыть ссылку gx N |
||||
|
@ -0,0 +1,138 @@
@@ -0,0 +1,138 @@
|
||||
" Vim syntax file |
||||
" Language: Jinja template |
||||
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com> |
||||
" Last Change: 2008 May 9 |
||||
" Version: 1.1 |
||||
" |
||||
" Known Bugs: |
||||
" because of odd limitations dicts and the modulo operator |
||||
" appear wrong in the template. |
||||
" |
||||
" Changes: |
||||
" |
||||
" 2008 May 9: Added support for Jinja 2 changes (new keyword rules) |
||||
|
||||
" .vimrc variable to disable html highlighting |
||||
if !exists('g:jinja_syntax_html') |
||||
let g:jinja_syntax_html=1 |
||||
endif |
||||
|
||||
" For version 5.x: Clear all syntax items |
||||
" For version 6.x: Quit when a syntax file was already loaded |
||||
if !exists("main_syntax") |
||||
if v:version < 600 |
||||
syntax clear |
||||
elseif exists("b:current_syntax") |
||||
finish |
||||
endif |
||||
let main_syntax = 'jinja' |
||||
endif |
||||
|
||||
" Pull in the HTML syntax. |
||||
if g:jinja_syntax_html |
||||
if v:version < 600 |
||||
so <sfile>:p:h/html.vim |
||||
else |
||||
runtime! syntax/html.vim |
||||
unlet b:current_syntax |
||||
endif |
||||
endif |
||||
|
||||
syntax case match |
||||
|
||||
" Jinja template built-in tags and parameters (without filter, macro, is and raw, they |
||||
" have special threatment) |
||||
syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained and if else in not or recursive as import |
||||
|
||||
syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained is filter skipwhite nextgroup=jinjaFilter |
||||
syn keyword jinjaStatement containedin=jinjaTagBlock contained macro skipwhite nextgroup=jinjaFunction |
||||
syn keyword jinjaStatement containedin=jinjaTagBlock contained block skipwhite nextgroup=jinjaBlockName |
||||
|
||||
" Variable Names |
||||
syn match jinjaVariable containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[a-zA-Z_][a-zA-Z0-9_]*/ |
||||
syn keyword jinjaSpecial containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained false true none False True None loop super caller varargs kwargs |
||||
|
||||
" Filters |
||||
syn match jinjaOperator "|" containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained skipwhite nextgroup=jinjaFilter |
||||
syn match jinjaFilter contained /[a-zA-Z_][a-zA-Z0-9_]*/ |
||||
syn match jinjaFunction contained /[a-zA-Z_][a-zA-Z0-9_]*/ |
||||
syn match jinjaBlockName contained /[a-zA-Z_][a-zA-Z0-9_]*/ |
||||
|
||||
" Jinja template constants |
||||
syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/"/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\"/ end=/"/ |
||||
syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/'/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\'/ end=/'/ |
||||
syn match jinjaNumber containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[0-9]\+\(\.[0-9]\+\)\?/ |
||||
|
||||
" Operators |
||||
syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[+\-*\/<>=!,:]/ |
||||
syn match jinjaPunctuation containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[()\[\]]/ |
||||
syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /\./ nextgroup=jinjaAttribute |
||||
syn match jinjaAttribute contained /[a-zA-Z_][a-zA-Z0-9_]*/ |
||||
|
||||
" Jinja template tag and variable blocks |
||||
syn region jinjaNested matchgroup=jinjaOperator start="(" end=")" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained |
||||
syn region jinjaNested matchgroup=jinjaOperator start="\[" end="\]" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained |
||||
syn region jinjaNested matchgroup=jinjaOperator start="{" end="}" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained |
||||
syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment |
||||
|
||||
syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment |
||||
|
||||
" Jinja template 'raw' tag |
||||
syn region jinjaRaw matchgroup=jinjaRawDelim start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment |
||||
|
||||
" Jinja comments |
||||
syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment |
||||
" help support folding for some setups |
||||
setlocal commentstring={#%s#} |
||||
setlocal comments=s:{#,e:#} |
||||
|
||||
" Block start keywords. A bit tricker. We only highlight at the start of a |
||||
" tag block and only if the name is not followed by a comma or equals sign |
||||
" which usually means that we have to deal with an assignment. |
||||
syn match jinjaStatement containedin=jinjaTagBlock contained /\({%-\?\s*\)\@<=\<[a-zA-Z_][a-zA-Z0-9_]*\>\(\s*[,=]\)\@!/ |
||||
|
||||
" and context modifiers |
||||
syn match jinjaStatement containedin=jinjaTagBlock contained /\<with\(out\)\?\s\+context\>/ |
||||
|
||||
|
||||
" Define the default highlighting. |
||||
" For version 5.7 and earlier: only when not done already |
||||
" For version 5.8 and later: only when an item doesn't have highlighting yet |
||||
if v:version >= 508 || !exists("did_jinja_syn_inits") |
||||
if v:version < 508 |
||||
let did_jinja_syn_inits = 1 |
||||
command -nargs=+ HiLink hi link <args> |
||||
else |
||||
command -nargs=+ HiLink hi def link <args> |
||||
endif |
||||
|
||||
HiLink jinjaPunctuation jinjaOperator |
||||
HiLink jinjaAttribute jinjaVariable |
||||
HiLink jinjaFunction jinjaFilter |
||||
|
||||
HiLink jinjaTagDelim jinjaTagBlock |
||||
HiLink jinjaVarDelim jinjaVarBlock |
||||
HiLink jinjaCommentDelim jinjaComment |
||||
HiLink jinjaRawDelim jinja |
||||
|
||||
HiLink jinjaSpecial Special |
||||
HiLink jinjaOperator Normal |
||||
HiLink jinjaRaw Normal |
||||
HiLink jinjaTagBlock PreProc |
||||
HiLink jinjaVarBlock PreProc |
||||
HiLink jinjaStatement Statement |
||||
HiLink jinjaFilter Function |
||||
HiLink jinjaBlockName Function |
||||
HiLink jinjaVariable Identifier |
||||
HiLink jinjaString Constant |
||||
HiLink jinjaNumber Constant |
||||
HiLink jinjaComment Comment |
||||
|
||||
delcommand HiLink |
||||
endif |
||||
|
||||
let b:current_syntax = "jinja" |
||||
|
||||
if main_syntax ==# 'jinja' |
||||
unlet main_syntax |
||||
endif |
Loading…
Reference in new issue