robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
master
1#pragma once 2 3#include <stdbool.h> 4 5#include "nvim/fold_defs.h" 6#include "nvim/pos_defs.h" 7#include "nvim/sign_defs.h" 8 9/// 'statusline' item flags 10typedef enum { 11STL_FILEPATH = 'f' ,///< Path of file in buffer. 12STL_FULLPATH = 'F' ,///< Full path of file in buffer. 13STL_FILENAME = 't' ,///< Last part (tail) of file path. 14STL_COLUMN = 'c' ,///< Column og cursor. 15STL_VIRTCOL = 'v' ,///< Virtual column. 16STL_VIRTCOL_ALT = 'V' ,///< - with 'if different' display. 17STL_LINE = 'l' ,///< Line number of cursor. 18STL_NUMLINES = 'L' ,///< Number of lines in buffer. 19STL_BUFNO = 'n' ,///< Current buffer number. 20STL_KEYMAP = 'k' ,///< 'keymap' when active. 21STL_OFFSET = 'o' ,///< Offset of character under cursor. 22STL_OFFSET_X = 'O' ,///< - in hexadecimal. 23STL_BYTEVAL = 'b' ,///< Byte value of character. 24STL_BYTEVAL_X = 'B' ,///< - in hexadecimal. 25STL_ROFLAG = 'r' ,///< Readonly flag. 26STL_ROFLAG_ALT = 'R' ,///< - other display. 27STL_HELPFLAG = 'h' ,///< Window is showing a help file. 28STL_HELPFLAG_ALT = 'H' ,///< - other display. 29STL_FILETYPE = 'y' ,///< 'filetype'. 30STL_FILETYPE_ALT = 'Y' ,///< - other display. 31STL_PREVIEWFLAG = 'w' ,///< Window is showing the preview buf. 32STL_PREVIEWFLAG_ALT = 'W' ,///< - other display. 33STL_MODIFIED = 'm' ,///< Modified flag. 34STL_MODIFIED_ALT = 'M' ,///< - other display. 35STL_QUICKFIX = 'q' ,///< Quickfix window description. 36STL_PERCENTAGE = 'p' ,///< Percentage through file. 37STL_ALTPERCENT = 'P' ,///< Percentage as TOP BOT ALL or NN%. 38STL_ARGLISTSTAT = 'a' ,///< Argument list status as (x of y). 39STL_PAGENUM = 'N' ,///< Page number (when printing). 40STL_SHOWCMD = 'S' ,///< 'showcmd' buffer 41STL_FOLDCOL = 'C' ,///< Fold column for 'statuscolumn' 42STL_SIGNCOL = 's' ,///< Sign column for 'statuscolumn' 43STL_VIM_EXPR = '{' ,///< Start of expression to substitute. 44STL_SEPARATE = '=' ,///< Separation between alignment sections. 45STL_TRUNCMARK = '<' ,///< Truncation mark if line is too long. 46STL_USER_HL = '*' ,///< Highlight from (User)1..9 or 0. 47STL_HIGHLIGHT = '#' ,///< Highlight name. 48STL_HIGHLIGHT_COMB = '$' ,///< Highlight name (combining previous attrs). 49STL_TABPAGENR = 'T' ,///< Tab page label nr. 50STL_TABCLOSENR = 'X' ,///< Tab page close nr. 51STL_CLICK_FUNC = '@' ,///< Click region start. 52}StlFlag ; 53 54/// Status line click definition 55typedef struct { 56enum { 57kStlClickDisabled = 0 ,///< Clicks to this area are ignored. 58kStlClickTabSwitch ,///< Switch to the given tab. 59kStlClickTabClose ,///< Close given tab. 60kStlClickFuncRun ,///< Run user function. 61 }type ;///< Type of the click. 62int tabnr ;///< Tab page number. 63char * func ;///< Function to run. 64}StlClickDefinition ; 65 66typedef struct { 67StlClickDefinition * def ;///< Click definition. 68size_t size ;///< Click definition size. 69}StcClick ; 70 71/// Used for tabline clicks 72typedef struct { 73StlClickDefinition def ;///< Click definition. 74const char * start ;///< Location where region starts. 75}StlClickRecord ; 76 77/// Used for highlighting in the status line. 78typedef struct stl_hlrec stl_hlrec_t ; 79struct stl_hlrec { 80char * start ;///< Where the item starts in the status line output buffer 81int userhl ;///< 0: no HL, 1-9: User HL, < 0 for syn ID 82StlFlag item ;///< Item flag belonging to highlight (used for 'statuscolumn') 83}; 84 85/// Used for building the status line. 86typedef struct stl_item stl_item_t ; 87struct stl_item { 88char * start ;///< Where the item starts in the status line output buffer 89char * cmd ;///< Function to run for ClickFunc items 90int minwid ;///< The minimum width of the item 91int maxwid ;///< The maximum width of the item 92enum { 93Disabled , 94Normal , 95NormalEmpty , 96Group , 97Separate , 98Trunc , 99Expression , 100Highlight , 101HighlightCombining , 102HighlightScope , 103HighlightSign , 104HighlightFold , 105TabPage , 106ClickFunc , 107 }type ; 108}; 109 110/// Struct to hold info for 'statuscolumn' 111typedef struct { 112int width ;///< width of the status column 113linenr_T lnum ;///< buffer line being drawn 114int sign_cul_id ;///< cursorline sign highlight id 115bool draw ;///< whether to draw the statuscolumn 116stl_hlrec_t * hlrec ;///< highlight groups 117foldinfo_T foldinfo ;///< fold information 118colnr_T fold_vcol [9 ];///< vcol array filled for fold item 119SignTextAttrs * sattrs ;///< sign attributes 120}statuscol_T ;