Skip to content
rbong edited this page Jun 18, 2023 · 12 revisions

This guide describes how to switch from Flog v1 to v2.

For some changes, but not all, you will receive deprecation warnings when using v1-only interfaces.

Overview

Major New Features

  • Flog now draws the graph branches itself
  • Flog is now faster
  • Branch and commit highlighting is now more accurate

Prerequisites

  • Vim 8/9/Neovim is required
  • LuaJIT 2.1 must be installed on your system if you are using Vim 8/9
    • Flog will check for the luajit executable
    • You can specify the path to the executable yourself with g:flog_lua_bin
    • If you have compiled Vim with LuaJIT 2.1, you can use let g:flog_use_internal_lua = 1

Installation

  • Install Flog normally, ex: Plug 'rbong/vim-flog'

Updated Args

  • The preferred arg for -sort= is now -order=. Everywhere that refers to "sort" now uses "order" instead.

Updated Mappings

  • )/( are now separate bindings from <C-N>/<C-P>. They jump to commits without opening them
  • ]r/[r no longer open the commit by default
  • cot now defaults to col, to avoid confusion with git checkout -t
  • gss now defaults to goo. Similarly, gsd/gsa/gst now default to god/goa/got
  • go now defaults to gcg

Updated Commands

  • Flogjump is no longer present for optimization reasons
    • For commits in the current window, use //?
    • For commits not in the current window, use Flogsetargs -rev=...
  • Floggit now supports flags
    • --focus/-f: keep focus
    • --static/-s: prevent updating graph buffer
    • --tmp/-t: use temporary side window
  • Floggit now uses ! to mean Git! (run commands in background) instead of opening in a temporary window
    • Use t/--tmp to run in a temporary window

Updated Settings

  • g:flog_default_arguments/g:flog_permanent_default_arguments are now g:flog_default_opts/g:flog_permanent_default_opts
    • Options no longer have the no_ prefix, ex: { 'no_merges': v:true } is now { 'merges': v:false }
  • g:flog_enable_status is now required to set b:flog_status_summary for statuslines
  • g:flog_build_log_command_fn is no longer supported since Flog builds the log graph itself
  • g:flog_use_ansi_esc is no longer supported since branch highlighting is more accurate

Updated Functions

  • flog#run_command(), flog#run_tmp_command(), and flog#run_raw_command() are deprecated
    • Use flog#Exec() to run commands
      • The third argument is now inverted (don't update the graph buffer instead of update it)
      • The other arguments are the same as flog#run_command()
      • Does not format commands
    • Use flog#ExecTmp() to run commands in side windows
      • The third argument is now inverted
      • The other arguments are the same as flog#run_tmp_command()
      • Does not format commands
    • Use flog#Format() to format commands
    • :Floggit now has many capabilities of flog#Exec() through flags (see Updated Commands)
  • The internal Flog API has been restructured
    • Most functions will not give deprecation warnings since v2 is a complete refactor
    • Please see ftplugin/floggraph.vim for updated examples

Updated User Autocommands

  • FlogCmdBufferSetup is now FlogSideWinSetup
  • FlogTmpCmdBufferSetup is now FlogTmpSideWinSetup
  • FlogNonTmpCmdBufferSetup is now FlogNonTmpSideWinSetup

Other Deprecations

  • AnsiEsc is not currently supported in v2.

Other Additions

  • Syntax highlighting is now better looking and faster
  • There is now a public and private API. For the full public API, see :help flog-functions
  • Flog will now automatically run git commit-graph write the first time it is opened in a repo. See also :help g:flog_write_commit_graph
  • Added the :Flog -no-graph option to not draw any graph
  • Added the binding ^ (<Plug>(FlogJumpToCommitCol)) to jump between the visual column containing the branch of the highlighted commit and the commit details
  • Added syntax highlighting and completion for more date formats

See :help flog for all current features.