• Stars
    star
    202
  • Rank 193,691 (Top 4 %)
  • Language
    Vim Script
  • License
    Other
  • Created almost 5 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Vim Window Animation Library
 █████╗ ███╗   ██╗██╗███╗   ███╗ █████╗ ████████╗███████╗  ██╗   ██╗██╗███╗   ███╗
██╔══██╗████╗  ██║██║████╗ ████║██╔══██╗╚══██╔══╝██╔════╝  ██║   ██║██║████╗ ████║
███████║██╔██╗ ██║██║██╔████╔██║███████║   ██║   █████╗    ██║   ██║██║██╔████╔██║
██╔══██║██║╚██╗██║██║██║╚██╔╝██║██╔══██║   ██║   ██╔══╝    ╚██╗ ██╔╝██║██║╚██╔╝██║
██║  ██║██║ ╚████║██║██║ ╚═╝ ██║██║  ██║   ██║   ███████╗██╗╚████╔╝ ██║██║ ╚═╝ ██║
╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝╚═╝     ╚═╝╚═╝  ╚═╝   ╚═╝   ╚══════╝╚═╝ ╚═══╝  ╚═╝╚═╝     ╚═╝

Animate.vim

A Vim Window Animation Library

Animate.vim is a general window animation library for Vim, it provides the ability to animate window height and width via:

  • delta from current size
  • percent of screen
  • absolute size

Installation

To install Animate.vim, use your plugin manager of choice, e.g:

Plug 'camspiers/animate.vim'

Usage

Given the general purpose nature of resizing windows Animate.vim can be used in many contexts.

The following gives and example of using animate to more smoothly change window size using the directional keys:

Example: Animated Directional Keys

nnoremap <silent> <Up>    :call animate#window_delta_height(10)<CR>
nnoremap <silent> <Down>  :call animate#window_delta_height(-10)<CR>
nnoremap <silent> <Left>  :call animate#window_delta_width(10)<CR>
nnoremap <silent> <Right> :call animate#window_delta_width(-10)<CR>

Animate-Resize

Example: Animated FZF Bottom Drawer

Here is an example that integrates Animate.vim with Fuzzy Finder (FZF) to animate its opening:

let g:fzf_layout = {
 \ 'window': 'new | wincmd J | resize 1 | call animate#window_percent_height(0.5)'
\ }

Animate-FZF

Example: Animated Neovim Terminal Drawers

function! OpenAnimatedHtop() abort
  " Open a htop in terminal
  new term://htop
  " Send window to bottom and start with small height
  wincmd J | resize 1
  " Animate height to 66%
  call animate#window_percent_height(0.66)
endfunction

Animate-Htop

Animate-LazyGit

Options

Distribute Space

By default Animate.vim distributes space of non-animating windows while resizing this can be destructive to intended window sizes when those sizes aren't fixed. To disable:

let g:animate#distribute_space = 0

Duration

Animation duration in milliseconds can be controlled via a global flag:

let g:animate#duration = 300.0

Easing

Animation easing can be controlled via a global flag:

let g:animate#easing_func = 'animate#ease_linear'

Easing Options

Currently there are 3 easing options available:

  • animate#ease_linear
  • animate#ease_out_quad
  • animate#ease_out_cubic
  • animate#ease_in_out_sine (default)

To set a custom easing function:

let g:animate#easing_func = 'animate#ease_out_cubic'

You can also set your own easing function using the following signature:

function! MyEasingFunction(elapsed, initial, delta, duration) abort
  " return value
endfunction

let g:animate#easing_func = 'MyEasingFunction'

API

Delta Functions

Animate current window by delta:

animate#window_delta(width_delta, height_delta)

Animate current window by width delta:

animate#window_delta_width(delta)

Animate current window by height delta:

animate#window_delta_height(delta)

Percent Functions

Animate current window by percent of screen:

animate#window_percent(width_percent, height_percent)

Animate current window by percent of screen width:

animate#window_percent_width(percent)

Animate current window by percent of screen height:

animate#window_percent_height(percent)

Absolute Functions

Animate current window to absolute size:

animate#window_absolute(width, height)

Animate current window by absolute width:

animate#window_absolute_width(width)

Animate current window by absolute height:

animate#window_absolute_height(height)

Helper Functions

Focus window:

function! animate#window_focus(target_window) abort

Determines with target window is animating:

function! animate#window_is_animating(target_window) abort

Get the current time as a float in milliseconds:

animate#time()

Get the available height factoring in cmdheight and status line:

animate#get_available_height()

Linear easing function:

animate#ease_linear(elapsed, initial, delta, duration)

Out quad easing function:

animate#ease_out_quad(elapsed, initial, delta, duration)

Out cubic easing function:

animate#ease_out_cubic(elapsed, initial, delta, duration)

In out sine easing function:

animate#ease_in_out_sine(elapsed, initial, delta, duration)

More Repositories

1

lens.vim

A Vim Automatic Window Resizing Plugin
Vim Script
467
star
2

snap

A fast finder system for neovim.
Fennel
421
star
3

dotfiles

Dotfiles (macOS, stow, brew, yabai, nvim, kitty, tmux)
Clojure
206
star
4

statistical-classifier

A PHP implementation of a Naive Bayes statistical classifier, including a structure for building other classifiers, multiple data sources and multiple caching backends.
PHP
175
star
5

reactjs-php-render

React rendering from PHP
PHP
45
star
6

tmuxinator-fzf-start

Uses fzf to provide a selection list for starting tmuxinator projects
Shell
40
star
7

Bayes

A Baysian calculator and visualization tool implemented in HTML, CSS, and JavaScript
JavaScript
23
star
8

json-pretty

Provides support for json pretty printing in php 5.3
PHP
23
star
9

silverstripe-twig

Allows the use of twig as a template engine in SilverStripe
PHP
20
star
10

php-fp

Functional Programming Helpers
PHP
17
star
11

porter-stemmer

Porter Stemmer created by Richard Heyes
PHP
14
star
12

silverstripe-loggerbridge

Provides a bridge between PSR-3 loggers (like monolog) and SilverStripe
PHP
13
star
13

silverstripe-slowlog

Logs slow SilverStripe requests
PHP
10
star
14

pthreads-pool

A basic and experimental implementation of a thread pool for pthreads
PHP
8
star
15

silverstripe-honeypot

SilverStripe honey pot capture
PHP
7
star
16

luarocks

Easily install luarocks with lazy.nvim
Lua
4
star
17

silverstripe-haml

Allows the use of haml in SilverStripe
PHP
4
star
18

elm-redchaser

A basic game written in Elm
Elm
4
star
19

readydocker

A macOS tool for starting then waiting for Docker.app to be ready
Shell
4
star
20

silverstripe-classifierbridge

SilverStripe tools for using statistical classifier
PHP
3
star
21

silverstripe-fixturegenerator

Allows the generation of SilverStripe unit test fixtures from existing DataObjects either programatically created or from the database
PHP
3
star
22

silverstripe-composer-autoload

Allows use of composer in SilverStripe projects
PHP
2
star
23

silverstripe-markdown

Markdown in SilverStripe
PHP
2
star
24

php-trait-convert

Limited ability to convert php classes that use traits
PHP
1
star
25

silverstripe-csp-logging

Logs CSP violations through a logger
PHP
1
star
26

shared-dependency-injection

PHP
1
star
27

closureaccess

Brings JavaScript-like functionality to your objects
PHP
1
star
28

php-lib-create

Creates a PHP composer library with useful defaults (github repo, phpunit, travis, namespace, php-cs-fixer, README)
PHP
1
star