├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── examples ├── blacklist ├── demo.mp4 ├── svim.sh └── svimrc ├── lib ├── libvim.a └── libvim │ ├── alloc.h │ ├── ascii.h │ ├── auto │ ├── config.h │ └── osdef.h │ ├── ex_cmdidxs.h │ ├── ex_cmds.h │ ├── feature.h │ ├── glbl_ime.h │ ├── globals.h │ ├── if_mzsch.h │ ├── if_ole.h │ ├── if_py_both.h │ ├── iscygpty.h │ ├── keymap.h │ ├── libvim.h │ ├── macros.h │ ├── option.h │ ├── os_dos.h │ ├── os_mac.h │ ├── os_unix.h │ ├── os_unixx.h │ ├── os_win32.h │ ├── proto.h │ ├── proto │ ├── arabic.pro │ ├── autocmd.pro │ ├── blob.pro │ ├── buffer.pro │ ├── change.pro │ ├── channel.pro │ ├── charset.pro │ ├── debugger.pro │ ├── dict.pro │ ├── diff.pro │ ├── digraph.pro │ ├── edit.pro │ ├── eval.pro │ ├── evalfunc.pro │ ├── ex_cmds.pro │ ├── ex_cmds2.pro │ ├── ex_docmd.pro │ ├── ex_eval.pro │ ├── ex_getln.pro │ ├── fileio.pro │ ├── findfile.pro │ ├── fold.pro │ ├── getchar.pro │ ├── hashtab.pro │ ├── if_lua.pro │ ├── if_mzsch.pro │ ├── if_ole.pro │ ├── if_python.pro │ ├── if_python3.pro │ ├── indent.pro │ ├── json.pro │ ├── list.pro │ ├── main.pro │ ├── mark.pro │ ├── mbyte.pro │ ├── memfile.pro │ ├── memline.pro │ ├── message.pro │ ├── message2.pro │ ├── misc1.pro │ ├── misc2.pro │ ├── move.pro │ ├── normal.pro │ ├── ops.pro │ ├── option.pro │ ├── os_mac_conv.pro │ ├── os_mswin.pro │ ├── os_unix.pro │ ├── os_win32.pro │ ├── pty.pro │ ├── quickfix.pro │ ├── regexp.pro │ ├── screen.pro │ ├── search.pro │ ├── sha256.pro │ ├── sign.pro │ ├── state_insert_literal.pro │ ├── state_machine.pro │ ├── syntax.pro │ ├── tag.pro │ ├── term.pro │ ├── terminal.pro │ ├── termlib.pro │ ├── ui.pro │ ├── undo.pro │ ├── usercmd.pro │ ├── userfunc.pro │ ├── version.pro │ ├── winclip.pro │ └── window.pro │ ├── protodef.h │ ├── regexp.h │ ├── sds.h │ ├── sdsalloc.h │ ├── structs.h │ ├── term.h │ ├── version.h │ ├── vim.h │ └── vimio.h ├── makefile └── src ├── ax.c ├── ax.h ├── buffer.c ├── buffer.h ├── env_vars.c ├── env_vars.h ├── event_tap.c ├── event_tap.h ├── helpers.h ├── helpers.m ├── line.c ├── line.h ├── main.m ├── workspace.h └── workspace.m /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: felixkratz 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | bin 3 | *.tgz 4 | .cache 5 | compile_commands.json 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libvim"] 2 | path = libvim 3 | url = git@github.com:FelixKratz/libvim.git 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SketchyVim 2 | This small project turns accessible(!) input fields on macOS into full vim 3 | buffers. It should behave and feel like native vim, because, under the hood 4 | I synchronize the text field with a real vim buffer. 5 | 6 | ![demo](https://user-images.githubusercontent.com/22680421/153753171-e818d40b-4d72-4b88-9719-d1e36d16dec0.gif) 7 | 8 | You can use all modes (even commandline etc.) and all commands included in vim. 9 | 10 | It is also possible to load a custom `svimrc` file, which can contain 11 | custom vim configurations, e.g. remappings (see the examples folder). 12 | 13 | Additionally, you can edit the `blacklist` file in the `~/.config/svim/` folder 14 | to manually exclude applications from being handled by svim. 15 | You will likely want to blacklist your terminal emulator and gvim, such that there 16 | is no conflict. 17 | 18 | Every time the vim mode changes, or a commandline update is issued, the script 19 | `svim.sh` in the folder `~/.config/svim/` is executed where you can handle 20 | how you want to process this information. I have a small popup in my [SketchyBar](https://github.com/FelixKratz/SketchyBar) 21 | which shows me the command line output on demand for example. 22 | 23 | (!): Accessible means, that the input field needs to conform to the accessibility 24 | standards for text input fields, else there is nothing we can do. 25 | 26 | ## Installation 27 | You can install this using brew from my tap: 28 | ```bash 29 | brew tap FelixKratz/formulae 30 | brew install svim 31 | ``` 32 | and then you can start the brew service using: 33 | ``` 34 | brew services start svim 35 | ``` 36 | where you will be asked to grant accessibility permissions. 37 | 38 | You can change the macOS selection color to anything you like with this command (which is my green): 39 | ```bash 40 | defaults write NSGlobalDomain AppleHighlightColor -string "0.615686 0.823529 0.454902" 41 | ``` 42 | 43 | ## Issues 44 | Please tell me if you encounter issues. 45 | 46 | Known Issues: 47 | ------------- 48 | * Multikey remappings are not recognized (e.g. jk for esc) 49 | * Some text fields break the accessibility api and this leads to bugs, 50 | be sure to blacklist all apps that are affected by this. 51 | Sometimes it helps to switch to a "raw" or "markdown" editing mode on websites, 52 | such that there is no interference. 53 | Generally, Safari seems to make most text fields available, while Firefox does not. 54 | * Comments in svimrc break the config (#18) 55 | 56 | ## Contributions 57 | Pull requests are welcome. If you improve the code for your own use, consider creating 58 | a pull request, such that all people (including me) can enjoy those improvements. 59 | 60 | ## Credits 61 | * I use the libvim library which is a compact and minimal c library for the vim core. 62 | * Many prior projects tried to accomplish a similar vision by rebuilding the vim 63 | movements by hand, those have inspired me to create this project. 64 | -------------------------------------------------------------------------------- /examples/blacklist: -------------------------------------------------------------------------------- 1 | Alacritty 2 | iTerm2 3 | Kitty 4 | MacVim 5 | Neovide 6 | Terminal 7 | -------------------------------------------------------------------------------- /examples/demo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FelixKratz/SketchyVim/6d55a117820395abc07784c9cafd7229f12b1db1/examples/demo.mp4 -------------------------------------------------------------------------------- /examples/svim.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # This script is executed when either the mode changes, 4 | # or the commandline changes 5 | # This is just an example using sketchybar: 6 | # The variables $MODE and $CMDLINE hold the 7 | # current editor and cmdline info 8 | 9 | # COLOR=0xff9dd274 10 | # if [ "$MODE" = "" ]; then 11 | # COLOR=0xffff6578 12 | # fi 13 | # 14 | # DRAW_CMD="off" 15 | # if [ "$CMDLINE" != "" ]; then 16 | # DRAW_CMD="on" 17 | # fi 18 | # 19 | # sketchybar --set svim.mode label="[$MODE]" \ 20 | # label.drawing=$(if [ "$MODE" = "" ]; then echo "off"; else echo "on"; fi) \ 21 | # icon.color=$COLOR \ 22 | # popup.drawing=$DRAW_CMD \ 23 | # --set svim.cmdline label="$CMDLINE" 24 | # 25 | # This is the setup command needed for sketchybar in sketchybarrc: 26 | # 27 | # sketchybar --add item svim.mode right \ 28 | # --set svim.mode popup.align=right \ 29 | # icon= \ 30 | # icon.font="Hack Nerd Font Mono:Bold:28.0" \ 31 | # label.font="Hack Nerd Font Mono:Bold:13.0" \ 32 | # icon.color=0xffff6578 \ 33 | # script="sketchybar --set svim.mode popup.drawing=off" \ 34 | # --subscribe svim.mode front_app_switched window_focus \ 35 | # --add item svim.cmdline popup.svim.mode \ 36 | # --set svim.cmdline icon="Command: " 37 | # 38 | -------------------------------------------------------------------------------- /examples/svimrc: -------------------------------------------------------------------------------- 1 | noremap ß $ 2 | nmap :m .+1==gn 3 | nmap :m .-2==gn 4 | -------------------------------------------------------------------------------- /lib/libvim.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FelixKratz/SketchyVim/6d55a117820395abc07784c9cafd7229f12b1db1/lib/libvim.a -------------------------------------------------------------------------------- /lib/libvim/alloc.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | /* 10 | * alloc.h: enumeration of alloc IDs. 11 | * Each entry must be on exactly one line, GetAllocId() depends on that. 12 | */ 13 | typedef enum 14 | { 15 | aid_none = 0, 16 | aid_qf_dirname_start, 17 | aid_qf_dirname_now, 18 | aid_qf_namebuf, 19 | aid_qf_module, 20 | aid_qf_errmsg, 21 | aid_qf_pattern, 22 | aid_tagstack_items, 23 | aid_tagstack_from, 24 | aid_tagstack_details, 25 | aid_sign_getdefined, 26 | aid_sign_getplaced, 27 | aid_sign_define_by_name, 28 | aid_sign_getlist, 29 | aid_sign_getplaced_dict, 30 | aid_sign_getplaced_list, 31 | aid_insert_sign, 32 | aid_sign_getinfo, 33 | aid_last 34 | } alloc_id_T; 35 | -------------------------------------------------------------------------------- /lib/libvim/ascii.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | /* 10 | * Definitions of various common control characters. 11 | * For EBCDIC we have to use different values. 12 | */ 13 | 14 | #ifndef EBCDIC 15 | 16 | /* IF_EB(ASCII_constant, EBCDIC_constant) */ 17 | #define IF_EB(a, b) a 18 | 19 | #define CharOrd(x) ((x) < 'a' ? (x) - 'A' : (x) - 'a') 20 | #define CharOrdLow(x) ((x) - 'a') 21 | #define CharOrdUp(x) ((x) - 'A') 22 | #define ROT13(c, a) (((((c) - (a)) + 13) % 26) + (a)) 23 | 24 | #define NUL '\000' 25 | #define BELL '\007' 26 | #define BS '\010' 27 | #define TAB '\011' 28 | #define NL '\012' 29 | #define NL_STR (char_u *)"\012" 30 | #define FF '\014' 31 | #define CAR '\015' /* CR is used by Mac OS X */ 32 | #define ESC '\033' 33 | #define ESC_STR (char_u *)"\033" 34 | #define ESC_STR_nc "\033" 35 | #define DEL 0x7f 36 | #define DEL_STR (char_u *)"\177" 37 | 38 | #define POUND 0xA3 39 | 40 | #define Ctrl_chr(x) (TOUPPER_ASC(x) ^ 0x40) /* '?' -> DEL, '@' -> ^@, etc. */ 41 | #define Meta(x) ((x) | 0x80) 42 | 43 | #define CTRL_F_STR "\006" 44 | #define CTRL_H_STR "\010" 45 | #define CTRL_V_STR "\026" 46 | 47 | #define Ctrl_AT 0 /* @ */ 48 | #define Ctrl_A 1 49 | #define Ctrl_B 2 50 | #define Ctrl_C 3 51 | #define Ctrl_D 4 52 | #define Ctrl_E 5 53 | #define Ctrl_F 6 54 | #define Ctrl_G 7 55 | #define Ctrl_H 8 56 | #define Ctrl_I 9 57 | #define Ctrl_J 10 58 | #define Ctrl_K 11 59 | #define Ctrl_L 12 60 | #define Ctrl_M 13 61 | #define Ctrl_N 14 62 | #define Ctrl_O 15 63 | #define Ctrl_P 16 64 | #define Ctrl_Q 17 65 | #define Ctrl_R 18 66 | #define Ctrl_S 19 67 | #define Ctrl_T 20 68 | #define Ctrl_U 21 69 | #define Ctrl_V 22 70 | #define Ctrl_W 23 71 | #define Ctrl_X 24 72 | #define Ctrl_Y 25 73 | #define Ctrl_Z 26 74 | /* CTRL- [ Left Square Bracket == ESC*/ 75 | #define Ctrl_BSL 28 /* \ BackSLash */ 76 | #define Ctrl_RSB 29 /* ] Right Square Bracket */ 77 | #define Ctrl_HAT 30 /* ^ */ 78 | #define Ctrl__ 31 79 | 80 | #else 81 | 82 | /* EBCDIC */ 83 | 84 | /* IF_EB(ASCII_constant, EBCDIC_constant) */ 85 | #define IF_EB(a, b) b 86 | 87 | /* 88 | * Finding the position in the alphabet is not straightforward in EBCDIC. 89 | * There are gaps in the code table. 90 | * 'a' + 1 == 'b', but: 'i' + 7 == 'j' and 'r' + 8 == 's' 91 | */ 92 | #define CharOrd__(c) ((c) < ('j' - 'a') ? (c) : ((c) < ('s' - 'a') ? (c)-7 : (c)-7 - 8)) 93 | #define CharOrdLow(x) (CharOrd__((x) - 'a')) 94 | #define CharOrdUp(x) (CharOrd__((x) - 'A')) 95 | #define CharOrd(x) (isupper(x) ? CharOrdUp(x) : CharOrdLow(x)) 96 | 97 | #define EBCDIC_CHAR_ADD_(x) ((x) < 0 ? 'a' : (x) > 25 ? 'z' : "abcdefghijklmnopqrstuvwxyz"[x]) 98 | #define EBCDIC_CHAR_ADD(c, s) (isupper(c) ? toupper(EBCDIC_CHAR_ADD_(CharOrdUp(c) + (s))) : EBCDIC_CHAR_ADD_(CharOrdLow(c) + (s))) 99 | 100 | #define R13_(c) ("abcdefghijklmnopqrstuvwxyz"[((c) + 13) % 26]) 101 | #define ROT13(c, a) (isupper(c) ? toupper(R13_(CharOrdUp(c))) : R13_(CharOrdLow(c))) 102 | 103 | #define NUL '\000' 104 | #define BELL '\x2f' 105 | #define BS '\x16' 106 | #define TAB '\x05' 107 | #define NL '\x15' 108 | #define NL_STR (char_u *)"\x15" 109 | #define FF '\x0C' 110 | #define CAR '\x0D' 111 | #define ESC '\x27' 112 | #define ESC_STR (char_u *)"\x27" 113 | #define ESC_STR_nc "\x27" 114 | #define DEL 0x07 115 | #define DEL_STR (char_u *)"\007" 116 | 117 | #define POUND 0xB1 118 | 119 | #define CTRL_F_STR "\056" 120 | #define CTRL_H_STR "\026" 121 | #define CTRL_V_STR "\062" 122 | 123 | #define Ctrl_AT 0x00 /* @ */ 124 | #define Ctrl_A 0x01 125 | #define Ctrl_B 0x02 126 | #define Ctrl_C 0x03 127 | #define Ctrl_D 0x37 128 | #define Ctrl_E 0x2D 129 | #define Ctrl_F 0x2E 130 | #define Ctrl_G 0x2F 131 | #define Ctrl_H 0x16 132 | #define Ctrl_I 0x05 133 | #define Ctrl_J 0x15 134 | #define Ctrl_K 0x0B 135 | #define Ctrl_L 0x0C 136 | #define Ctrl_M 0x0D 137 | #define Ctrl_N 0x0E 138 | #define Ctrl_O 0x0F 139 | #define Ctrl_P 0x10 140 | #define Ctrl_Q 0x11 141 | #define Ctrl_R 0x12 142 | #define Ctrl_S 0x13 143 | #define Ctrl_T 0x3C 144 | #define Ctrl_U 0x3D 145 | #define Ctrl_V 0x32 146 | #define Ctrl_W 0x26 147 | #define Ctrl_X 0x18 148 | #define Ctrl_Y 0x19 149 | #define Ctrl_Z 0x3F 150 | /* CTRL- [ Left Square Bracket == ESC*/ 151 | #define Ctrl_RSB 0x1D /* ] Right Square Bracket */ 152 | #define Ctrl_BSL 0x1C /* \ BackSLash */ 153 | #define Ctrl_HAT 0x1E /* ^ */ 154 | #define Ctrl__ 0x1F 155 | 156 | #define Ctrl_chr(x) (CtrlTable[(x)]) 157 | extern char CtrlTable[]; 158 | 159 | #define CtrlChar(x) ((x < ' ') ? CtrlCharTable[(x)] : 0) 160 | extern char CtrlCharTable[]; 161 | 162 | #define MetaChar(x) ((x < ' ') ? MetaCharTable[(x)] : 0) 163 | extern char MetaCharTable[]; 164 | 165 | #endif /* defined EBCDIC */ 166 | 167 | /* TODO: EBCDIC Code page dependent (here 1047) */ 168 | #define CSI 0x9b /* Control Sequence Introducer */ 169 | #define CSI_STR "\233" 170 | #define DCS 0x90 /* Device Control String */ 171 | #define OSC 0x9d /* Operating System Command */ 172 | #define STERM 0x9c /* String Terminator */ 173 | 174 | /* 175 | * Character that separates dir names in a path. 176 | * For MS-DOS, WIN32 and OS/2 we use a backslash. A slash mostly works 177 | * fine, but there are places where it doesn't (e.g. in a command name). 178 | * For Acorn we use a dot. 179 | */ 180 | #ifdef BACKSLASH_IN_FILENAME 181 | #define PATHSEP psepc 182 | #define PATHSEPSTR pseps 183 | #else 184 | #define PATHSEP '/' 185 | #define PATHSEPSTR "/" 186 | #endif 187 | -------------------------------------------------------------------------------- /lib/libvim/auto/osdef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * osdef.h is automagically created from osdef?.h.in by osdef.sh -- DO NOT EDIT 3 | */ 4 | /* autoconf cannot fiddle out declarations. Use our homebrewn tools. (jw) */ 5 | /* 6 | * Declarations that may cause conflicts belong here so that osdef.sh 7 | * can clean out the forest. Everything else belongs in os_unix.h 8 | * 9 | * How this works: 10 | * - This file contains all unix prototypes that Vim might need. 11 | * - The shell script osdef.sh is executed at compile time to remove all the 12 | * prototypes that are in an include file. This results in osdef.h. 13 | * - osdef.h is included in vim.h. 14 | * 15 | * sed cannot always handle so many commands, this is file 1 of 2 16 | */ 17 | 18 | #ifndef fopen /* could be redefined to fopen64() */ 19 | #endif 20 | #ifdef HAVE_FSEEKO 21 | #endif 22 | #ifdef HAVE_FSEEKO 23 | #endif 24 | #ifndef ferror /* let me say it again: "macros should never have prototypes" */ 25 | #endif 26 | #if defined(sun) || defined(_SEQUENT_) 27 | /* used inside of stdio macros getc(), puts(), putchar()... */ 28 | extern int _flsbuf(int, FILE *); 29 | extern int _filbuf(FILE *); 30 | #endif 31 | 32 | #if !defined(HAVE_SELECT) 33 | struct pollfd; /* for poll() */ 34 | extern int poll(struct pollfd *, long, int); 35 | #endif 36 | 37 | #ifdef HAVE_MEMSET 38 | #endif 39 | #ifdef HAVE_STRPBRK 40 | #endif 41 | #ifdef USEBCOPY 42 | #else 43 | # ifdef USEMEMCPY 44 | # else 45 | # ifdef USEMEMMOVE 46 | # endif 47 | # endif 48 | #endif 49 | #ifndef __BIONIC__ // Android's libc #defines bzero to memset. 50 | // used inside of FD_ZERO macro 51 | #endif 52 | #ifdef HAVE_SETSID 53 | #endif 54 | #ifdef HAVE_SETPGID 55 | #endif 56 | #ifdef HAVE_STRTOL 57 | #endif 58 | #ifdef HAVE_STRFTIME 59 | #endif 60 | #ifdef HAVE_STRCASECMP 61 | #endif 62 | #ifdef HAVE_STRNCASECMP 63 | #endif 64 | #ifndef strdup 65 | #endif 66 | 67 | #ifndef USE_SYSTEM 68 | # ifndef __TANDEM 69 | # endif 70 | #endif 71 | 72 | 73 | #ifdef HAVE_SIGSET 74 | #endif 75 | 76 | #if defined(HAVE_SETJMP_H) 77 | # ifdef HAVE_SIGSETJMP 78 | # else 79 | # endif 80 | #endif 81 | 82 | 83 | #ifndef __TANDEM 84 | #endif 85 | #if defined(HAVE_GETCWD) && !defined(sun) && !defined(__TANDEM) 86 | #else 87 | #endif 88 | #ifndef __alpha /* suggested by Campbell */ 89 | #endif 90 | /* 91 | * osdef2.h.in - See osdef1.h.in for a description. 92 | */ 93 | 94 | #ifndef __TANDEM 95 | #else 96 | #endif 97 | 98 | #ifndef __TANDEM 99 | #endif 100 | 101 | #ifndef __TANDEM 102 | #endif 103 | #ifndef __TANDEM 104 | #endif 105 | #ifndef stat /* could be redefined to stat64() */ 106 | #endif 107 | #ifndef lstat /* could be redefined to lstat64() */ 108 | #endif 109 | #ifndef __TANDEM 110 | #endif 111 | 112 | 113 | 114 | #ifdef HAVE_TERMIOS_H 115 | #endif 116 | 117 | #ifdef HAVE_SYS_STATFS_H 118 | #endif 119 | 120 | #ifdef HAVE_GETTIMEOFDAY 121 | #endif 122 | 123 | #ifdef HAVE_GETPWNAM 124 | #endif 125 | 126 | #ifdef USE_TMPNAM 127 | #else 128 | #endif 129 | 130 | #ifdef ISC 131 | extern int _Xmblen(char const *, size_t); 132 | #else 133 | /* This is different from the header but matches mblen() */ 134 | extern int _Xmblen(char *, size_t); 135 | #endif 136 | -------------------------------------------------------------------------------- /lib/libvim/ex_cmdidxs.h: -------------------------------------------------------------------------------- 1 | /* Automatically generated code by create_cmdidxs.vim 2 | * 3 | * Table giving the index of the first command in cmdnames[] to lookup 4 | * based on the first letter of a command. 5 | */ 6 | static const unsigned short cmdidxs1[26] = 7 | { 8 | /* a */ 0, 9 | /* b */ 19, 10 | /* c */ 42, 11 | /* d */ 107, 12 | /* e */ 129, 13 | /* f */ 149, 14 | /* g */ 165, 15 | /* h */ 171, 16 | /* i */ 179, 17 | /* j */ 197, 18 | /* k */ 199, 19 | /* l */ 204, 20 | /* m */ 266, 21 | /* n */ 284, 22 | /* o */ 304, 23 | /* p */ 316, 24 | /* q */ 356, 25 | /* r */ 359, 26 | /* s */ 379, 27 | /* t */ 446, 28 | /* u */ 491, 29 | /* v */ 502, 30 | /* w */ 520, 31 | /* x */ 534, 32 | /* y */ 544, 33 | /* z */ 545}; 34 | 35 | /* 36 | * Table giving the index of the first command in cmdnames[] to lookup 37 | * based on the first 2 letters of a command. 38 | * Values in cmdidxs2[c1][c2] are relative to cmdidxs1[c1] so that they 39 | * fit in a byte. 40 | */ 41 | static const unsigned char cmdidxs2[26][26] = 42 | {/* a b c d e f g h i j k l m n o p q r s t u v w x y z */ 43 | /* a */ {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 7, 15, 0, 16, 0, 0, 0, 0, 0}, 44 | /* b */ {2, 0, 0, 4, 5, 7, 0, 0, 0, 0, 0, 8, 9, 10, 11, 12, 0, 13, 0, 0, 0, 0, 22, 0, 0, 0}, 45 | /* c */ {3, 12, 16, 18, 20, 22, 25, 0, 0, 0, 0, 33, 37, 40, 46, 55, 57, 58, 59, 0, 61, 0, 64, 0, 0, 0}, 46 | /* d */ {0, 0, 0, 0, 0, 0, 0, 0, 6, 15, 0, 16, 0, 0, 17, 0, 0, 19, 20, 0, 0, 0, 0, 0, 0, 0}, 47 | /* e */ {1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0}, 48 | /* f */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0}, 49 | /* g */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 4, 5, 0, 0, 0, 0}, 50 | /* h */ {0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 51 | /* i */ {1, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 5, 6, 0, 0, 0, 0, 0, 13, 0, 15, 0, 0, 0, 0, 0}, 52 | /* j */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, 53 | /* k */ {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 54 | /* l */ {3, 11, 15, 19, 20, 24, 27, 32, 0, 0, 0, 34, 37, 40, 44, 50, 0, 52, 61, 53, 54, 58, 60, 0, 0, 0}, 55 | /* m */ {1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16}, 56 | /* n */ {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0}, 57 | /* o */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0}, 58 | /* p */ {1, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 10, 0, 0, 17, 18, 27, 0, 28, 0, 29, 0}, 59 | /* q */ {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 60 | /* r */ {0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 19, 0, 0, 0, 0}, 61 | /* s */ {2, 6, 15, 0, 19, 23, 0, 25, 26, 0, 0, 29, 31, 35, 39, 41, 0, 49, 0, 50, 0, 62, 63, 0, 64, 0}, 62 | /* t */ {2, 0, 19, 0, 24, 26, 0, 27, 0, 28, 0, 29, 33, 36, 38, 39, 0, 40, 42, 0, 43, 0, 0, 0, 0, 0}, 63 | /* u */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64 | /* v */ {0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 9, 12, 0, 0, 0, 0, 15, 0, 16, 0, 0, 0, 0, 0}, 65 | /* w */ {2, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 8, 0, 9, 10, 0, 0, 0, 12, 13, 0, 0, 0, 0}, 66 | /* x */ {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 0, 0, 0, 7, 0, 0, 8, 0, 0, 0, 0, 0}, 67 | /* y */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 68 | /* z */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; 69 | 70 | static const int command_count = 558; 71 | -------------------------------------------------------------------------------- /lib/libvim/glbl_ime.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | #ifdef GLOBAL_IME 10 | #ifndef _INC_GLOBAL_IME 11 | #define _INC_GLOBAL_IME 12 | 13 | #ifdef __cplusplus 14 | extern "C" 15 | { 16 | #endif /* __cplusplus */ 17 | void global_ime_init(ATOM, HWND); 18 | void global_ime_end(void); 19 | LRESULT WINAPI global_ime_DefWindowProc(HWND, UINT, WPARAM, LPARAM); 20 | BOOL WINAPI global_ime_TranslateMessage(CONST MSG *); 21 | void WINAPI global_ime_set_position(POINT *); 22 | void WINAPI global_ime_set_font(LOGFONT *); 23 | #if 0 24 | void WINAPI global_ime_status_evacuate(void); 25 | void WINAPI global_ime_status_restore(void); 26 | #endif 27 | void WINAPI global_ime_set_status(int status); 28 | int WINAPI global_ime_get_status(void); 29 | #ifdef __cplusplus 30 | } 31 | #endif /* __cplusplus */ 32 | 33 | #endif /* _INC_GLOBAL_IME */ 34 | #endif /* GLOBAL_IME */ 35 | -------------------------------------------------------------------------------- /lib/libvim/if_mzsch.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * MzScheme interface for Vim, wrapper around scheme.h 4 | */ 5 | #ifndef _IF_MZSCH_H_ 6 | #define _IF_MZSCH_H_ 7 | #ifdef __MINGW32__ 8 | /* Hack to engage Cygwin-specific settings */ 9 | #define __CYGWIN32__ 10 | #include 11 | #endif 12 | 13 | #ifdef PROTO 14 | /* avoid syntax error for defining Thread_Local_Variables. */ 15 | #define __thread /* empty */ 16 | #endif 17 | 18 | /* #ifdef needed for "make depend" */ 19 | #ifdef FEAT_MZSCHEME 20 | #include 21 | #include 22 | #endif 23 | 24 | #ifdef __MINGW32__ 25 | #undef __CYGWIN32__ 26 | #endif 27 | 28 | #if MZSCHEME_VERSION_MAJOR >= 299 29 | #define SCHEME_STRINGP(obj) (SCHEME_BYTE_STRINGP(obj) || SCHEME_CHAR_STRINGP(obj)) 30 | #define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_BYTE_STR_VAL(obj)) 31 | #else 32 | /* macros for compatibility with older versions */ 33 | #define scheme_current_config() scheme_config 34 | #define scheme_make_sized_byte_string scheme_make_sized_string 35 | #define scheme_format_utf8 scheme_format 36 | #ifndef DYNAMIC_MZSCHEME 37 | /* for dynamic MzScheme there will be separate definitions in if_mzsch.c */ 38 | #define scheme_get_sized_byte_string_output scheme_get_sized_string_output 39 | #define scheme_make_byte_string scheme_make_string 40 | #define scheme_make_byte_string_output_port scheme_make_string_output_port 41 | #endif 42 | 43 | #define SCHEME_BYTE_STRLEN_VAL SCHEME_STRLEN_VAL 44 | #define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_STR_VAL(obj)) 45 | #define scheme_byte_string_to_char_string(obj) (obj) 46 | #define SCHEME_BYTE_STRINGP SCHEME_STRINGP 47 | #endif 48 | 49 | /* Precise GC macros */ 50 | #ifndef MZ_GC_DECL_REG 51 | #define MZ_GC_DECL_REG(size) /* empty */ 52 | #endif 53 | #ifndef MZ_GC_VAR_IN_REG 54 | #define MZ_GC_VAR_IN_REG(x, v) /* empty */ 55 | #endif 56 | #ifndef MZ_GC_ARRAY_VAR_IN_REG 57 | #define MZ_GC_ARRAY_VAR_IN_REG(x, v, l) /* empty */ 58 | #endif 59 | #ifndef MZ_GC_REG 60 | #define MZ_GC_REG() /* empty */ 61 | #endif 62 | #ifndef MZ_GC_UNREG 63 | #define MZ_GC_UNREG() /* empty */ 64 | #endif 65 | 66 | #ifdef MZSCHEME_FORCE_GC 67 | /* 68 | * force garbage collection to check all references are registered 69 | * seg faults will indicate not registered refs 70 | */ 71 | #define MZ_GC_CHECK() scheme_collect_garbage(); 72 | #else 73 | #define MZ_GC_CHECK() /* empty */ 74 | #endif 75 | 76 | #endif /* _IF_MZSCH_H_ */ 77 | -------------------------------------------------------------------------------- /lib/libvim/iscygpty.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iscygpty.h -- part of ptycheck 3 | * https://github.com/k-takata/ptycheck 4 | * 5 | * Copyright (c) 2015-2017 K.Takata 6 | * 7 | * You can redistribute it and/or modify it under the terms of either 8 | * the MIT license (as described below) or the Vim license. 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining 11 | * a copy of this software and associated documentation files (the 12 | * "Software"), to deal in the Software without restriction, including 13 | * without limitation the rights to use, copy, modify, merge, publish, 14 | * distribute, sublicense, and/or sell copies of the Software, and to 15 | * permit persons to whom the Software is furnished to do so, subject to 16 | * the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be 19 | * included in all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef _ISCYGPTY_H 31 | #define _ISCYGPTY_H 32 | 33 | #ifdef _WIN32 34 | int is_cygpty(int fd); 35 | int is_cygpty_used(void); 36 | #else 37 | #define is_cygpty(fd) 0 38 | #define is_cygpty_used() 0 39 | #endif 40 | 41 | #endif /* _ISCYGPTY_H */ 42 | -------------------------------------------------------------------------------- /lib/libvim/os_dos.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | /* 10 | * Common MS-DOS and Win32 (Windows NT and Windows 95) defines. 11 | * 12 | * Names for the EXRC, HELP and temporary files. 13 | * Some of these may have been defined in the makefile or feature.h. 14 | */ 15 | 16 | #ifndef SYS_VIMRC_FILE 17 | #define SYS_VIMRC_FILE "$VIM\\vimrc" 18 | #endif 19 | #ifndef USR_VIMRC_FILE 20 | #define USR_VIMRC_FILE "$HOME\\_vimrc" 21 | #endif 22 | #ifndef USR_VIMRC_FILE2 23 | #define USR_VIMRC_FILE2 "$HOME\\vimfiles\\vimrc" 24 | #endif 25 | #ifndef USR_VIMRC_FILE3 26 | #define USR_VIMRC_FILE3 "$VIM\\_vimrc" 27 | #endif 28 | #ifndef VIM_DEFAULTS_FILE 29 | #define VIM_DEFAULTS_FILE "$VIMRUNTIME\\defaults.vim" 30 | #endif 31 | #ifndef EVIM_FILE 32 | #define EVIM_FILE "$VIMRUNTIME\\evim.vim" 33 | #endif 34 | 35 | #ifndef USR_EXRC_FILE 36 | #define USR_EXRC_FILE "$HOME\\_exrc" 37 | #endif 38 | #ifndef USR_EXRC_FILE2 39 | #define USR_EXRC_FILE2 "$VIM\\_exrc" 40 | #endif 41 | 42 | #ifndef SYS_OPTWIN_FILE 43 | #define SYS_OPTWIN_FILE "$VIMRUNTIME\\optwin.vim" 44 | #endif 45 | 46 | #ifdef FEAT_VIMINFO 47 | #ifndef VIMINFO_FILE 48 | #define VIMINFO_FILE "$HOME\\_viminfo" 49 | #endif 50 | #ifndef VIMINFO_FILE2 51 | #define VIMINFO_FILE2 "$VIM\\_viminfo" 52 | #endif 53 | #endif 54 | 55 | #ifndef VIMRC_FILE 56 | #define VIMRC_FILE "_vimrc" 57 | #endif 58 | 59 | #ifndef EXRC_FILE 60 | #define EXRC_FILE "_exrc" 61 | #endif 62 | 63 | #ifndef DFLT_HELPFILE 64 | #define DFLT_HELPFILE "$VIMRUNTIME\\doc\\help.txt" 65 | #endif 66 | 67 | #ifndef FILETYPE_FILE 68 | #define FILETYPE_FILE "filetype.vim" 69 | #endif 70 | #ifndef FTPLUGIN_FILE 71 | #define FTPLUGIN_FILE "ftplugin.vim" 72 | #endif 73 | #ifndef INDENT_FILE 74 | #define INDENT_FILE "indent.vim" 75 | #endif 76 | #ifndef FTOFF_FILE 77 | #define FTOFF_FILE "ftoff.vim" 78 | #endif 79 | #ifndef FTPLUGOF_FILE 80 | #define FTPLUGOF_FILE "ftplugof.vim" 81 | #endif 82 | #ifndef INDOFF_FILE 83 | #define INDOFF_FILE "indoff.vim" 84 | #endif 85 | 86 | #ifndef SYNTAX_FNAME 87 | #define SYNTAX_FNAME "$VIMRUNTIME\\syntax\\%s.vim" 88 | #endif 89 | 90 | #ifndef DFLT_BDIR 91 | #define DFLT_BDIR ".,$TEMP,c:\\tmp,c:\\temp" /* default for 'backupdir' */ 92 | #endif 93 | 94 | #ifndef DFLT_VDIR 95 | #define DFLT_VDIR "$VIM/vimfiles/view" /* default for 'viewdir' */ 96 | #endif 97 | 98 | #ifndef DFLT_DIR 99 | #define DFLT_DIR ".,$TEMP,c:\\tmp,c:\\temp" /* default for 'directory' */ 100 | #endif 101 | 102 | #define DFLT_ERRORFILE "errors.err" 103 | #define DFLT_RUNTIMEPATH "$HOME/vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/vimfiles/after" 104 | #define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" 105 | 106 | #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ 107 | #define SPACE_IN_FILENAME 108 | #define BACKSLASH_IN_FILENAME 109 | #define USE_CRNL /* lines end in CR-NL instead of NL */ 110 | #define HAVE_DUP /* have dup() */ 111 | #define HAVE_ST_MODE /* have stat.st_mode */ 112 | -------------------------------------------------------------------------------- /lib/libvim/os_mac.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | /* Before Including the MacOS specific files, 10 | * lets set the OPAQUE_TOOLBOX_STRUCTS to 0 so we 11 | * can access the internal structures. 12 | * (Until fully Carbon compliant) 13 | * TODO: Can we remove this? (Dany) 14 | */ 15 | #if 0 16 | #define OPAQUE_TOOLBOX_STRUCTS 0 17 | #endif 18 | 19 | /* Include MAC_OS_X_VERSION_* macros */ 20 | #ifdef HAVE_AVAILABILITYMACROS_H 21 | #include 22 | #endif 23 | 24 | /* 25 | * Unix interface 26 | */ 27 | #if defined(__APPLE_CC__) /* for Project Builder and ... */ 28 | #include 29 | /* Get stat.h or something similar. Comment: How come some OS get in in vim.h */ 30 | #include 31 | /* && defined(HAVE_CURSE) */ 32 | /* The curses.h from MacOS X provides by default some BACKWARD compatibility 33 | * definition which can cause us problem later on. So we undefine a few of them. */ 34 | #include 35 | #undef reg 36 | #undef ospeed 37 | /* OK defined to 0 in MacOS X 10.2 curses! Remove it, we define it to be 1. */ 38 | #undef OK 39 | #endif 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | /* 48 | * MacOS specific #define 49 | */ 50 | 51 | /* This will go away when CMD_KEY fully tested */ 52 | #define USE_CMD_KEY 53 | /* On MacOS X use the / not the : */ 54 | /* TODO: Should file such as ~/.vimrc reside instead in 55 | * ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany) 56 | */ 57 | /* When compiled under MacOS X (including CARBON version) 58 | * we use the Unix File path style. Also when UNIX is defined. */ 59 | #define USE_UNIXFILENAME 60 | 61 | /* 62 | * Generic Vim #define 63 | */ 64 | 65 | #define FEAT_SOURCE_FFS 66 | #define FEAT_SOURCE_FF_MAC 67 | 68 | #define USE_EXE_NAME /* to find $VIM */ 69 | #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ 70 | #define SPACE_IN_FILENAME 71 | 72 | // clang-format off 73 | #define BREAKCHECK_SKIP 32 /* call mch_breakcheck() each time, it's \ 74 | quite fast. Did I forgot to update the \ 75 | comment */ 76 | 77 | #define USE_FNAME_CASE /* make ":e os_Mac.c" open the file in its \ 78 | original case, as "os_mac.c" */ 79 | // clang-format on 80 | 81 | #define BINARY_FILE_IO 82 | #define EOL_DEFAULT EOL_MAC 83 | #define HAVE_AVAIL_MEM 84 | 85 | #ifndef HAVE_CONFIG_H 86 | #define HAVE_STRING_H 87 | #define HAVE_STRCSPN 88 | #define HAVE_MEMSET 89 | #define USE_TMPNAM /* use tmpnam() instead of mktemp() */ 90 | #define HAVE_FCNTL_H 91 | #define HAVE_QSORT 92 | #define HAVE_ST_MODE /* have stat.st_mode */ 93 | #define HAVE_MATH_H 94 | 95 | #if defined(__DATE__) && defined(__TIME__) 96 | #define HAVE_DATE_TIME 97 | #endif 98 | #define HAVE_STRFTIME 99 | #endif 100 | 101 | /* 102 | * Names for the EXRC, HELP and temporary files. 103 | * Some of these may have been defined in the makefile. 104 | */ 105 | 106 | #ifndef SYS_VIMRC_FILE 107 | #define SYS_VIMRC_FILE "$VIM/vimrc" 108 | #endif 109 | #ifndef SYS_GVIMRC_FILE 110 | #define SYS_GVIMRC_FILE "$VIM/gvimrc" 111 | #endif 112 | #ifndef SYS_MENU_FILE 113 | #define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" 114 | #endif 115 | #ifndef SYS_OPTWIN_FILE 116 | #define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" 117 | #endif 118 | #ifndef VIM_DEFAULTS_FILE 119 | #define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" 120 | #endif 121 | #ifndef EVIM_FILE 122 | #define EVIM_FILE "$VIMRUNTIME/evim.vim" 123 | #endif 124 | 125 | #ifndef USR_VIMRC_FILE 126 | #define USR_VIMRC_FILE "~/.vimrc" 127 | #endif 128 | 129 | #ifndef USR_EXRC_FILE 130 | #define USR_EXRC_FILE "~/.exrc" 131 | #endif 132 | 133 | #ifndef VIMRC_FILE 134 | #define VIMRC_FILE "_vimrc" 135 | #endif 136 | 137 | #ifndef EXRC_FILE 138 | #define EXRC_FILE "_exrc" 139 | #endif 140 | 141 | #ifndef DFLT_HELPFILE 142 | #define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" 143 | #endif 144 | 145 | #ifndef FILETYPE_FILE 146 | #define FILETYPE_FILE "filetype.vim" 147 | #endif 148 | #ifndef FTPLUGIN_FILE 149 | #define FTPLUGIN_FILE "ftplugin.vim" 150 | #endif 151 | #ifndef INDENT_FILE 152 | #define INDENT_FILE "indent.vim" 153 | #endif 154 | #ifndef FTOFF_FILE 155 | #define FTOFF_FILE "ftoff.vim" 156 | #endif 157 | #ifndef FTPLUGOF_FILE 158 | #define FTPLUGOF_FILE "ftplugof.vim" 159 | #endif 160 | #ifndef INDOFF_FILE 161 | #define INDOFF_FILE "indoff.vim" 162 | #endif 163 | 164 | #ifndef SYNTAX_FNAME 165 | #define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" 166 | #endif 167 | 168 | #ifdef FEAT_VIMINFO 169 | #ifndef VIMINFO_FILE 170 | #define VIMINFO_FILE "~/.viminfo" 171 | #endif 172 | #endif /* FEAT_VIMINFO */ 173 | 174 | #ifndef DFLT_BDIR 175 | #define DFLT_BDIR "." /* default for 'backupdir' */ 176 | #endif 177 | 178 | #ifndef DFLT_DIR 179 | #define DFLT_DIR "." /* default for 'directory' */ 180 | #endif 181 | 182 | #ifndef DFLT_VDIR 183 | #define DFLT_VDIR "$VIM/vimfiles/view" /* default for 'viewdir' */ 184 | #endif 185 | 186 | #define DFLT_ERRORFILE "errors.err" 187 | 188 | #ifndef DFLT_RUNTIMEPATH 189 | #define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" 190 | #endif 191 | #ifndef CLEAN_RUNTIMEPATH 192 | #define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" 193 | #endif 194 | 195 | /* 196 | * Macintosh has plenty of memory, use large buffers 197 | */ 198 | #define CMDBUFFSIZE 1024 /* size of the command processing buffer */ 199 | 200 | #ifndef DFLT_MAXMEM 201 | #define DFLT_MAXMEM 512 /* use up to 512 Kbyte for buffer */ 202 | #endif 203 | 204 | #ifndef DFLT_MAXMEMTOT 205 | #define DFLT_MAXMEMTOT 2048 /* use up to 2048 Kbyte for Vim */ 206 | #endif 207 | 208 | #define WILDCHAR_LIST "*?[{`$" 209 | 210 | /**************/ 211 | #define mch_rename(src, dst) rename(src, dst) 212 | #define mch_remove(x) unlink((char *)(x)) 213 | #ifndef mch_getenv 214 | #if defined(__APPLE_CC__) 215 | #define mch_getenv(name) ((char_u *)getenv((char *)(name))) 216 | #define mch_setenv(name, val, x) setenv(name, val, x) 217 | #else 218 | /* vim_getenv() is in pty.c */ 219 | #define USE_VIMPTY_GETENV 220 | #define mch_getenv(x) vimpty_getenv(x) 221 | #define mch_setenv(name, val, x) setenv(name, val, x) 222 | #endif 223 | #endif 224 | 225 | #ifndef HAVE_CONFIG_H 226 | #ifdef __APPLE_CC__ 227 | /* Assuming compiling for MacOS X */ 228 | /* Trying to take advantage of the prebinding */ 229 | #define HAVE_TGETENT 230 | #define OSPEED_EXTERN 231 | #define UP_BC_PC_EXTERN 232 | #endif 233 | #endif 234 | 235 | /* Some "prep work" definition to be able to compile the MacOS X 236 | * version with os_unix.c instead of os_mac.c. Based on the result 237 | * of ./configure for console MacOS X. 238 | */ 239 | 240 | #ifndef SIGPROTOARG 241 | #define SIGPROTOARG (int) 242 | #endif 243 | #ifndef SIGDEFARG 244 | #define SIGDEFARG(s) (s) int s UNUSED; 245 | #endif 246 | #ifndef SIGDUMMYARG 247 | #define SIGDUMMYARG 0 248 | #endif 249 | #undef HAVE_AVAIL_MEM 250 | #ifndef HAVE_CONFIG_H 251 | #define RETSIGTYPE void 252 | #define SIGRETURN return 253 | /*# define USE_SYSTEM */ /* Output ship do debugger :(, but ot compile */ 254 | #define HAVE_SYS_WAIT_H 1 /* Attempt */ 255 | #define HAVE_TERMIOS_H 1 256 | #define SYS_SELECT_WITH_SYS_TIME 1 257 | #define HAVE_SELECT 1 258 | #define HAVE_SYS_SELECT_H 1 259 | #define HAVE_PUTENV 260 | #define HAVE_SETENV 261 | #define HAVE_RENAME 262 | #endif 263 | 264 | #if !defined(HAVE_CONFIG_H) 265 | #define HAVE_PUTENV 266 | #endif 267 | 268 | /* A Mac constant causing big problem to syntax highlighting */ 269 | #define UNKNOWN_CREATOR '\?\?\?\?' 270 | -------------------------------------------------------------------------------- /lib/libvim/os_unixx.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | /* 10 | * os_unixx.h -- include files that are only used in os_unix.c 11 | */ 12 | 13 | /* 14 | * Stuff for signals 15 | */ 16 | #if defined(HAVE_SIGSET) && !defined(signal) 17 | #define signal sigset 18 | #endif 19 | 20 | /* Sun's sys/ioctl.h redefines symbols from termio world */ 21 | #if defined(HAVE_SYS_IOCTL_H) && !defined(SUN_SYSTEM) 22 | #include 23 | #endif 24 | 25 | #ifndef USE_SYSTEM /* use fork/exec to start the shell */ 26 | 27 | #if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT) 28 | #include 29 | #endif 30 | 31 | #ifndef WEXITSTATUS 32 | #ifdef HAVE_UNION_WAIT 33 | #define WEXITSTATUS(stat_val) ((stat_val).w_T.w_Retcode) 34 | #else 35 | #define WEXITSTATUS(stat_val) (((stat_val) >> 8) & 0377) 36 | #endif 37 | #endif 38 | 39 | #ifndef WIFEXITED 40 | #ifdef HAVE_UNION_WAIT 41 | #define WIFEXITED(stat_val) ((stat_val).w_T.w_Termsig == 0) 42 | #else 43 | #define WIFEXITED(stat_val) (((stat_val)&255) == 0) 44 | #endif 45 | #endif 46 | 47 | #endif /* !USE_SYSTEM */ 48 | 49 | #ifdef HAVE_STROPTS_H 50 | #ifdef sinix 51 | #define buf_T __system_buf_t__ 52 | #endif 53 | #include 54 | #ifdef sinix 55 | #undef buf_T 56 | #endif 57 | #endif 58 | 59 | #ifdef HAVE_STRING_H 60 | #include 61 | #endif 62 | 63 | #ifdef HAVE_SYS_STREAM_H 64 | #include 65 | #endif 66 | 67 | #ifdef HAVE_SYS_UTSNAME_H 68 | #include 69 | #endif 70 | 71 | #ifdef HAVE_SYS_SYSTEMINFO_H 72 | /* uses SYS_NMLN but it may not be defined (CrayT3E). */ 73 | #ifndef SYS_NMLN 74 | #define SYS_NMLN 32 75 | #endif 76 | 77 | #include /* for sysinfo */ 78 | #endif 79 | 80 | /* 81 | * We use termios.h if both termios.h and termio.h are available. 82 | * Termios is supposed to be a superset of termio.h. Don't include them both, 83 | * it may give problems on some systems (e.g. hpux). 84 | * I don't understand why we don't want termios.h for apollo. 85 | */ 86 | #if defined(HAVE_TERMIOS_H) && !defined(apollo) 87 | #include 88 | #else 89 | #ifdef HAVE_TERMIO_H 90 | #include 91 | #else 92 | #ifdef HAVE_SGTTY_H 93 | #include 94 | #endif 95 | #endif 96 | #endif 97 | 98 | #ifdef HAVE_SYS_PTEM_H 99 | #include /* must be after termios.h for Sinix */ 100 | #ifndef _IO_PTEM_H /* For UnixWare that should check for _IO_PT_PTEM_H */ 101 | #define _IO_PTEM_H 102 | #endif 103 | #endif 104 | 105 | /* shared library access */ 106 | #if defined(HAVE_DLFCN_H) && defined(USE_DLOPEN) 107 | #if defined(__MVS__) && !defined(__SUSV3) 108 | /* needed to define RTLD_LAZY (Anthony Giorgio) */ 109 | #define __SUSV3 110 | #endif 111 | #include 112 | #else 113 | #if defined(HAVE_DL_H) && defined(HAVE_SHL_LOAD) 114 | #include 115 | #endif 116 | #endif 117 | -------------------------------------------------------------------------------- /lib/libvim/os_win32.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | /* 10 | * Win32 (Windows NT and Windows 95) machine-dependent things. 11 | */ 12 | 13 | #include "os_dos.h" /* common MS-DOS and Win32 stuff */ 14 | #ifndef __CYGWIN__ 15 | /* cproto fails on missing include files */ 16 | #ifndef PROTO 17 | #include /* for _mkdir() */ 18 | #endif 19 | #endif 20 | 21 | /* Stop the VC2005 compiler from nagging. */ 22 | #if _MSC_VER >= 1400 23 | #define _CRT_SECURE_NO_DEPRECATE 24 | #define _CRT_NONSTDC_NO_DEPRECATE 25 | #endif 26 | 27 | #define BINARY_FILE_IO 28 | #define USE_EXE_NAME /* use argv[0] for $VIM */ 29 | #define USE_TERM_CONSOLE 30 | #ifndef HAVE_STRING_H 31 | #define HAVE_STRING_H 32 | #endif 33 | #ifndef HAVE_MATH_H 34 | #define HAVE_MATH_H 35 | #endif 36 | #define HAVE_STRCSPN 37 | #ifndef __GNUC__ 38 | #define HAVE_STRICMP 39 | #define HAVE_STRNICMP 40 | #endif 41 | #ifndef HAVE_STRFTIME 42 | #define HAVE_STRFTIME /* guessed */ 43 | #endif 44 | #define HAVE_MEMSET 45 | #ifndef HAVE_LOCALE_H 46 | #define HAVE_LOCALE_H 1 47 | #endif 48 | #ifndef HAVE_FCNTL_H 49 | #define HAVE_FCNTL_H 50 | #endif 51 | #define HAVE_QSORT 52 | #define HAVE_ST_MODE /* have stat.st_mode */ 53 | 54 | #define FEAT_SHORTCUT /* resolve shortcuts */ 55 | 56 | #if (!defined(_MSC_VER) || _MSC_VER > 1020) 57 | /* 58 | * Access Control List (actually security info). 59 | * MSVC has acl stuff only in 5.0, not in 4.2, don't know about 4.3. 60 | */ 61 | #define HAVE_ACL 62 | #endif 63 | 64 | #define USE_FNAME_CASE /* adjust case of file names */ 65 | #if defined(__DATE__) && defined(__TIME__) 66 | #define HAVE_DATE_TIME 67 | #endif 68 | #define BREAKCHECK_SKIP 1 /* call mch_breakcheck() each time, it's fast */ 69 | 70 | #define HAVE_TOTAL_MEM 71 | 72 | #define HAVE_PUTENV /* at least Bcc 5.2 and MSC have it */ 73 | 74 | /* toupper() is not really broken, but it's very slow. Probably because of 75 | * using Unicode characters on Windows NT */ 76 | #define BROKEN_TOUPPER 77 | 78 | #define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */ 79 | 80 | #include 81 | #include 82 | #include 83 | #include 84 | 85 | #ifndef STRICT 86 | #define STRICT 87 | #endif 88 | #ifndef COBJMACROS 89 | #define COBJMACROS /* For OLE: Enable "friendlier" access to objects */ 90 | #endif 91 | #ifndef PROTO 92 | #include 93 | #ifndef SM_CXPADDEDBORDER 94 | #define SM_CXPADDEDBORDER 92 95 | #endif 96 | #endif 97 | 98 | /* 99 | * Win32 has plenty of memory, use large buffers 100 | */ 101 | #define CMDBUFFSIZE 1024 /* size of the command processing buffer */ 102 | 103 | /* _MAX_PATH is only 260 (stdlib.h), but we want more for the 'path' option, 104 | * thus use a larger number. */ 105 | #define MAXPATHL 1024 106 | 107 | #ifndef BASENAMELEN 108 | #define BASENAMELEN (_MAX_PATH - 5) /* length of base of file name */ 109 | #endif 110 | 111 | #define TEMPNAMELEN _MAX_PATH /* length of temp file name path */ 112 | 113 | #ifndef DFLT_MAXMEM 114 | #define DFLT_MAXMEM (2 * 1024) /* use up to 2 Mbyte for a buffer */ 115 | #endif 116 | 117 | #ifndef DFLT_MAXMEMTOT 118 | #define DFLT_MAXMEMTOT (5 * 1024) /* use up to 5 Mbyte for Vim */ 119 | #endif 120 | 121 | /* 122 | * Reparse Point 123 | */ 124 | #ifndef FILE_ATTRIBUTE_REPARSE_POINT 125 | #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 126 | #endif 127 | #ifndef IO_REPARSE_TAG_MOUNT_POINT 128 | #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 129 | #endif 130 | #ifndef IO_REPARSE_TAG_SYMLINK 131 | #define IO_REPARSE_TAG_SYMLINK 0xA000000C 132 | #endif 133 | 134 | #if defined(_MSC_VER) 135 | /* Support for __try / __except. All versions of MSVC are 136 | * expected to have this. Any other compilers that support it? */ 137 | #define HAVE_TRY_EXCEPT 1 138 | #include /* for _resetstkoflw() */ 139 | #if defined(_MSC_VER) && (_MSC_VER >= 1300) 140 | #define RESETSTKOFLW _resetstkoflw 141 | #else 142 | #define RESETSTKOFLW myresetstkoflw 143 | #define MYRESETSTKOFLW 144 | #endif 145 | #endif 146 | 147 | /* 148 | * Some simple debugging macros that look and behave a lot like their 149 | * namesakes in MFC. 150 | */ 151 | 152 | #ifdef _DEBUG 153 | 154 | #if defined(_MSC_VER) && (_MSC_VER >= 1000) 155 | /* Use the new debugging tools in Visual C++ 4.x */ 156 | #include 157 | #define ASSERT(f) _ASSERT(f) 158 | #else 159 | #include 160 | #define ASSERT(f) assert(f) 161 | #endif 162 | 163 | #define TRACE Trace 164 | #define TRACE0(sz) Trace(_T("%s"), _T(sz)) 165 | #define TRACE1(sz, p1) Trace(_T(sz), p1) 166 | #define TRACE2(sz, p1, p2) Trace(_T(sz), p1, p2) 167 | #define TRACE3(sz, p1, p2, p3) Trace(_T(sz), p1, p2, p3) 168 | #define TRACE4(sz, p1, p2, p3, p4) Trace(_T(sz), p1, p2, p3, p4) 169 | 170 | /* In debug version, writes trace messages to debug stream */ 171 | void __cdecl Trace(char *pszFormat, ...); 172 | 173 | #else /* !_DEBUG */ 174 | 175 | /* These macros should all compile away to nothing */ 176 | #define ASSERT(f) ((void)0) 177 | #define TRACE 1 ? (void)0 : printf 178 | #define TRACE0(sz) 179 | #define TRACE1(sz, p1) 180 | #define TRACE2(sz, p1, p2) 181 | #define TRACE3(sz, p1, p2, p3) 182 | #define TRACE4(sz, p1, p2, p3, p4) 183 | 184 | #endif /* !_DEBUG */ 185 | 186 | #define ASSERT_POINTER(p, type) \ 187 | ASSERT(((p) != NULL) && IsValidAddress((p), sizeof(type), FALSE)) 188 | 189 | #define ASSERT_NULL_OR_POINTER(p, type) \ 190 | ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE)) 191 | 192 | #ifndef HAVE_SETENV 193 | #define HAVE_SETENV 194 | #endif 195 | #define mch_getenv(x) (char_u *)getenv((char *)(x)) 196 | #define vim_mkdir(x, y) mch_mkdir(x) 197 | 198 | /* Enable common dialogs input unicode from IME if possible. */ 199 | #define pDispatchMessage DispatchMessageW 200 | #define pGetMessage GetMessageW 201 | #define pIsDialogMessage IsDialogMessageW 202 | #define pPeekMessage PeekMessageW 203 | -------------------------------------------------------------------------------- /lib/libvim/proto.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | /* 10 | * proto.h: include the (automatically generated) function prototypes 11 | */ 12 | 13 | /* 14 | * Don't include these while generating prototypes. Prevents problems when 15 | * files are missing. 16 | */ 17 | #if !defined(PROTO) && !defined(NOPROTO) 18 | 19 | /* 20 | * Machine-dependent routines. 21 | */ 22 | /* avoid errors in function prototypes */ 23 | #if !defined(FEAT_X11) 24 | #define Display int 25 | #define Widget int 26 | #endif 27 | #define GdkEvent int 28 | #define GdkEventKey int 29 | #ifndef FEAT_X11 30 | #define XImage int 31 | #endif 32 | 33 | #if defined(UNIX) || defined(VMS) 34 | #include "os_unix.pro" 35 | #endif 36 | #ifdef MSWIN 37 | #include "os_mswin.pro" 38 | #include "os_win32.pro" 39 | #include "winclip.pro" 40 | #if (defined(__GNUC__) && !defined(__MINGW32__)) 41 | extern int _stricoll(char *a, char *b); 42 | #endif 43 | #endif 44 | #ifdef VMS 45 | #include "os_vms.pro" 46 | #endif 47 | #ifdef __BEOS__ 48 | #include "os_beos.pro" 49 | #endif 50 | 51 | #include "autocmd.pro" 52 | #include "blob.pro" 53 | #include "buffer.pro" 54 | #include "change.pro" 55 | #include "charset.pro" 56 | #include "debugger.pro" 57 | #include "dict.pro" 58 | #include "diff.pro" 59 | #include "digraph.pro" 60 | #include "edit.pro" 61 | #include "eval.pro" 62 | #include "evalfunc.pro" 63 | #include "ex_cmds.pro" 64 | #include "ex_cmds2.pro" 65 | #include "ex_docmd.pro" 66 | #include "ex_eval.pro" 67 | #include "ex_getln.pro" 68 | #include "fileio.pro" 69 | #include "findfile.pro" 70 | #include "fold.pro" 71 | #include "getchar.pro" 72 | #include "hashtab.pro" 73 | #include "indent.pro" 74 | #include "json.pro" 75 | #include "list.pro" 76 | #include "main.pro" 77 | #include "mark.pro" 78 | #include "memfile.pro" 79 | #include "memline.pro" 80 | #ifdef FEAT_ARABIC 81 | #include "arabic.pro" 82 | #endif 83 | 84 | /* These prototypes cannot be produced automatically. */ 85 | int smsg(const char *, ...) 86 | #ifdef USE_PRINTF_FORMAT_ATTRIBUTE 87 | __attribute__((format(printf, 1, 0))) 88 | #endif 89 | ; 90 | 91 | int smsg_attr(int, const char *, ...) 92 | #ifdef USE_PRINTF_FORMAT_ATTRIBUTE 93 | __attribute__((format(printf, 2, 3))) 94 | #endif 95 | ; 96 | 97 | int smsg_attr_keep(int, const char *, ...) 98 | #ifdef USE_PRINTF_FORMAT_ATTRIBUTE 99 | __attribute__((format(printf, 2, 3))) 100 | #endif 101 | ; 102 | 103 | /* These prototypes cannot be produced automatically. */ 104 | int semsg(const char *, ...) 105 | #ifdef USE_PRINTF_FORMAT_ATTRIBUTE 106 | __attribute__((format(printf, 1, 0))) 107 | #endif 108 | ; 109 | 110 | /* These prototypes cannot be produced automatically. */ 111 | void siemsg(const char *, ...) 112 | #ifdef USE_PRINTF_FORMAT_ATTRIBUTE 113 | __attribute__((format(printf, 1, 0))) 114 | #endif 115 | ; 116 | 117 | int vim_snprintf_add(char *, size_t, const char *, ...) 118 | #ifdef USE_PRINTF_FORMAT_ATTRIBUTE 119 | __attribute__((format(printf, 3, 4))) 120 | #endif 121 | ; 122 | 123 | int vim_snprintf(char *, size_t, const char *, ...) 124 | #ifdef USE_PRINTF_FORMAT_ATTRIBUTE 125 | __attribute__((format(printf, 3, 4))) 126 | #endif 127 | ; 128 | 129 | int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap); 130 | int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, typval_T *tvs); 131 | 132 | #include "message.pro" 133 | #include "message2.pro" 134 | #include "misc1.pro" 135 | #include "misc2.pro" 136 | #ifndef HAVE_STRPBRK /* not generated automatically from misc2.c */ 137 | char_u *vim_strpbrk(char_u *s, char_u *charset); 138 | #endif 139 | #ifndef HAVE_QSORT 140 | /* Use our own qsort(), don't define the prototype when not used. */ 141 | void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void *, const void *)); 142 | #endif 143 | #include "mbyte.pro" 144 | #include "move.pro" 145 | #include "normal.pro" 146 | #include "ops.pro" 147 | #include "option.pro" 148 | #ifdef FEAT_QUICKFIX 149 | #include "quickfix.pro" 150 | #endif 151 | #include "regexp.pro" 152 | #include "screen.pro" 153 | #if defined(FEAT_PERSISTENT_UNDO) 154 | #include "sha256.pro" 155 | #endif 156 | #include "search.pro" 157 | #ifdef FEAT_SIGNS 158 | #include "sign.pro" 159 | #endif 160 | #include "state_insert_literal.pro" 161 | #include "state_machine.pro" 162 | #include "syntax.pro" 163 | #include "tag.pro" 164 | #include "term.pro" 165 | #ifdef FEAT_TERMINAL 166 | #include "terminal.pro" 167 | #endif 168 | #if defined(HAVE_TGETENT) && (defined(VMS)) 169 | #include "termlib.pro" 170 | #endif 171 | #include "ui.pro" 172 | #include "undo.pro" 173 | #include "usercmd.pro" 174 | #include "userfunc.pro" 175 | #include "version.pro" 176 | #include "window.pro" 177 | 178 | #ifdef FEAT_LUA 179 | #include "if_lua.pro" 180 | #endif 181 | 182 | #ifdef FEAT_MZSCHEME 183 | #include "if_mzsch.pro" 184 | #endif 185 | 186 | #ifdef FEAT_PYTHON 187 | #include "if_python.pro" 188 | #endif 189 | 190 | #ifdef FEAT_PYTHON3 191 | #include "if_python3.pro" 192 | #endif 193 | 194 | /* Ugly solution for "BalloonEval" not being defined while it's used in some 195 | * .pro files. */ 196 | #define BalloonEval int 197 | 198 | #ifdef FEAT_JOB_CHANNEL 199 | #include "channel.pro" 200 | 201 | /* Not generated automatically, to add extra attribute. */ 202 | void ch_log(channel_T *ch, const char *fmt, ...) 203 | #ifdef USE_PRINTF_FORMAT_ATTRIBUTE 204 | __attribute__((format(printf, 2, 3))) 205 | #endif 206 | ; 207 | 208 | #endif 209 | 210 | #if defined(FEAT_JOB_CHANNEL) 211 | #if defined(UNIX) || defined(MACOS_X) || defined(VMS) 212 | #include "pty.pro" 213 | #endif 214 | #endif 215 | 216 | #ifdef FEAT_OLE 217 | #include "if_ole.pro" 218 | #endif 219 | 220 | #ifdef MACOS_CONVERT 221 | #include "os_mac_conv.pro" 222 | #endif 223 | #if defined(MACOS_X_DARWIN) && defined(FEAT_CLIPBOARD) 224 | /* functions in os_macosx.m */ 225 | void clip_mch_lose_selection(VimClipboard *cbd); 226 | int clip_mch_own_selection(VimClipboard *cbd); 227 | void clip_mch_request_selection(VimClipboard *cbd); 228 | void clip_mch_set_selection(VimClipboard *cbd); 229 | #endif 230 | #endif /* !PROTO && !NOPROTO */ 231 | -------------------------------------------------------------------------------- /lib/libvim/proto/arabic.pro: -------------------------------------------------------------------------------- 1 | /* arabic.c */ 2 | int arabic_maycombine(int two); 3 | int arabic_combine(int one, int two); 4 | int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1, 5 | int next_c); 6 | /* vim: set ft=c : */ 7 | -------------------------------------------------------------------------------- /lib/libvim/proto/autocmd.pro: -------------------------------------------------------------------------------- 1 | /* autocmd.c */ 2 | void aubuflocal_remove(buf_T *buf); 3 | int au_has_group(char_u *name); 4 | void do_augroup(char_u *arg, int del_group); 5 | void free_all_autocmds(void); 6 | int check_ei(void); 7 | char_u *au_event_disable(char *what); 8 | void au_event_restore(char_u *old_ei); 9 | void do_autocmd(char_u *arg_in, int forceit); 10 | int do_doautocmd(char_u *arg, int do_msg, int *did_something); 11 | void ex_doautoall(exarg_T *eap); 12 | int check_nomodeline(char_u **argp); 13 | void aucmd_prepbuf(aco_save_T *aco, buf_T *buf); 14 | void aucmd_restbuf(aco_save_T *aco); 15 | int apply_autocmds(event_T event, char_u *fname, char_u *fname_io, int force, 16 | buf_T *buf); 17 | int apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, 18 | int force, buf_T *buf, exarg_T *eap); 19 | int apply_autocmds_retval(event_T event, char_u *fname, char_u *fname_io, 20 | int force, buf_T *buf, int *retval); 21 | int has_cursorhold(void); 22 | int trigger_cursorhold(void); 23 | int has_cursormoved(void); 24 | int has_cursormovedI(void); 25 | int has_textchanged(void); 26 | int has_textchangedI(void); 27 | int has_textchangedP(void); 28 | int has_insertcharpre(void); 29 | int has_cmdundefined(void); 30 | int has_funcundefined(void); 31 | int has_textyankpost(void); 32 | int has_completechanged(void); 33 | void block_autocmds(void); 34 | void unblock_autocmds(void); 35 | int is_autocmd_blocked(void); 36 | char_u *getnextac(int c, void *cookie, int indent); 37 | int has_autocmd(event_T event, char_u *sfname, buf_T *buf); 38 | char_u *get_augroup_name(expand_T *xp, int idx); 39 | char_u *set_context_in_autocmd(expand_T *xp, char_u *arg, int doautocmd); 40 | char_u *get_event_name(expand_T *xp, int idx); 41 | int autocmd_supported(char_u *name); 42 | int au_exists(char_u *arg); 43 | /* vim: set ft=c : */ 44 | -------------------------------------------------------------------------------- /lib/libvim/proto/blob.pro: -------------------------------------------------------------------------------- 1 | /* blob.c */ 2 | blob_T *blob_alloc(void); 3 | int rettv_blob_alloc(typval_T *rettv); 4 | void rettv_blob_set(typval_T *rettv, blob_T *b); 5 | int blob_copy(typval_T *from, typval_T *to); 6 | void blob_free(blob_T *b); 7 | void blob_unref(blob_T *b); 8 | long blob_len(blob_T *b); 9 | int blob_get(blob_T *b, int idx); 10 | void blob_set(blob_T *b, int idx, char_u c); 11 | int blob_equal(blob_T *b1, blob_T *b2); 12 | int read_blob(FILE *fd, blob_T *blob); 13 | int write_blob(FILE *fd, blob_T *blob); 14 | char_u *blob2string(blob_T *blob, char_u **tofree, char_u *numbuf); 15 | blob_T *string2blob(char_u *str); 16 | /* vim: set ft=c : */ 17 | -------------------------------------------------------------------------------- /lib/libvim/proto/buffer.pro: -------------------------------------------------------------------------------- 1 | /* buffer.c */ 2 | int open_buffer(int read_stdin, exarg_T *eap, int flags); 3 | void set_bufref(bufref_T *bufref, buf_T *buf); 4 | int bufref_valid(bufref_T *bufref); 5 | int buf_valid(buf_T *buf); 6 | void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last); 7 | void buf_clear_file(buf_T *buf); 8 | void buf_freeall(buf_T *buf, int flags); 9 | void goto_buffer(exarg_T *eap, int start, int dir, int count); 10 | void handle_swap_exists(bufref_T *old_curbuf); 11 | char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, 12 | int end_bnr, int forceit); 13 | int do_buffer(int action, int start, int dir, int count, int forceit); 14 | void set_curbuf(buf_T *buf, int action); 15 | void enter_buffer(buf_T *buf); 16 | void do_autochdir(void); 17 | void no_write_message(void); 18 | void no_write_message_nobang(buf_T *buf); 19 | int curbuf_reusable(void); 20 | buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, 21 | int flags); 22 | void free_buf_options(buf_T *buf, int free_p_ff); 23 | int buflist_getfile(int n, linenr_T lnum, int options, int forceit); 24 | void buflist_getfpos(void); 25 | buf_T *buflist_findname_exp(char_u *fname); 26 | buf_T *buflist_findname(char_u *ffname); 27 | int buflist_findpat(char_u *pattern, char_u *pattern_end, int unlisted, 28 | int diffmode, int curtab_only); 29 | int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options); 30 | buf_T *buflist_findnr(int nr); 31 | char_u *buflist_nr2name(int n, int fullname, int helptail); 32 | void get_winopts(buf_T *buf); 33 | pos_T *buflist_findfpos(buf_T *buf); 34 | linenr_T buflist_findlnum(buf_T *buf); 35 | void buflist_list(exarg_T *eap); 36 | int buflist_name_nr(int fnum, char_u **fname, linenr_T *lnum); 37 | int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, int message); 38 | void buf_set_name(int fnum, char_u *name); 39 | void buf_name_changed(buf_T *buf); 40 | buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum); 41 | char_u *getaltfname(int errmsg); 42 | int buflist_add(char_u *fname, int flags); 43 | void buflist_slash_adjust(void); 44 | void buflist_altfpos(win_T *win); 45 | int otherfile(char_u *ffname); 46 | void buf_setino(buf_T *buf); 47 | void fileinfo(int fullname, int shorthelp, int dont_truncate); 48 | void col_print(char_u *buf, size_t buflen, int col, int vcol); 49 | void get_rel_pos(win_T *wp, char_u *buf, int buflen); 50 | char_u *fix_fname(char_u *fname); 51 | void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname); 52 | char_u *alist_name(aentry_T *aep); 53 | void do_arg_all(int count, int forceit, int keep_tabs); 54 | void ex_buffer_all(exarg_T *eap); 55 | void do_modelines(int flags); 56 | int read_viminfo_bufferlist(vir_T *virp, int writing); 57 | void write_viminfo_bufferlist(FILE *fp); 58 | int bt_normal(buf_T *buf); 59 | int bt_quickfix(buf_T *buf); 60 | int bt_terminal(buf_T *buf); 61 | int bt_help(buf_T *buf); 62 | int bt_prompt(buf_T *buf); 63 | int bt_popup(buf_T *buf); 64 | int bt_nofile(buf_T *buf); 65 | int bt_dontwrite(buf_T *buf); 66 | int bt_dontwrite_msg(buf_T *buf); 67 | int buf_hide(buf_T *buf); 68 | char_u *buf_spname(buf_T *buf); 69 | void switch_to_win_for_buf(buf_T *buf, win_T **save_curwinp, 70 | tabpage_T **save_curtabp, bufref_T *save_curbuf); 71 | void restore_win_for_buf(win_T *save_curwin, tabpage_T *save_curtab, 72 | bufref_T *save_curbuf); 73 | int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp); 74 | void set_buflisted(int on); 75 | int buf_contents_changed(buf_T *buf); 76 | void wipe_buffer(buf_T *buf, int aucmd); 77 | /* vim: set ft=c : */ 78 | -------------------------------------------------------------------------------- /lib/libvim/proto/change.pro: -------------------------------------------------------------------------------- 1 | /* change.c */ 2 | void change_warning(int col); 3 | void changed(void); 4 | void changed_internal(void); 5 | void f_listener_add(typval_T *argvars, typval_T *rettv); 6 | void f_listener_flush(typval_T *argvars, typval_T *rettv); 7 | void f_listener_remove(typval_T *argvars, typval_T *rettv); 8 | void may_invoke_listeners(buf_T *buf, linenr_T lnum, linenr_T lnume, int added); 9 | void invoke_listeners(buf_T *buf); 10 | void changed_bytes(linenr_T lnum, colnr_T col); 11 | void inserted_bytes(linenr_T lnum, colnr_T col, int added); 12 | void appended_lines(linenr_T lnum, long count); 13 | void appended_lines_mark(linenr_T lnum, long count); 14 | void deleted_lines(linenr_T lnum, long count); 15 | void deleted_lines_mark(linenr_T lnum, long count); 16 | void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra); 17 | void changed_lines_buf(buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra); 18 | void unchanged(buf_T *buf, int ff); 19 | void ins_bytes(char_u *p); 20 | void ins_bytes_len(char_u *p, int len); 21 | void ins_char(int c); 22 | void ins_char_bytes(char_u *buf, int charlen); 23 | void ins_str(char_u *s); 24 | int del_char(int fixpos); 25 | int del_chars(long count, int fixpos); 26 | int del_bytes(long count, int fixpos_arg, int use_delcombine); 27 | int open_line(int dir, int flags, int second_line_indent); 28 | int truncate_line(int fixpos); 29 | void del_lines(long nlines, int undo); 30 | /* vim: set ft=c : */ 31 | -------------------------------------------------------------------------------- /lib/libvim/proto/channel.pro: -------------------------------------------------------------------------------- 1 | /* channel.c */ 2 | void ch_logfile(char_u *fname, char_u *opt); 3 | int ch_log_active(void); 4 | channel_T *add_channel(void); 5 | int has_any_channel(void); 6 | int channel_unref(channel_T *channel); 7 | int free_unused_channels_contents(int copyID, int mask); 8 | void free_unused_channels(int copyID, int mask); 9 | void channel_gui_register_all(void); 10 | channel_T *channel_open(char *hostname, int port_in, int waittime, 11 | void (*nb_close_cb)(void)); 12 | channel_T *channel_open_func(typval_T *argvars); 13 | void channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err); 14 | void channel_set_job(channel_T *channel, job_T *job, jobopt_T *options); 15 | void channel_set_options(channel_T *channel, jobopt_T *opt); 16 | void channel_set_req_callback(channel_T *channel, ch_part_T part, 17 | callback_T *callback, int id); 18 | void channel_buffer_free(buf_T *buf); 19 | void channel_write_any_lines(void); 20 | void channel_write_new_lines(buf_T *buf); 21 | readq_T *channel_peek(channel_T *channel, ch_part_T part); 22 | char_u *channel_first_nl(readq_T *node); 23 | char_u *channel_get(channel_T *channel, ch_part_T part, int *outlen); 24 | void channel_consume(channel_T *channel, ch_part_T part, int len); 25 | int channel_collapse(channel_T *channel, ch_part_T part, int want_nl); 26 | int channel_can_write_to(channel_T *channel); 27 | int channel_is_open(channel_T *channel); 28 | int channel_has_readahead(channel_T *channel, ch_part_T part); 29 | char *channel_status(channel_T *channel, int req_part); 30 | void channel_info(channel_T *channel, dict_T *dict); 31 | void channel_close(channel_T *channel, int invoke_close_cb); 32 | void channel_close_in(channel_T *channel); 33 | void channel_clear(channel_T *channel); 34 | void channel_free_all(void); 35 | void common_channel_read(typval_T *argvars, typval_T *rettv, int raw, int blob); 36 | channel_T *channel_fd2channel(sock_T fd, ch_part_T *partp); 37 | void channel_handle_events(int only_keep_open); 38 | int channel_any_keep_open(void); 39 | void channel_set_nonblock(channel_T *channel, ch_part_T part); 40 | int channel_send(channel_T *channel, ch_part_T part, char_u *buf_arg, 41 | int len_arg, char *fun); 42 | void ch_expr_common(typval_T *argvars, typval_T *rettv, int eval); 43 | void ch_raw_common(typval_T *argvars, typval_T *rettv, int eval); 44 | int channel_poll_setup(int nfd_in, void *fds_in, int *towait); 45 | int channel_poll_check(int ret_in, void *fds_in); 46 | int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in, 47 | struct timeval *tv, struct timeval **tvp); 48 | int channel_select_check(int ret_in, void *rfds_in, void *wfds_in); 49 | int channel_parse_messages(void); 50 | int channel_any_readahead(void); 51 | int set_ref_in_channel(int copyID); 52 | ch_part_T channel_part_send(channel_T *channel); 53 | ch_part_T channel_part_read(channel_T *channel); 54 | ch_mode_T channel_get_mode(channel_T *channel, ch_part_T part); 55 | int channel_get_timeout(channel_T *channel, ch_part_T part); 56 | void clear_job_options(jobopt_T *opt); 57 | void free_job_options(jobopt_T *opt); 58 | int get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2); 59 | channel_T *get_channel_arg(typval_T *tv, int check_open, int reading, 60 | ch_part_T part); 61 | void job_free_all(void); 62 | int job_any_running(void); 63 | int win32_build_cmd(list_T *l, garray_T *gap); 64 | void job_cleanup(job_T *job); 65 | int set_ref_in_job(int copyID); 66 | void job_unref(job_T *job); 67 | int free_unused_jobs_contents(int copyID, int mask); 68 | void free_unused_jobs(int copyID, int mask); 69 | job_T *job_alloc(void); 70 | void job_set_options(job_T *job, jobopt_T *opt); 71 | void job_stop_on_exit(void); 72 | int has_pending_job(void); 73 | int job_check_ended(void); 74 | job_T *job_start(typval_T *argvars, char **argv_arg, jobopt_T *opt_arg, 75 | int is_terminal); 76 | char *job_status(job_T *job); 77 | void job_info(job_T *job, dict_T *dict); 78 | void job_info_all(list_T *l); 79 | int job_stop(job_T *job, typval_T *argvars, char *type); 80 | void invoke_prompt_callback(void); 81 | int invoke_prompt_interrupt(void); 82 | /* vim: set ft=c : */ 83 | -------------------------------------------------------------------------------- /lib/libvim/proto/charset.pro: -------------------------------------------------------------------------------- 1 | /* charset.c */ 2 | int init_chartab(void); 3 | int buf_init_chartab(buf_T *buf, int global); 4 | void trans_characters(char_u *buf, int bufsize); 5 | char_u *transstr(char_u *s); 6 | char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen); 7 | char_u *transchar(int c); 8 | char_u *transchar_byte(int c); 9 | void transchar_nonprint(char_u *buf, int c); 10 | void transchar_hex(char_u *buf, int c); 11 | int byte2cells(int b); 12 | int char2cells(int c); 13 | int ptr2cells(char_u *p); 14 | int vim_strsize(char_u *s); 15 | int vim_strnsize(char_u *s, int len); 16 | int chartabsize(char_u *p, colnr_T col); 17 | int linetabsize(char_u *s); 18 | int linetabsize_col(int startcol, char_u *s); 19 | int win_linetabsize(win_T *wp, char_u *line, colnr_T len); 20 | int vim_isIDc(int c); 21 | int vim_iswordc(int c); 22 | int vim_iswordc_buf(int c, buf_T *buf); 23 | int vim_iswordp(char_u *p); 24 | int vim_iswordp_buf(char_u *p, buf_T *buf); 25 | int vim_isfilec(int c); 26 | int vim_isfilec_or_wc(int c); 27 | int vim_isprintc(int c); 28 | int vim_isprintc_strict(int c); 29 | int lbr_chartabsize(char_u *line, unsigned char *s, colnr_T col); 30 | int lbr_chartabsize_adv(char_u *line, char_u **s, colnr_T col); 31 | int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, 32 | int *headp); 33 | int in_win_border(win_T *wp, colnr_T vcol); 34 | void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, 35 | colnr_T *end); 36 | colnr_T getvcol_nolist(pos_T *posp); 37 | void getvvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, 38 | colnr_T *end); 39 | void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, 40 | colnr_T *right); 41 | char_u *skipwhite(char_u *q); 42 | int getwhitecols_curline(void); 43 | int getwhitecols(char_u *p); 44 | char_u *skipdigits(char_u *q); 45 | char_u *skipbin(char_u *q); 46 | char_u *skiphex(char_u *q); 47 | char_u *skiptobin(char_u *q); 48 | char_u *skiptodigit(char_u *q); 49 | char_u *skiptohex(char_u *q); 50 | int vim_isdigit(int c); 51 | int vim_isxdigit(int c); 52 | int vim_isbdigit(int c); 53 | int vim_islower(int c); 54 | int vim_isupper(int c); 55 | int vim_toupper(int c); 56 | int vim_tolower(int c); 57 | char_u *skiptowhite(char_u *p); 58 | char_u *skiptowhite_esc(char_u *p); 59 | long getdigits(char_u **pp); 60 | int vim_isblankline(char_u *lbuf); 61 | void vim_str2nr(char_u *start, int *prep, int *len, int what, varnumber_T *nptr, 62 | uvarnumber_T *unptr, int maxlen, int strict); 63 | int hex2nr(int c); 64 | int hexhex2nr(char_u *p); 65 | int rem_backslash(char_u *str); 66 | void backslash_halve(char_u *p); 67 | char_u *backslash_halve_save(char_u *p); 68 | void ebcdic2ascii(char_u *buffer, int len); 69 | /* vim: set ft=c : */ 70 | -------------------------------------------------------------------------------- /lib/libvim/proto/debugger.pro: -------------------------------------------------------------------------------- 1 | /* debugger.c */ 2 | int has_watchexpr(void); 3 | void do_debug(char_u *cmd); 4 | void ex_debug(exarg_T *eap); 5 | void dbg_check_breakpoint(exarg_T *eap); 6 | int dbg_check_skipped(exarg_T *eap); 7 | void ex_breakadd(exarg_T *eap); 8 | void ex_debuggreedy(exarg_T *eap); 9 | void ex_breakdel(exarg_T *eap); 10 | void ex_breaklist(exarg_T *eap); 11 | linenr_T dbg_find_breakpoint(int file, char_u *fname, linenr_T after); 12 | int has_profiling(int file, char_u *fname, int *fp); 13 | void dbg_breakpoint(char_u *name, linenr_T lnum); 14 | /* vim: set ft=c : */ 15 | -------------------------------------------------------------------------------- /lib/libvim/proto/dict.pro: -------------------------------------------------------------------------------- 1 | /* dict.c */ 2 | dict_T *dict_alloc(void); 3 | dict_T *dict_alloc_id(alloc_id_T id); 4 | dict_T *dict_alloc_lock(int lock); 5 | int rettv_dict_alloc(typval_T *rettv); 6 | void rettv_dict_set(typval_T *rettv, dict_T *d); 7 | void dict_free_contents(dict_T *d); 8 | void dict_unref(dict_T *d); 9 | int dict_free_nonref(int copyID); 10 | void dict_free_items(int copyID); 11 | dictitem_T *dictitem_alloc(char_u *key); 12 | void dictitem_remove(dict_T *dict, dictitem_T *item); 13 | void dictitem_free(dictitem_T *item); 14 | dict_T *dict_copy(dict_T *orig, int deep, int copyID); 15 | int dict_add(dict_T *d, dictitem_T *item); 16 | int dict_add_number(dict_T *d, char *key, varnumber_T nr); 17 | int dict_add_special(dict_T *d, char *key, varnumber_T nr); 18 | int dict_add_string(dict_T *d, char *key, char_u *str); 19 | int dict_add_string_len(dict_T *d, char *key, char_u *str, int len); 20 | int dict_add_list(dict_T *d, char *key, list_T *list); 21 | void dict_iterate_start(typval_T *var, dict_iterator_T *iter); 22 | char_u *dict_iterate_next(dict_iterator_T *iter, typval_T **tv_result); 23 | int dict_add_dict(dict_T *d, char *key, dict_T *dict); 24 | long dict_len(dict_T *d); 25 | dictitem_T *dict_find(dict_T *d, char_u *key, int len); 26 | char_u *dict_get_string(dict_T *d, char_u *key, int save); 27 | varnumber_T dict_get_number(dict_T *d, char_u *key); 28 | varnumber_T dict_get_number_check(dict_T *d, char_u *key); 29 | char_u *dict2string(typval_T *tv, int copyID, int restore_copyID); 30 | int dict_get_tv(char_u **arg, typval_T *rettv, int evaluate); 31 | void dict_extend(dict_T *d1, dict_T *d2, char_u *action); 32 | dictitem_T *dict_lookup(hashitem_T *hi); 33 | int dict_equal(dict_T *d1, dict_T *d2, int ic, int recursive); 34 | void dict_list(typval_T *argvars, typval_T *rettv, int what); 35 | void dict_set_items_ro(dict_T *di); 36 | /* vim: set ft=c : */ 37 | -------------------------------------------------------------------------------- /lib/libvim/proto/diff.pro: -------------------------------------------------------------------------------- 1 | /* diff.c */ 2 | void diff_buf_delete(buf_T *buf); 3 | void diff_buf_adjust(win_T *win); 4 | void diff_buf_add(buf_T *buf); 5 | void diff_invalidate(buf_T *buf); 6 | void diff_mark_adjust(linenr_T line1, linenr_T line2, long amount, 7 | long amount_after); 8 | int diff_internal(void); 9 | void ex_diffupdate(exarg_T *eap); 10 | void ex_diffpatch(exarg_T *eap); 11 | void ex_diffsplit(exarg_T *eap); 12 | void ex_diffthis(exarg_T *eap); 13 | void diff_win_options(win_T *wp, int addbuf); 14 | void ex_diffoff(exarg_T *eap); 15 | void diff_clear(tabpage_T *tp); 16 | int diff_check(win_T *wp, linenr_T lnum); 17 | int diff_check_fill(win_T *wp, linenr_T lnum); 18 | void diff_set_topline(win_T *fromwin, win_T *towin); 19 | int diffopt_changed(void); 20 | int diffopt_horizontal(void); 21 | int diffopt_hiddenoff(void); 22 | int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp); 23 | int diff_infold(win_T *wp, linenr_T lnum); 24 | void nv_diffgetput(int put, long count); 25 | void ex_diffgetput(exarg_T *eap); 26 | int diff_mode_buf(buf_T *buf); 27 | int diff_move_to(int dir, long count); 28 | linenr_T diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1); 29 | linenr_T diff_lnum_win(linenr_T lnum, win_T *wp); 30 | /* vim: set ft=c : */ 31 | -------------------------------------------------------------------------------- /lib/libvim/proto/digraph.pro: -------------------------------------------------------------------------------- 1 | /* digraph.c */ 2 | int do_digraph(int c); 3 | char_u *get_digraph_for_char(int val_arg); 4 | int get_digraph(int cmdline); 5 | int getdigraph(int char1, int char2, int meta_char); 6 | void putdigraph(char_u *str); 7 | void listdigraphs(int use_headers); 8 | char *keymap_init(void); 9 | void ex_loadkeymap(exarg_T *eap); 10 | void keymap_clear(garray_T *kmap); 11 | /* vim: set ft=c : */ 12 | -------------------------------------------------------------------------------- /lib/libvim/proto/edit.pro: -------------------------------------------------------------------------------- 1 | /* edit.c */ 2 | void *state_edit_initialize(int cmdchar, int startln, long count); 3 | void state_edit_cleanup(void *ctx); 4 | executionStatus_T state_edit_execute(void *ctx, int c); 5 | 6 | int edit(int cmdchar, int startln, long count); 7 | int ins_need_undo_get(void); 8 | void ins_redraw(int ready); 9 | void edit_putchar(int c, int highlight); 10 | char_u *prompt_text(void); 11 | int prompt_curpos_editable(void); 12 | void edit_unputchar(void); 13 | void display_dollar(colnr_T col); 14 | void change_indent(int type, int amount, int round, int replaced, 15 | int call_changed_bytes); 16 | void truncate_spaces(char_u *line); 17 | void backspace_until_column(int col); 18 | int get_literal(void); 19 | void insertchar(int c, int flags, int second_indent); 20 | void auto_format(int trailblank, int prev_line); 21 | int comp_textwidth(int ff); 22 | void start_arrow(pos_T *end_insert_pos); 23 | int stop_arrow(void); 24 | void set_last_insert(int c); 25 | void free_last_insert(void); 26 | char_u *add_char2buf(int c, char_u *s); 27 | void beginline(int flags); 28 | int oneright(void); 29 | int oneleft(void); 30 | int cursor_up(long n, int upd_topline); 31 | int cursor_down(long n, int upd_topline); 32 | int stuff_inserted(int c, long count, int no_esc); 33 | char_u *get_last_insert(void); 34 | char_u *get_last_insert_save(void); 35 | void replace_push(int c); 36 | int replace_push_mb(char_u *p); 37 | int hkmap(int c); 38 | int bracketed_paste(paste_mode_T mode, int drop, garray_T *gap); 39 | void ins_scroll(void); 40 | void ins_horscroll(void); 41 | int ins_eol(int c); 42 | int ins_copychar(linenr_T lnum); 43 | colnr_T get_nolist_virtcol(void); 44 | int can_cindent_get(void); 45 | int ins_apply_autocmds(event_T event); 46 | /* vim: set ft=c : */ 47 | -------------------------------------------------------------------------------- /lib/libvim/proto/evalfunc.pro: -------------------------------------------------------------------------------- 1 | /* evalfunc.c */ 2 | char_u *get_function_name(expand_T *xp, int idx); 3 | char_u *get_expr_name(expand_T *xp, int idx); 4 | int find_internal_func(char_u *name); 5 | int call_internal_func(char_u *name, int argcount, typval_T *argvars, 6 | typval_T *rettv); 7 | buf_T *buflist_find_by_name(char_u *name, int curtab_only); 8 | buf_T *tv_get_buf(typval_T *tv, int curtab_only); 9 | buf_T *get_buf_arg(typval_T *arg); 10 | void execute_redir_str(char_u *value, int value_len); 11 | void mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv); 12 | float_T vim_round(float_T f); 13 | long do_searchpair(char_u *spat, char_u *mpat, char_u *epat, int dir, 14 | typval_T *skip, int flags, pos_T *match_pos, 15 | linenr_T lnum_stop, long time_limit); 16 | void f_string(typval_T *argvars, typval_T *rettv); 17 | callback_T get_callback(typval_T *arg); 18 | void put_callback(callback_T *cb, typval_T *tv); 19 | void set_callback(callback_T *dest, callback_T *src); 20 | void free_callback(callback_T *callback); 21 | /* vim: set ft=c : */ 22 | -------------------------------------------------------------------------------- /lib/libvim/proto/ex_cmds.pro: -------------------------------------------------------------------------------- 1 | /* ex_cmds.c */ 2 | void do_ascii(exarg_T *eap); 3 | void ex_align(exarg_T *eap); 4 | void ex_sort(exarg_T *eap); 5 | void ex_retab(exarg_T *eap); 6 | int do_move(linenr_T line1, linenr_T line2, linenr_T dest); 7 | void ex_copy(linenr_T line1, linenr_T line2, linenr_T n); 8 | void free_prev_shellcmd(void); 9 | void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out); 10 | void do_shell(char_u *cmd, int flags); 11 | char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp); 12 | void append_redir(char_u *buf, int buflen, char_u *opt, char_u *fname); 13 | int viminfo_error(char *errnum, char *message, char_u *line); 14 | int read_viminfo(char_u *file, int flags); 15 | void write_viminfo(char_u *file, int forceit); 16 | int viminfo_readline(vir_T *virp); 17 | char_u *viminfo_readstring(vir_T *virp, int off, int convert); 18 | void viminfo_writestring(FILE *fd, char_u *p); 19 | int barline_writestring(FILE *fd, char_u *s, int remaining_start); 20 | time_T vim_time(void); 21 | void do_fixdel(exarg_T *eap); 22 | void print_line_no_prefix(linenr_T lnum, int use_number, int list); 23 | void print_line(linenr_T lnum, int use_number, int list); 24 | int rename_buffer(char_u *new_fname); 25 | void ex_file(exarg_T *eap); 26 | void ex_update(exarg_T *eap); 27 | void ex_write(exarg_T *eap); 28 | int do_write(exarg_T *eap); 29 | int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, 30 | int other); 31 | void ex_wnext(exarg_T *eap); 32 | void do_wqall(exarg_T *eap); 33 | int not_writing(void); 34 | int getfile(int fnum, char_u *ffname_arg, char_u *sfname_arg, int setpm, 35 | linenr_T lnum, int forceit); 36 | int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, 37 | linenr_T newlnum, int flags, win_T *oldwin); 38 | void ex_append(exarg_T *eap); 39 | void ex_change(exarg_T *eap); 40 | void ex_z(exarg_T *eap); 41 | int check_restricted(void); 42 | int check_secure(void); 43 | void do_sub(exarg_T *eap); 44 | int do_sub_msg(int count_only); 45 | void ex_global(exarg_T *eap); 46 | void global_exe(char_u *cmd); 47 | int read_viminfo_sub_string(vir_T *virp, int force); 48 | void write_viminfo_sub_string(FILE *fp); 49 | void free_old_sub(void); 50 | int prepare_tagpreview(int undo_sync); 51 | void ex_help(exarg_T *eap); 52 | void ex_helpclose(exarg_T *eap); 53 | char_u *check_help_lang(char_u *arg); 54 | int help_heuristic(char_u *matched_string, int offset, int wrong_case); 55 | int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, 56 | int keep_lang); 57 | void fix_help_buffer(void); 58 | void ex_exusage(exarg_T *eap); 59 | void ex_viusage(exarg_T *eap); 60 | void ex_helptags(exarg_T *eap); 61 | void ex_drop(exarg_T *eap); 62 | char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags); 63 | void ex_oldfiles(exarg_T *eap); 64 | /* vim: set ft=c : */ 65 | -------------------------------------------------------------------------------- /lib/libvim/proto/ex_cmds2.pro: -------------------------------------------------------------------------------- 1 | /* ex_cmds2.c */ 2 | void profile_start(proftime_T *tm); 3 | void profile_end(proftime_T *tm); 4 | void profile_sub(proftime_T *tm, proftime_T *tm2); 5 | char *profile_msg(proftime_T *tm); 6 | float_T profile_float(proftime_T *tm); 7 | void profile_setlimit(long msec, proftime_T *tm); 8 | int profile_passed_limit(proftime_T *tm); 9 | void profile_zero(proftime_T *tm); 10 | long proftime_time_left(proftime_T *due, proftime_T *now); 11 | timer_T *create_timer(long msec, int repeat); 12 | long check_due_timer(void); 13 | timer_T *find_timer(long id); 14 | void stop_timer(timer_T *timer); 15 | void stop_all_timers(void); 16 | void add_timer_info(typval_T *rettv, timer_T *timer); 17 | void add_timer_info_all(typval_T *rettv); 18 | int set_ref_in_timer(int copyID); 19 | void timer_free_all(void); 20 | void profile_divide(proftime_T *tm, int count, proftime_T *tm2); 21 | void profile_add(proftime_T *tm, proftime_T *tm2); 22 | void profile_self(proftime_T *self, proftime_T *total, proftime_T *children); 23 | void profile_get_wait(proftime_T *tm); 24 | void profile_sub_wait(proftime_T *tm, proftime_T *tma); 25 | int profile_equal(proftime_T *tm1, proftime_T *tm2); 26 | int profile_cmp(const proftime_T *tm1, const proftime_T *tm2); 27 | void ex_profile(exarg_T *eap); 28 | char_u *get_profile_name(expand_T *xp, int idx); 29 | void set_context_in_profile_cmd(expand_T *xp, char_u *arg); 30 | void profile_dump(void); 31 | void script_prof_save(proftime_T *tm); 32 | void script_prof_restore(proftime_T *tm); 33 | void prof_inchar_enter(void); 34 | void prof_inchar_exit(void); 35 | int prof_def_func(void); 36 | int autowrite(buf_T *buf, int forceit); 37 | void autowrite_all(void); 38 | int check_changed(buf_T *buf, int flags); 39 | void browse_save_fname(buf_T *buf); 40 | void dialog_changed(buf_T *buf, int checkall); 41 | int can_abandon(buf_T *buf, int forceit); 42 | int check_changed_any(int hidden, int unload); 43 | int check_fname(void); 44 | int buf_write_all(buf_T *buf, int forceit); 45 | int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, int wig); 46 | void set_arglist(char_u *str); 47 | void check_arg_idx(win_T *win); 48 | void ex_args(exarg_T *eap); 49 | void ex_previous(exarg_T *eap); 50 | void ex_rewind(exarg_T *eap); 51 | void ex_last(exarg_T *eap); 52 | void ex_argument(exarg_T *eap); 53 | void do_argfile(exarg_T *eap, int argn); 54 | void ex_next(exarg_T *eap); 55 | void ex_argedit(exarg_T *eap); 56 | void ex_argadd(exarg_T *eap); 57 | void ex_argdelete(exarg_T *eap); 58 | void ex_listdo(exarg_T *eap); 59 | char_u *get_arglist_name(expand_T *xp, int idx); 60 | void ex_compiler(exarg_T *eap); 61 | void ex_runtime(exarg_T *eap); 62 | int do_in_path(char_u *path, char_u *name, int flags, 63 | void (*callback)(char_u *fname, void *ck), void *cookie); 64 | int do_in_runtimepath(char_u *name, int flags, 65 | void (*callback)(char_u *fname, void *ck), void *cookie); 66 | int source_runtime(char_u *name, int flags); 67 | int source_in_path(char_u *path, char_u *name, int flags); 68 | void add_pack_start_dirs(void); 69 | void load_start_packages(void); 70 | void ex_packloadall(exarg_T *eap); 71 | void ex_packadd(exarg_T *eap); 72 | void ex_options(exarg_T *eap); 73 | void init_pyxversion(void); 74 | void ex_pyxfile(exarg_T *eap); 75 | void ex_pyx(exarg_T *eap); 76 | void ex_pyxdo(exarg_T *eap); 77 | void ex_source(exarg_T *eap); 78 | linenr_T *source_breakpoint(void *cookie); 79 | int *source_dbg_tick(void *cookie); 80 | int source_level(void *cookie); 81 | int do_source(char_u *fname, int check_other, int is_vimrc); 82 | void ex_scriptnames(exarg_T *eap); 83 | void scriptnames_slash_adjust(void); 84 | char_u *get_scriptname(scid_T id); 85 | void free_scriptnames(void); 86 | char_u *getsourceline(int c, void *cookie, int indent); 87 | void script_line_start(void); 88 | void script_line_exec(void); 89 | void script_line_end(void); 90 | void ex_scriptencoding(exarg_T *eap); 91 | void ex_scriptversion(exarg_T *eap); 92 | void ex_finish(exarg_T *eap); 93 | void do_finish(exarg_T *eap, int reanimate); 94 | int source_finished(char_u *(*fgetline)(int, void *, int), void *cookie); 95 | void ex_checktime(exarg_T *eap); 96 | char_u *get_mess_lang(void); 97 | void set_lang_var(void); 98 | void ex_language(exarg_T *eap); 99 | void free_locales(void); 100 | char_u *get_lang_arg(expand_T *xp, int idx); 101 | char_u *get_locales(expand_T *xp, int idx); 102 | /* vim: set ft=c : */ 103 | -------------------------------------------------------------------------------- /lib/libvim/proto/ex_docmd.pro: -------------------------------------------------------------------------------- 1 | /* ex_docmd.c */ 2 | void do_exmode(int improved); 3 | int do_cmdline_cmd(char_u *cmd); 4 | int do_cmdline(char_u *cmdline, char_u *(*fgetline)(int, void *, int), 5 | void *cookie, int flags); 6 | int getline_equal(char_u *(*fgetline)(int, void *, int), void *cookie, 7 | char_u *(*func)(int, void *, int)); 8 | void *getline_cookie(char_u *(*fgetline)(int, void *, int), void *cookie); 9 | int parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only); 10 | int parse_cmd_address(exarg_T *eap, char **errormsg, int silent); 11 | int checkforcmd(char_u **pp, char *cmd, int len); 12 | int modifier_len(char_u *cmd); 13 | int cmd_exists(char_u *name); 14 | char_u *set_one_cmd_context(expand_T *xp, char_u *buff); 15 | char_u *skip_range(char_u *cmd, int *ctx); 16 | void ex_ni(exarg_T *eap); 17 | int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp); 18 | void separate_nextcmd(exarg_T *eap); 19 | int get_bad_opt(char_u *p, exarg_T *eap); 20 | int ends_excmd(int c); 21 | char_u *find_nextcmd(char_u *p); 22 | char_u *check_nextcmd(char_u *p); 23 | char_u *get_command_name(expand_T *xp, int idx); 24 | void not_exiting(void); 25 | void tabpage_close(int forceit); 26 | void tabpage_close_other(tabpage_T *tp, int forceit); 27 | void ex_all(exarg_T *eap); 28 | void handle_drop(int filec, char_u **filev, int split, void (*callback)(void *), 29 | void *cookie); 30 | void handle_any_postponed_drop(void); 31 | void alist_clear(alist_T *al); 32 | void alist_init(alist_T *al); 33 | void alist_unlink(alist_T *al); 34 | void alist_new(void); 35 | void alist_expand(int *fnum_list, int fnum_len); 36 | void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, 37 | int *fnum_list, int fnum_len); 38 | void alist_add(alist_T *al, char_u *fname, int set_fnum); 39 | void alist_slash_adjust(void); 40 | void ex_splitview(exarg_T *eap); 41 | void tabpage_new(void); 42 | void do_exedit(exarg_T *eap, win_T *old_curwin); 43 | void free_cd_dir(void); 44 | void post_chdir(cdscope_T cdscope); 45 | int changedir_func(char_u *new_dir, int forceit, cdscope_T cdscope); 46 | void ex_cd(exarg_T *eap); 47 | void do_sleep(long msec); 48 | void ex_may_print(exarg_T *eap); 49 | void ex_redraw(exarg_T *eap); 50 | int vim_mkdir_emsg(char_u *name, int prot); 51 | FILE *open_exfile(char_u *fname, int forceit, char *mode); 52 | void update_topline_cursor(void); 53 | int save_current_state(save_state_T *sst); 54 | void restore_current_state(save_state_T *sst); 55 | void ex_normal(exarg_T *eap); 56 | void exec_normal(int was_typed, int use_vpeekc, int may_use_terminal_loop); 57 | int find_cmdline_var(char_u *src, int *usedlen); 58 | char_u *eval_vars(char_u *src, char_u *srcstart, int *usedlen, linenr_T *lnump, 59 | char **errormsg, int *escaped); 60 | char_u *expand_sfile(char_u *arg); 61 | int put_eol(FILE *fd); 62 | int put_line(FILE *fd, char *s); 63 | void dialog_msg(char_u *buff, char *format, char_u *fname); 64 | char_u *get_behave_arg(expand_T *xp, int idx); 65 | char_u *get_messages_arg(expand_T *xp, int idx); 66 | char_u *get_mapclear_arg(expand_T *xp, int idx); 67 | void set_no_hlsearch(int flag); 68 | int is_loclist_cmd(int cmdidx); 69 | int get_pressedreturn(void); 70 | void set_pressedreturn(int val); 71 | /* vim: set ft=c : */ 72 | -------------------------------------------------------------------------------- /lib/libvim/proto/ex_eval.pro: -------------------------------------------------------------------------------- 1 | /* ex_eval.c */ 2 | int aborting(void); 3 | void update_force_abort(void); 4 | int should_abort(int retcode); 5 | int aborted_in_try(void); 6 | int cause_errthrow(char_u *mesg, int severe, int *ignore); 7 | void free_global_msglist(void); 8 | void do_errthrow(struct condstack *cstack, char_u *cmdname); 9 | int do_intthrow(struct condstack *cstack); 10 | char *get_exception_string(void *value, except_type_T type, char_u *cmdname, 11 | int *should_free); 12 | void discard_current_exception(void); 13 | void report_make_pending(int pending, void *value); 14 | void report_resume_pending(int pending, void *value); 15 | void report_discard_pending(int pending, void *value); 16 | void ex_if(exarg_T *eap); 17 | void ex_endif(exarg_T *eap); 18 | void ex_else(exarg_T *eap); 19 | void ex_while(exarg_T *eap); 20 | void ex_continue(exarg_T *eap); 21 | void ex_break(exarg_T *eap); 22 | void ex_endwhile(exarg_T *eap); 23 | void ex_throw(exarg_T *eap); 24 | void do_throw(struct condstack *cstack); 25 | void ex_try(exarg_T *eap); 26 | void ex_catch(exarg_T *eap); 27 | void ex_finally(exarg_T *eap); 28 | void ex_endtry(exarg_T *eap); 29 | void enter_cleanup(cleanup_T *csp); 30 | void leave_cleanup(cleanup_T *csp); 31 | int cleanup_conditionals(struct condstack *cstack, int searched_cond, 32 | int inclusive); 33 | void rewind_conditionals(struct condstack *cstack, int idx, int cond_type, 34 | int *cond_level); 35 | void ex_endfunction(exarg_T *eap); 36 | int has_loop_cmd(char_u *p); 37 | /* vim: set ft=c : */ 38 | -------------------------------------------------------------------------------- /lib/libvim/proto/ex_getln.pro: -------------------------------------------------------------------------------- 1 | /* ex_getln.c */ 2 | 3 | void *state_cmdline_initialize(int c, long count UNUSED, int indent); 4 | executionStatus_T state_cmdline_execute(void *ctx, int c); 5 | void state_cmdline_cleanup(void *context); 6 | 7 | void cmdline_init(void); 8 | char_u *getcmdline(int firstc, long count, int indent); 9 | char_u *getcmdline_prompt(int firstc, char_u *prompt, int attr, int xp_context, 10 | char_u *xp_arg); 11 | int text_locked(void); 12 | void text_locked_msg(void); 13 | char *get_text_locked_msg(void); 14 | int curbuf_locked(void); 15 | int allbuf_locked(void); 16 | char_u *getexline(int c, void *cookie, int indent); 17 | char_u *getexmodeline(int promptc, void *cookie, int indent); 18 | int cmdline_overstrike(void); 19 | int cmdline_at_end(void); 20 | colnr_T cmdline_getvcol_cursor(void); 21 | void free_cmdline_buf(void); 22 | void putcmdline(int c, int shift); 23 | void unputcmdline(void); 24 | int put_on_cmdline(char_u *str, int len, int redraw); 25 | void cmdline_paste_str(char_u *s, int literally); 26 | void redrawcmdline(void); 27 | void redrawcmdline_ex(int do_compute_cmdrow); 28 | void redrawcmd(void); 29 | void compute_cmdrow(void); 30 | void gotocmdline(int clr); 31 | char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, 32 | int mode); 33 | void ExpandInit(expand_T *xp); 34 | void ExpandCleanup(expand_T *xp); 35 | void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, 36 | int options); 37 | char_u *vim_strsave_fnameescape(char_u *fname, int shell); 38 | void tilde_replace(char_u *orig_pat, int num_files, char_u **files); 39 | char_u *sm_gettail(char_u *s); 40 | char_u *addstar(char_u *fname, int len, int context); 41 | void set_cmd_context(expand_T *xp, char_u *str, int len, int col, 42 | int use_ccline); 43 | int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, 44 | char_u ***matches); 45 | int ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, 46 | char_u ***file, char_u *((*func)(expand_T *, int)), 47 | int escaped); 48 | void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options); 49 | void init_history(void); 50 | int get_histtype(char_u *name); 51 | void add_to_history(int histype, char_u *new_entry, int in_map, int sep); 52 | int get_history_idx(int histype); 53 | char_u *get_history_entry(int histype, int idx); 54 | int clr_history(int histype); 55 | int del_history_entry(int histype, char_u *str); 56 | int del_history_idx(int histype, int idx); 57 | char_u *get_cmdline_str(void); 58 | int get_cmdline_pos(void); 59 | int set_cmdline_pos(int pos); 60 | int get_cmdline_type(void); 61 | int get_list_range(char_u **str, int *num1, int *num2); 62 | void ex_history(exarg_T *eap); 63 | void prepare_viminfo_history(int asklen, int writing); 64 | int read_viminfo_history(vir_T *virp, int writing); 65 | void handle_viminfo_history(garray_T *values, int writing); 66 | void finish_viminfo_history(vir_T *virp); 67 | void write_viminfo_history(FILE *fp, int merge); 68 | char_u *script_get(exarg_T *eap, char_u *cmd); 69 | /* vim: set ft=c : */ 70 | -------------------------------------------------------------------------------- /lib/libvim/proto/fileio.pro: -------------------------------------------------------------------------------- 1 | /* fileio.c */ 2 | void filemess(buf_T *buf, char_u *name, char_u *s, int attr); 3 | int readfile(char_u *fname, char_u *sfname, linenr_T from, 4 | linenr_T lines_to_skip, linenr_T lines_to_read, exarg_T *eap, 5 | int flags); 6 | int is_dev_fd_file(char_u *fname); 7 | int prep_exarg(exarg_T *eap, buf_T *buf); 8 | void set_file_options(int set_options, exarg_T *eap); 9 | void set_forced_fenc(exarg_T *eap); 10 | int check_file_readonly(char_u *fname, int perm); 11 | int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, 12 | linenr_T end, exarg_T *eap, int append, int forceit, 13 | int reset_changed, int filtering); 14 | int vim_fsync(int fd); 15 | void msg_add_fname(buf_T *buf, char_u *fname); 16 | void msg_add_lines(int insert_space, long lnum, off_T nchars); 17 | char_u *shorten_fname1(char_u *full_path); 18 | char_u *shorten_fname(char_u *full_path, char_u *dir_name); 19 | void shorten_buf_fname(buf_T *buf, char_u *dirname, int force); 20 | void shorten_fnames(int force); 21 | void shorten_filenames(char_u **fnames, int count); 22 | char_u *modname(char_u *fname, char_u *ext, int prepend_dot); 23 | char_u *buf_modname(int shortname, char_u *fname, char_u *ext, int prepend_dot); 24 | int vim_fgets(char_u *buf, int size, FILE *fp); 25 | int vim_rename(char_u *from, char_u *to); 26 | int check_timestamps(int focus); 27 | int buf_check_timestamp(buf_T *buf, int focus); 28 | void buf_reload(buf_T *buf, int orig_mode); 29 | void buf_store_time(buf_T *buf, stat_T *st, char_u *fname); 30 | void write_lnum_adjust(linenr_T offset); 31 | int readdir_core(garray_T *gap, char_u *path, void *context, 32 | int (*checkitem)(void *context, char_u *name)); 33 | int delete_recursive(char_u *name); 34 | void vim_deltempdir(void); 35 | char_u *vim_tempname(int extra_char, int keep); 36 | void forward_slash(char_u *fname); 37 | int match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, 38 | char_u *sfname, char_u *tail, int allow_dirs); 39 | int match_file_list(char_u *list, char_u *sfname, char_u *ffname); 40 | char_u *file_pat_to_reg_pat(char_u *pat, char_u *pat_end, char *allow_dirs, 41 | int no_bslash); 42 | long read_eintr(int fd, void *buf, size_t bufsize); 43 | long write_eintr(int fd, void *buf, size_t bufsize); 44 | /* vim: set ft=c : */ 45 | -------------------------------------------------------------------------------- /lib/libvim/proto/findfile.pro: -------------------------------------------------------------------------------- 1 | /* findfile.c */ 2 | void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, 3 | int level, int free_visited, int find_what, 4 | void *search_ctx_arg, int tagfile, char_u *rel_fname); 5 | char_u *vim_findfile_stopdir(char_u *buf); 6 | void vim_findfile_cleanup(void *ctx); 7 | char_u *vim_findfile(void *search_ctx_arg); 8 | void vim_findfile_free_visited(void *search_ctx_arg); 9 | char_u *find_file_in_path(char_u *ptr, int len, int options, int first, 10 | char_u *rel_fname); 11 | void free_findfile(void); 12 | char_u *find_directory_in_path(char_u *ptr, int len, int options, 13 | char_u *rel_fname); 14 | char_u *find_file_in_path_option(char_u *ptr, int len, int options, int first, 15 | char_u *path_option, int find_what, 16 | char_u *rel_fname, char_u *suffixes); 17 | char_u *grab_file_name(long count, linenr_T *file_lnum); 18 | char_u *file_name_at_cursor(int options, long count, linenr_T *file_lnum); 19 | char_u *file_name_in_line(char_u *line, int col, int options, long count, 20 | char_u *rel_fname, linenr_T *file_lnum); 21 | char_u *find_file_name_in_path(char_u *ptr, int len, int options, long count, 22 | char_u *rel_fname); 23 | int vim_ispathlistsep(int c); 24 | void uniquefy_paths(garray_T *gap, char_u *pattern); 25 | int expand_in_path(garray_T *gap, char_u *pattern, int flags); 26 | void simplify_filename(char_u *filename); 27 | /* vim: set ft=c : */ 28 | -------------------------------------------------------------------------------- /lib/libvim/proto/fold.pro: -------------------------------------------------------------------------------- 1 | /* fold.c */ 2 | void copyFoldingState(win_T *wp_from, win_T *wp_to); 3 | int hasAnyFolding(win_T *win); 4 | int hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp); 5 | int hasFoldingWin(win_T *win, linenr_T lnum, linenr_T *firstp, linenr_T *lastp, 6 | int cache, foldinfo_T *infop); 7 | int foldLevel(linenr_T lnum); 8 | int lineFolded(win_T *win, linenr_T lnum); 9 | long foldedCount(win_T *win, linenr_T lnum, foldinfo_T *infop); 10 | int foldmethodIsManual(win_T *wp); 11 | int foldmethodIsIndent(win_T *wp); 12 | int foldmethodIsExpr(win_T *wp); 13 | int foldmethodIsMarker(win_T *wp); 14 | int foldmethodIsSyntax(win_T *wp); 15 | int foldmethodIsDiff(win_T *wp); 16 | void closeFold(linenr_T lnum, long count); 17 | void closeFoldRecurse(linenr_T lnum); 18 | void opFoldRange(linenr_T first, linenr_T last, int opening, int recurse, 19 | int had_visual); 20 | void openFold(linenr_T lnum, long count); 21 | void openFoldRecurse(linenr_T lnum); 22 | void foldOpenCursor(void); 23 | void newFoldLevel(void); 24 | void foldCheckClose(void); 25 | int foldManualAllowed(int create); 26 | void foldCreate(linenr_T start, linenr_T end); 27 | void deleteFold(linenr_T start, linenr_T end, int recursive, int had_visual); 28 | void clearFolding(win_T *win); 29 | void foldUpdate(win_T *wp, linenr_T top, linenr_T bot); 30 | void foldUpdateAll(win_T *win); 31 | int foldMoveTo(int updown, int dir, long count); 32 | void foldInitWin(win_T *new_win); 33 | int find_wl_entry(win_T *win, linenr_T lnum); 34 | void foldAdjustVisual(void); 35 | void foldAdjustCursor(void); 36 | void cloneFoldGrowArray(garray_T *from, garray_T *to); 37 | void deleteFoldRecurse(garray_T *gap); 38 | void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, 39 | long amount_after); 40 | int getDeepestNesting(void); 41 | char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, 42 | foldinfo_T *foldinfo, char_u *buf); 43 | void foldtext_cleanup(char_u *str); 44 | void foldMoveRange(garray_T *gap, linenr_T line1, linenr_T line2, 45 | linenr_T dest); 46 | int put_folds(FILE *fd, win_T *wp); 47 | /* vim: set ft=c : */ 48 | -------------------------------------------------------------------------------- /lib/libvim/proto/getchar.pro: -------------------------------------------------------------------------------- 1 | /* getchar.c */ 2 | void free_buff(buffheader_T *buf); 3 | char_u *get_recorded(void); 4 | char_u *get_inserted(void); 5 | int stuff_empty(void); 6 | int readbuf1_empty(void); 7 | void typeahead_noflush(int c); 8 | void flush_buffers(flush_buffers_T flush_typeahead); 9 | void ResetRedobuff(void); 10 | void CancelRedo(void); 11 | void saveRedobuff(save_redo_T *save_redo); 12 | void restoreRedobuff(save_redo_T *save_redo); 13 | void AppendToRedobuff(char_u *s); 14 | void AppendToRedobuffLit(char_u *str, int len); 15 | void AppendCharToRedobuff(int c); 16 | void AppendNumberToRedobuff(long n); 17 | void stuffReadbuff(char_u *s); 18 | void stuffRedoReadbuff(char_u *s); 19 | void stuffReadbuffLen(char_u *s, long len); 20 | void stuffReadbuffSpec(char_u *s); 21 | void stuffcharReadbuff(int c); 22 | void stuffnumReadbuff(long n); 23 | int start_redo(long count, int old_redo); 24 | int start_redo_ins(void); 25 | void stop_redo_ins(void); 26 | int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent); 27 | void ins_char_typebuf(int c); 28 | int typebuf_changed(int tb_change_cnt); 29 | int typebuf_typed(void); 30 | int typebuf_maplen(void); 31 | void del_typebuf(int len, int offset); 32 | int alloc_typebuf(void); 33 | void free_typebuf(void); 34 | int save_typebuf(void); 35 | void save_typeahead(tasave_T *tp); 36 | void restore_typeahead(tasave_T *tp); 37 | void openscript(char_u *name, int directly); 38 | void close_all_scripts(void); 39 | int using_script(void); 40 | void before_blocking(void); 41 | void updatescript(int c); 42 | int vgetc(void); 43 | int safe_vgetc(void); 44 | int plain_vgetc(void); 45 | int vpeekc(void); 46 | int vpeekc_nomap(void); 47 | int vpeekc_any(void); 48 | int char_avail(void); 49 | void vungetc(int c); 50 | int fix_input_buffer(char_u *buf, int len); 51 | int input_available(void); 52 | int do_map(int maptype, char_u *arg, int mode, int abbrev); 53 | int get_map_mode(char_u **cmdp, int forceit); 54 | void map_clear(char_u *cmdp, char_u *arg, int forceit, int abbr); 55 | void map_clear_int(buf_T *buf, int mode, int local, int abbr); 56 | char_u *map_mode_to_chars(int mode); 57 | int map_to_exists(char_u *str, char_u *modechars, int abbr); 58 | int map_to_exists_mode(char_u *rhs, int mode, int abbr); 59 | char_u *set_context_in_map_cmd(expand_T *xp, char_u *cmd, char_u *arg, 60 | int forceit, int isabbrev, int isunmap, 61 | cmdidx_T cmdidx); 62 | int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file); 63 | int check_abbr(int c, char_u *ptr, int col, int mincol); 64 | char_u *vim_strsave_escape_csi(char_u *p); 65 | void vim_unescape_csi(char_u *p); 66 | int makemap(FILE *fd, buf_T *buf); 67 | int put_escstr(FILE *fd, char_u *strstart, int what); 68 | void check_map_keycodes(void); 69 | char_u *check_map(char_u *keys, int mode, int exact, int ign_mod, int abbr, 70 | mapblock_T **mp_ptr, int *local_ptr); 71 | void init_mappings(void); 72 | void add_map(char_u *map, int mode); 73 | /* vim: set ft=c : */ 74 | -------------------------------------------------------------------------------- /lib/libvim/proto/hashtab.pro: -------------------------------------------------------------------------------- 1 | /* hashtab.c */ 2 | void hash_init(hashtab_T *ht); 3 | void hash_clear(hashtab_T *ht); 4 | void hash_clear_all(hashtab_T *ht, int off); 5 | hashitem_T *hash_find(hashtab_T *ht, char_u *key); 6 | hashitem_T *hash_lookup(hashtab_T *ht, char_u *key, hash_T hash); 7 | void hash_debug_results(void); 8 | int hash_add(hashtab_T *ht, char_u *key); 9 | int hash_add_item(hashtab_T *ht, hashitem_T *hi, char_u *key, hash_T hash); 10 | void hash_remove(hashtab_T *ht, hashitem_T *hi); 11 | void hash_lock(hashtab_T *ht); 12 | void hash_unlock(hashtab_T *ht); 13 | hash_T hash_hash(char_u *key); 14 | /* vim: set ft=c : */ 15 | -------------------------------------------------------------------------------- /lib/libvim/proto/if_lua.pro: -------------------------------------------------------------------------------- 1 | /* if_lua.c */ 2 | int lua_enabled(int verbose); 3 | void lua_end(void); 4 | void ex_lua(exarg_T *eap); 5 | void ex_luado(exarg_T *eap); 6 | void ex_luafile(exarg_T *eap); 7 | void lua_buffer_free(buf_T *o); 8 | void lua_window_free(win_T *o); 9 | void do_luaeval(char_u *str, typval_T *arg, typval_T *rettv); 10 | int set_ref_in_lua(int copyID); 11 | /* vim: set ft=c : */ 12 | -------------------------------------------------------------------------------- /lib/libvim/proto/if_mzsch.pro: -------------------------------------------------------------------------------- 1 | /* if_mzsch.c */ 2 | int mzscheme_enabled(int verbose); 3 | void mzvim_check_threads(void); 4 | void mzvim_reset_timer(void); 5 | void mzscheme_end(void); 6 | int mzscheme_main(void); 7 | void mzscheme_buffer_free(buf_T *buf); 8 | void mzscheme_window_free(win_T *win); 9 | void ex_mzscheme(exarg_T *eap); 10 | void ex_mzfile(exarg_T *eap); 11 | void do_mzeval(char_u *str, typval_T *rettv); 12 | void raise_vim_exn(const char *add_info); 13 | void raise_if_error(void); 14 | buf_T *get_valid_buffer(void *obj); 15 | win_T *get_valid_window(void *obj); 16 | int mzthreads_allowed(void); 17 | /* vim: set ft=c : */ 18 | -------------------------------------------------------------------------------- /lib/libvim/proto/if_ole.pro: -------------------------------------------------------------------------------- 1 | /* if_ole.cpp */ 2 | void InitOLE(int *pbDoRestart); 3 | void UninitOLE(void); 4 | void RegisterMe(int silent); 5 | void UnregisterMe(int bNotifyUser); 6 | -------------------------------------------------------------------------------- /lib/libvim/proto/if_python.pro: -------------------------------------------------------------------------------- 1 | /* if_python.c */ 2 | int python_enabled(int verbose); 3 | void python_end(void); 4 | int python_loaded(void); 5 | void ex_python(exarg_T *eap); 6 | void ex_pyfile(exarg_T *eap); 7 | void ex_pydo(exarg_T *eap); 8 | void python_buffer_free(buf_T *buf); 9 | void python_window_free(win_T *win); 10 | void python_tabpage_free(tabpage_T *tab); 11 | void do_pyeval(char_u *str, typval_T *rettv); 12 | int set_ref_in_python(int copyID); 13 | /* vim: set ft=c : */ 14 | -------------------------------------------------------------------------------- /lib/libvim/proto/if_python3.pro: -------------------------------------------------------------------------------- 1 | /* if_python3.c */ 2 | int python3_enabled(int verbose); 3 | void python3_end(void); 4 | int python3_loaded(void); 5 | void ex_py3(exarg_T *eap); 6 | void ex_py3file(exarg_T *eap); 7 | void ex_py3do(exarg_T *eap); 8 | void python3_buffer_free(buf_T *buf); 9 | void python3_window_free(win_T *win); 10 | void python3_tabpage_free(tabpage_T *tab); 11 | void do_py3eval(char_u *str, typval_T *rettv); 12 | int set_ref_in_python3(int copyID); 13 | /* vim: set ft=c : */ 14 | -------------------------------------------------------------------------------- /lib/libvim/proto/indent.pro: -------------------------------------------------------------------------------- 1 | /* indent.c */ 2 | int cin_is_cinword(char_u *line); 3 | pos_T *find_start_comment(int ind_maxcomment); 4 | int cindent_on(void); 5 | int cin_islabel(void); 6 | int cin_iscase(char_u *s, int strict); 7 | int cin_isscopedecl(char_u *s); 8 | void parse_cino(buf_T *buf); 9 | int get_c_indent(void); 10 | int get_expr_indent(void); 11 | int in_cinkeys(int keytyped, int when, int line_is_empty); 12 | int get_lisp_indent(void); 13 | void do_c_expr_indent(void); 14 | void fixthisline(int (*get_the_indent)(void)); 15 | void fix_indent(void); 16 | /* vim: set ft=c : */ 17 | -------------------------------------------------------------------------------- /lib/libvim/proto/json.pro: -------------------------------------------------------------------------------- 1 | /* json.c */ 2 | char_u *json_encode(typval_T *val, int options); 3 | char_u *json_encode_nr_expr(int nr, typval_T *val, int options); 4 | int json_decode_all(js_read_T *reader, typval_T *res, int options); 5 | int json_decode(js_read_T *reader, typval_T *res, int options); 6 | int json_find_end(js_read_T *reader, int options); 7 | /* vim: set ft=c : */ 8 | -------------------------------------------------------------------------------- /lib/libvim/proto/list.pro: -------------------------------------------------------------------------------- 1 | /* list.c */ 2 | void list_add_watch(list_T *l, listwatch_T *lw); 3 | void list_rem_watch(list_T *l, listwatch_T *lwrem); 4 | void list_fix_watch(list_T *l, listitem_T *item); 5 | list_T *list_alloc(void); 6 | list_T *list_alloc_id(alloc_id_T id); 7 | int rettv_list_alloc(typval_T *rettv); 8 | int rettv_list_alloc_id(typval_T *rettv, alloc_id_T id); 9 | void rettv_list_set(typval_T *rettv, list_T *l); 10 | void list_unref(list_T *l); 11 | int list_free_nonref(int copyID); 12 | void list_free_items(int copyID); 13 | void list_free(list_T *l); 14 | listitem_T *listitem_alloc(void); 15 | void listitem_free(listitem_T *item); 16 | void listitem_remove(list_T *l, listitem_T *item); 17 | long list_len(list_T *l); 18 | int list_equal(list_T *l1, list_T *l2, int ic, int recursive); 19 | listitem_T *list_find(list_T *l, long n); 20 | long list_find_nr(list_T *l, long idx, int *errorp); 21 | char_u *list_find_str(list_T *l, long idx); 22 | long list_idx_of_item(list_T *l, listitem_T *item); 23 | void list_append(list_T *l, listitem_T *item); 24 | int list_append_tv(list_T *l, typval_T *tv); 25 | int list_append_dict(list_T *list, dict_T *dict); 26 | int list_append_list(list_T *list1, list_T *list2); 27 | int list_append_string(list_T *l, char_u *str, int len); 28 | int list_append_number(list_T *l, varnumber_T n); 29 | int list_insert_tv(list_T *l, typval_T *tv, listitem_T *item); 30 | void list_insert(list_T *l, listitem_T *ni, listitem_T *item); 31 | int list_extend(list_T *l1, list_T *l2, listitem_T *bef); 32 | 33 | /* Renamed from list_concat -> vim_list_concat due to clash with OCaml namespace 34 | */ 35 | int vim_list_concat(list_T *l1, list_T *l2, typval_T *tv); 36 | 37 | list_T *list_copy(list_T *orig, int deep, int copyID); 38 | void vimlist_remove(list_T *l, listitem_T *item, listitem_T *item2); 39 | char_u *list2string(typval_T *tv, int copyID, int restore_copyID); 40 | int list_join(garray_T *gap, list_T *l, char_u *sep, int echo_style, 41 | int restore_copyID, int copyID); 42 | int get_list_tv(char_u **arg, typval_T *rettv, int evaluate); 43 | int write_list(FILE *fd, list_T *list, int binary); 44 | void init_static_list(staticList10_T *sl); 45 | /* vim: set ft=c : */ 46 | -------------------------------------------------------------------------------- /lib/libvim/proto/main.pro: -------------------------------------------------------------------------------- 1 | /* main.c */ 2 | int vim_main2(void); 3 | void common_init(mparm_T *paramp); 4 | int is_not_a_term(void); 5 | void main_loop(int cmdwin, int noexmode); 6 | void getout_preserve_modified(int exitval); 7 | void getout(int exitval); 8 | int process_env(char_u *env, int is_viminit); 9 | void mainerr_arg_missing(char_u *str); 10 | void time_push(void *tv_rel, void *tv_start); 11 | void time_pop(void *tp); 12 | void time_msg(char *mesg, void *tv_start); 13 | void server_to_input_buf(char_u *str); 14 | char_u *eval_client_expr_to_string(char_u *expr); 15 | int sendToLocalVim(char_u *cmd, int asExpr, char_u **result); 16 | char_u *serverConvert(char_u *client_enc, char_u *data, char_u **tofree); 17 | /* vim: set ft=c : */ 18 | -------------------------------------------------------------------------------- /lib/libvim/proto/mark.pro: -------------------------------------------------------------------------------- 1 | /* mark.c */ 2 | int setmark(int c); 3 | int setmark_pos(int c, pos_T *pos, int fnum); 4 | void setpcmark(void); 5 | void checkpcmark(void); 6 | pos_T *movemark(int count); 7 | pos_T *movechangelist(int count); 8 | pos_T *getmark_buf(buf_T *buf, int c, int changefile); 9 | pos_T *getmark(int c, int changefile); 10 | pos_T *getmark_buf_fnum(buf_T *buf, int c, int changefile, int *fnum); 11 | pos_T *getnextmark(pos_T *startpos, int dir, int begin_line); 12 | void fname2fnum(xfmark_T *fm); 13 | void fmarks_check_names(buf_T *buf); 14 | int check_mark(pos_T *pos); 15 | void clrallmarks(buf_T *buf); 16 | char_u *fm_getname(fmark_T *fmark, int lead_len); 17 | void do_marks(exarg_T *eap); 18 | void ex_delmarks(exarg_T *eap); 19 | void ex_jumps(exarg_T *eap); 20 | void ex_clearjumps(exarg_T *eap); 21 | void ex_changes(exarg_T *eap); 22 | void mark_adjust(linenr_T line1, linenr_T line2, long amount, 23 | long amount_after); 24 | void mark_adjust_nofold(linenr_T line1, linenr_T line2, long amount, 25 | long amount_after); 26 | void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, 27 | long col_amount, int spaces_removed); 28 | void cleanup_jumplist(win_T *wp, int loadfiles); 29 | void copy_jumplist(win_T *from, win_T *to); 30 | void free_jumplist(win_T *wp); 31 | void set_last_cursor(win_T *win); 32 | void free_all_marks(void); 33 | int read_viminfo_filemark(vir_T *virp, int force); 34 | void prepare_viminfo_marks(void); 35 | void finish_viminfo_marks(void); 36 | void handle_viminfo_mark(garray_T *values, int force); 37 | void write_viminfo_filemarks(FILE *fp); 38 | int removable(char_u *name); 39 | void write_viminfo_marks(FILE *fp_out, garray_T *buflist); 40 | void copy_viminfo_marks(vir_T *virp, FILE *fp_out, garray_T *buflist, int eof, 41 | int flags); 42 | /* vim: set ft=c : */ 43 | -------------------------------------------------------------------------------- /lib/libvim/proto/mbyte.pro: -------------------------------------------------------------------------------- 1 | /* mbyte.c */ 2 | int enc_canon_props(char_u *name); 3 | char *mb_init(void); 4 | int bomb_size(void); 5 | void remove_bom(char_u *s); 6 | int mb_get_class(char_u *p); 7 | int mb_get_class_buf(char_u *p, buf_T *buf); 8 | int dbcs_class(unsigned lead, unsigned trail); 9 | int latin_char2len(int c); 10 | int latin_char2bytes(int c, char_u *buf); 11 | int latin_ptr2len(char_u *p); 12 | int latin_ptr2len_len(char_u *p, int size); 13 | int utf_uint2cells(UINT32_T c); 14 | int utf_char2cells(int c); 15 | int latin_ptr2cells(char_u *p); 16 | int utf_ptr2cells(char_u *p); 17 | int dbcs_ptr2cells(char_u *p); 18 | int latin_ptr2cells_len(char_u *p, int size); 19 | int latin_char2cells(int c); 20 | int mb_string2cells(char_u *p, int len); 21 | int latin_off2cells(unsigned off, unsigned max_off); 22 | int dbcs_off2cells(unsigned off, unsigned max_off); 23 | int utf_off2cells(unsigned off, unsigned max_off); 24 | int latin_ptr2char(char_u *p); 25 | int utf_ptr2char(char_u *p); 26 | int mb_ptr2char_adv(char_u **pp); 27 | int mb_cptr2char_adv(char_u **pp); 28 | int utf_composinglike(char_u *p1, char_u *p2); 29 | int utfc_ptr2char(char_u *p, int *pcc); 30 | int utfc_ptr2char_len(char_u *p, int *pcc, int maxlen); 31 | int utfc_char2bytes(int off, char_u *buf); 32 | int utf_ptr2len(char_u *p); 33 | int utf_byte2len(int b); 34 | int utf_ptr2len_len(char_u *p, int size); 35 | int utfc_ptr2len(char_u *p); 36 | int utfc_ptr2len_len(char_u *p, int size); 37 | int utf_char2len(int c); 38 | int utf_char2bytes(int c, char_u *buf); 39 | int utf_iscomposing_uint(UINT32_T c); 40 | int utf_iscomposing(int c); 41 | int utf_printable(int c); 42 | int utf_class(int c); 43 | int utf_class_buf(int c, buf_T *buf); 44 | int utf_ambiguous_width(int c); 45 | int utf_fold(int a); 46 | int utf_toupper(int a); 47 | int utf_islower(int a); 48 | int utf_tolower(int a); 49 | int utf_isupper(int a); 50 | int mb_strnicmp(char_u *s1, char_u *s2, size_t nn); 51 | void show_utf8(void); 52 | int latin_head_off(char_u *base, char_u *p); 53 | int dbcs_head_off(char_u *base, char_u *p); 54 | int dbcs_screen_head_off(char_u *base, char_u *p); 55 | int utf_head_off(char_u *base, char_u *p); 56 | void mb_copy_char(char_u **fp, char_u **tp); 57 | int mb_off_next(char_u *base, char_u *p); 58 | int mb_tail_off(char_u *base, char_u *p); 59 | void utf_find_illegal(void); 60 | int utf_valid_string(char_u *s, char_u *end); 61 | int dbcs_screen_tail_off(char_u *base, char_u *p); 62 | void mb_adjust_cursor(void); 63 | void mb_adjustpos(buf_T *buf, pos_T *lp); 64 | char_u *mb_prevptr(char_u *line, char_u *p); 65 | int mb_charlen(char_u *str); 66 | int mb_charlen_len(char_u *str, int len); 67 | char_u *mb_unescape(char_u **pp); 68 | int mb_lefthalve(int row, int col); 69 | int mb_fix_col(int col, int row); 70 | char_u *enc_skip(char_u *p); 71 | char_u *enc_canonize(char_u *enc); 72 | char_u *enc_locale_env(char *locale); 73 | char_u *enc_locale(void); 74 | int encname2codepage(char_u *name); 75 | void *my_iconv_open(char_u *to, char_u *from); 76 | int iconv_enabled(int verbose); 77 | void iconv_end(void); 78 | void im_set_active(int active); 79 | void xim_set_focus(int focus); 80 | void im_set_position(int row, int col); 81 | void xim_set_preedit(void); 82 | int im_get_feedback_attr(int col); 83 | void xim_init(void); 84 | void im_shutdown(void); 85 | int im_xim_isvalid_imactivate(void); 86 | void xim_reset(void); 87 | int xim_queue_key_press_event(GdkEventKey *event, int down); 88 | int im_get_status(void); 89 | int preedit_get_status(void); 90 | int im_is_preediting(void); 91 | void xim_set_status_area(void); 92 | int xim_get_status_area_height(void); 93 | int convert_setup(vimconv_T *vcp, char_u *from, char_u *to); 94 | int convert_setup_ext(vimconv_T *vcp, char_u *from, int from_unicode_is_utf8, 95 | char_u *to, int to_unicode_is_utf8); 96 | int convert_input(char_u *ptr, int len, int maxlen); 97 | int convert_input_safe(char_u *ptr, int len, int maxlen, char_u **restp, 98 | int *restlenp); 99 | char_u *string_convert(vimconv_T *vcp, char_u *ptr, int *lenp); 100 | char_u *string_convert_ext(vimconv_T *vcp, char_u *ptr, int *lenp, 101 | int *unconvlenp); 102 | /* vim: set ft=c : */ 103 | -------------------------------------------------------------------------------- /lib/libvim/proto/memfile.pro: -------------------------------------------------------------------------------- 1 | /* memfile.c */ 2 | memfile_T *mf_open(char_u *fname, int flags); 3 | int mf_open_file(memfile_T *mfp, char_u *fname); 4 | void mf_close(memfile_T *mfp, int del_file); 5 | void mf_close_file(buf_T *buf, int getlines); 6 | void mf_new_page_size(memfile_T *mfp, unsigned new_size); 7 | bhdr_T *mf_new(memfile_T *mfp, int negative, int page_count); 8 | bhdr_T *mf_get(memfile_T *mfp, blocknr_T nr, int page_count); 9 | void mf_put(memfile_T *mfp, bhdr_T *hp, int dirty, int infile); 10 | void mf_free(memfile_T *mfp, bhdr_T *hp); 11 | int mf_sync(memfile_T *mfp, int flags); 12 | void mf_set_dirty(memfile_T *mfp); 13 | int mf_release_all(void); 14 | blocknr_T mf_trans_del(memfile_T *mfp, blocknr_T old_nr); 15 | void mf_set_ffname(memfile_T *mfp); 16 | void mf_fullname(memfile_T *mfp); 17 | int mf_need_trans(memfile_T *mfp); 18 | /* vim: set ft=c : */ 19 | -------------------------------------------------------------------------------- /lib/libvim/proto/memline.pro: -------------------------------------------------------------------------------- 1 | /* memline.c */ 2 | int ml_open(buf_T *buf); 3 | void ml_setname(buf_T *buf); 4 | void ml_open_files(void); 5 | void ml_open_file(buf_T *buf); 6 | void check_need_swap(int newfile); 7 | void ml_close(buf_T *buf, int del_file); 8 | void ml_close_all(int del_file); 9 | void ml_close_notmod(void); 10 | void ml_timestamp(buf_T *buf); 11 | void ml_recover(int checkext); 12 | int recover_names(char_u *fname, int list, int nr, char_u **fname_out); 13 | char_u *make_percent_swname(char_u *dir, char_u *name); 14 | void get_b0_dict(char_u *fname, dict_T *d); 15 | char *get_ctime(time_t thetime, int add_newline); 16 | void ml_sync_all(int check_file, int check_char); 17 | void ml_preserve(buf_T *buf, int message); 18 | char_u *ml_get(linenr_T lnum); 19 | char_u *ml_get_pos(pos_T *pos); 20 | char_u *ml_get_curline(void); 21 | char_u *ml_get_cursor(void); 22 | char_u *ml_get_buf(buf_T *buf, linenr_T lnum, int will_change); 23 | int ml_line_alloced(void); 24 | int ml_append(linenr_T lnum, char_u *line, colnr_T len, int newfile); 25 | int ml_append_buf(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, 26 | int newfile); 27 | int ml_replace(linenr_T lnum, char_u *line, int copy); 28 | int ml_replace_len(linenr_T lnum, char_u *line_arg, colnr_T len_arg, 29 | int has_props, int copy); 30 | int ml_delete(linenr_T lnum, int message); 31 | int ml_delete_buf(buf_T *buf, linenr_T lnum, int message); 32 | void ml_setmarked(linenr_T lnum); 33 | linenr_T ml_firstmarked(void); 34 | void ml_clearmarked(void); 35 | int resolve_symlink(char_u *fname, char_u *buf); 36 | char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf, 37 | char_u *dir_name); 38 | char_u *get_file_in_dir(char_u *fname, char_u *dname); 39 | void ml_setflags(buf_T *buf); 40 | long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp); 41 | void goto_byte(long cnt); 42 | /* vim: set ft=c : */ 43 | -------------------------------------------------------------------------------- /lib/libvim/proto/message.pro: -------------------------------------------------------------------------------- 1 | /* message.c */ 2 | int msg(char *s); 3 | int verb_msg(char *s); 4 | int msg_attr(char *s, int attr); 5 | int msg_attr_keep(char *s, int attr, int keep); 6 | char_u *msg_strtrunc(char_u *s, int force); 7 | void trunc_string(char_u *s, char_u *buf, int room_in, int buflen); 8 | void reset_last_sourcing(void); 9 | void msg_source(int attr); 10 | int emsg_not_now(void); 11 | void ignore_error_for_testing(char_u *error); 12 | void do_perror(char *msg); 13 | int emsg(char *s); 14 | void iemsg(char *s); 15 | void internal_error(char *where); 16 | void emsg_invreg(int name); 17 | char *msg_trunc_attr(char *s, int force, int attr); 18 | char_u *msg_may_trunc(int force, char_u *s); 19 | char_u *get_emsg_source(void); 20 | char_u *get_emsg_lnum(void); 21 | int delete_first_msg(void); 22 | void ex_messages(exarg_T *eap); 23 | void msg_end_prompt(void); 24 | void wait_return(int redraw); 25 | void set_keep_msg(char_u *s, int attr); 26 | void set_keep_msg_from_hist(void); 27 | void msg_start(void); 28 | void msg_starthere(void); 29 | void msg_putchar(int c); 30 | void msg_putchar_attr(int c, int attr); 31 | void msg_outnum(long n); 32 | void msg_home_replace(char_u *fname); 33 | void msg_home_replace_hl(char_u *fname); 34 | int msg_outtrans(char_u *str); 35 | int msg_outtrans_attr(char_u *str, int attr); 36 | int msg_outtrans_len(char_u *str, int len); 37 | char_u *msg_outtrans_one(char_u *p, int attr); 38 | int msg_outtrans_len_attr(char_u *msgstr, int len, int attr); 39 | void msg_make(char_u *arg); 40 | int msg_outtrans_special(char_u *strstart, int from, int maxlen); 41 | char_u *str2special_save(char_u *str, int is_lhs); 42 | char_u *str2special(char_u **sp, int from); 43 | void str2specialbuf(char_u *sp, char_u *buf, int len); 44 | void msg_prt_line(char_u *s, int list); 45 | void msg_puts(char *s); 46 | void msg_puts_title(char *s); 47 | void msg_outtrans_long_attr(char_u *longstr, int attr); 48 | void msg_outtrans_long_len_attr(char_u *longstr, int len, int attr); 49 | void msg_puts_attr(char *s, int attr); 50 | int message_filtered(char_u *msg); 51 | void may_clear_sb_text(void); 52 | void sb_text_start_cmdline(void); 53 | void sb_text_end_cmdline(void); 54 | void clear_sb_text(int all); 55 | void show_sb_text(void); 56 | void msg_sb_eol(void); 57 | int msg_use_printf(void); 58 | void mch_errmsg(char *str); 59 | void mch_msg(char *str); 60 | void msg_moremsg(int full); 61 | void repeat_message(void); 62 | void msg_clr_eos(void); 63 | void msg_clr_eos_force(void); 64 | void msg_clr_cmdline(void); 65 | int msg_end(void); 66 | void msg_check(void); 67 | int redirecting(void); 68 | void verbose_enter(void); 69 | void verbose_leave(void); 70 | void verbose_enter_scroll(void); 71 | void verbose_leave_scroll(void); 72 | void verbose_stop(void); 73 | int verbose_open(void); 74 | void give_warning(char_u *message, int hl); 75 | void give_warning2(char_u *message, char_u *a1, int hl); 76 | void msg_advance(int col); 77 | int do_dialog(int type, char_u *title, char_u *message, char_u *buttons, 78 | int dfltbutton, char_u *textfield, int ex_cmd); 79 | void display_confirm_msg(void); 80 | int vim_dialog_yesno(int type, char_u *title, char_u *message, int dflt); 81 | int vim_dialog_yesnocancel(int type, char_u *title, char_u *message, int dflt); 82 | int vim_dialog_yesnoallcancel(int type, char_u *title, char_u *message, 83 | int dflt); 84 | char_u *do_browse(int flags, char_u *title, char_u *dflt, char_u *ext, 85 | char_u *initdir, char_u *filter, buf_T *buf); 86 | /* vim: set ft=c : */ 87 | -------------------------------------------------------------------------------- /lib/libvim/proto/message2.pro: -------------------------------------------------------------------------------- 1 | /* message2.c */ 2 | 3 | msg_T *msg2_create(msgPriority_T priority); 4 | char_u *msg2_get_contents(msg_T *msg); 5 | void msg2_set_title(char_u *title, msg_T *msg); 6 | void msg2_put(char_u *s, msg_T *msg); 7 | void msg2_send(msg_T *msg); 8 | void msg2_source(msg_T *msg); 9 | void msg2_free(msg_T *msg); 10 | 11 | /* vim: set ft=c : */ 12 | -------------------------------------------------------------------------------- /lib/libvim/proto/misc1.pro: -------------------------------------------------------------------------------- 1 | /* misc1.c */ 2 | int get_indent(void); 3 | int get_indent_lnum(linenr_T lnum); 4 | int get_indent_buf(buf_T *buf, linenr_T lnum); 5 | int get_indent_str(char_u *ptr, int ts, int list); 6 | int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list); 7 | int set_indent(int size, int flags); 8 | int get_number_indent(linenr_T lnum); 9 | int get_breakindent_win(win_T *wp, char_u *line); 10 | int get_leader_len(char_u *line, char_u **flags, int backward, 11 | int include_space); 12 | int get_last_leader_offset(char_u *line, char_u **flags); 13 | int plines(linenr_T lnum); 14 | int plines_win(win_T *wp, linenr_T lnum, int winheight); 15 | int plines_nofill(linenr_T lnum); 16 | int plines_win_nofill(win_T *wp, linenr_T lnum, int winheight); 17 | int plines_win_nofold(win_T *wp, linenr_T lnum); 18 | int plines_win_col(win_T *wp, linenr_T lnum, long column); 19 | int plines_m_win(win_T *wp, linenr_T first, linenr_T last); 20 | int gchar_pos(pos_T *pos); 21 | int gchar_cursor(void); 22 | void pchar_cursor(int c); 23 | int inindent(int extra); 24 | char_u *skip_to_option_part(char_u *p); 25 | void check_status(buf_T *buf); 26 | int ask_yesno(char_u *str, int direct); 27 | int is_mouse_key(int c); 28 | int get_keystroke(void); 29 | int get_number(int colon, int *mouse_used); 30 | int prompt_for_number(int *mouse_used); 31 | void msgmore(long n); 32 | void beep_flush(void); 33 | void vim_beep(unsigned val); 34 | void init_homedir(void); 35 | void free_homedir(void); 36 | void free_users(void); 37 | char_u *expand_env_save(char_u *src); 38 | char_u *expand_env_save_opt(char_u *src, int one); 39 | void expand_env(char_u *src, char_u *dst, int dstlen); 40 | void expand_env_esc(char_u *srcp, char_u *dst, int dstlen, int esc, int one, 41 | char_u *startstr); 42 | char_u *vim_getenv(char_u *name, int *mustfree); 43 | void vim_unsetenv(char_u *var); 44 | void vim_setenv(char_u *name, char_u *val); 45 | char_u *get_env_name(expand_T *xp, int idx); 46 | char_u *get_users(expand_T *xp, int idx); 47 | int match_user(char_u *name); 48 | void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen, int one); 49 | char_u *home_replace_save(buf_T *buf, char_u *src); 50 | int fullpathcmp(char_u *s1, char_u *s2, int checkname, int expandenv); 51 | char_u *gettail(char_u *fname); 52 | char_u *gettail_sep(char_u *fname); 53 | char_u *getnextcomp(char_u *fname); 54 | char_u *get_past_head(char_u *path); 55 | int vim_ispathsep(int c); 56 | int vim_ispathsep_nocolon(int c); 57 | void shorten_dir(char_u *str); 58 | int dir_of_file_exists(char_u *fname); 59 | int vim_fnamecmp(char_u *x, char_u *y); 60 | int vim_fnamencmp(char_u *x, char_u *y, size_t len); 61 | char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep); 62 | char_u *concat_str(char_u *str1, char_u *str2); 63 | void add_pathsep(char_u *p); 64 | char_u *FullName_save(char_u *fname, int force); 65 | void prepare_to_exit(void); 66 | void preserve_exit(void); 67 | int vim_fexists(char_u *fname); 68 | void line_breakcheck(void); 69 | void fast_breakcheck(void); 70 | int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file, 71 | int flags); 72 | int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files, 73 | int flags); 74 | int match_suffix(char_u *fname); 75 | int unix_expandpath(garray_T *gap, char_u *path, int wildoff, int flags, 76 | int didstar); 77 | void remove_duplicates(garray_T *gap); 78 | int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, 79 | char_u ***file, int flags); 80 | void addfile(garray_T *gap, char_u *f, int flags); 81 | char_u *get_cmd_output(char_u *cmd, char_u *infile, int flags, int *ret_len); 82 | void FreeWild(int count, char_u **files); 83 | int goto_im(void); 84 | char_u *get_isolated_shell_name(void); 85 | int path_is_url(char_u *p); 86 | int path_with_url(char_u *fname); 87 | int vim_isAbsName(char_u *name); 88 | int vim_FullName(char_u *fname, char_u *buf, int len, int force); 89 | /* vim: set ft=c : */ 90 | -------------------------------------------------------------------------------- /lib/libvim/proto/misc2.pro: -------------------------------------------------------------------------------- 1 | /* misc2.c */ 2 | int virtual_active(void); 3 | int getviscol(void); 4 | int coladvance_force(colnr_T wcol); 5 | int getviscol2(colnr_T col, colnr_T coladd); 6 | int coladvance(colnr_T wcol); 7 | int getvpos(pos_T *pos, colnr_T wcol); 8 | int inc_cursor(void); 9 | int inc(pos_T *lp); 10 | int incl(pos_T *lp); 11 | int dec_cursor(void); 12 | int dec(pos_T *lp); 13 | int decl(pos_T *lp); 14 | linenr_T get_cursor_rel_lnum(win_T *wp, linenr_T lnum); 15 | void check_pos(buf_T *buf, pos_T *pos); 16 | void check_cursor_lnum(void); 17 | void check_cursor_col(void); 18 | void check_cursor_col_win(win_T *win); 19 | void check_cursor(void); 20 | void adjust_cursor_col(void); 21 | int leftcol_changed(void); 22 | void vim_mem_profile_dump(void); 23 | int alloc_does_fail(size_t size); 24 | void *alloc(size_t size); 25 | void *alloc_id(size_t size, alloc_id_T id); 26 | void *alloc_clear(size_t size); 27 | void *alloc_clear_id(size_t size, alloc_id_T id); 28 | void *lalloc_clear(size_t size, int message); 29 | void *lalloc(size_t size, int message); 30 | void *lalloc_id(size_t size, int message, alloc_id_T id); 31 | void *mem_realloc(void *ptr, size_t size); 32 | void do_outofmem_msg(size_t size); 33 | void free_all_mem(void); 34 | char_u *vim_strsave(char_u *string); 35 | char_u *vim_strnsave(char_u *string, int len); 36 | char_u *vim_memsave(char_u *p, size_t len); 37 | char_u *vim_strsave_escaped(char_u *string, char_u *esc_chars); 38 | char_u *vim_strsave_escaped_ext(char_u *string, char_u *esc_chars, int cc, 39 | int bsl); 40 | int csh_like_shell(void); 41 | char_u *vim_strsave_shellescape(char_u *string, int do_special, int do_newline); 42 | char_u *vim_strsave_up(char_u *string); 43 | char_u *vim_strnsave_up(char_u *string, int len); 44 | void vim_strup(char_u *p); 45 | char_u *strup_save(char_u *orig); 46 | char_u *strlow_save(char_u *orig); 47 | void del_trailing_spaces(char_u *ptr); 48 | void vim_strncpy(char_u *to, char_u *from, size_t len); 49 | void vim_strcat(char_u *to, char_u *from, size_t tosize); 50 | int copy_option_part(char_u **option, char_u *buf, int maxlen, char *sep_chars); 51 | void vim_free(void *x); 52 | int vim_stricmp(char *s1, char *s2); 53 | int vim_strnicmp(char *s1, char *s2, size_t len); 54 | char_u *vim_strchr(char_u *string, int c); 55 | char_u *vim_strbyte(char_u *string, int c); 56 | char_u *vim_strrchr(char_u *string, int c); 57 | int vim_isspace(int x); 58 | void ga_clear(garray_T *gap); 59 | void ga_clear_strings(garray_T *gap); 60 | void ga_init(garray_T *gap); 61 | void ga_init2(garray_T *gap, int itemsize, int growsize); 62 | int ga_grow(garray_T *gap, int n); 63 | char_u *ga_concat_strings(garray_T *gap, char *sep); 64 | void ga_add_string(garray_T *gap, char_u *p); 65 | void ga_concat(garray_T *gap, char_u *s); 66 | void ga_append(garray_T *gap, int c); 67 | void append_ga_line(garray_T *gap); 68 | int name_to_mod_mask(int c); 69 | int simplify_key(int key, int *modifiers); 70 | int handle_x_keys(int key); 71 | char_u *get_special_key_name(int c, int modifiers); 72 | int trans_special(char_u **srcp, char_u *dst, int keycode, int in_string); 73 | int special_to_buf(int key, int modifiers, int keycode, char_u *dst); 74 | int find_special_key(char_u **srcp, int *modp, int keycode, int keep_x_key, 75 | int in_string); 76 | int extract_modifiers(int key, int *modp); 77 | int find_special_key_in_table(int c); 78 | int get_special_key_code(char_u *name); 79 | char_u *get_key_name(int i); 80 | int get_mouse_button(int code, int *is_click, int *is_drag); 81 | int get_pseudo_mouse_code(int button, int is_click, int is_drag); 82 | int get_fileformat(buf_T *buf); 83 | int get_fileformat_force(buf_T *buf, exarg_T *eap); 84 | void set_fileformat_buf(buf_T *buf, int t, int opt_flags); 85 | void set_fileformat(int t, int opt_flags); 86 | int default_fileformat(void); 87 | int call_shell(char_u *cmd, int opt); 88 | int get_real_state(void); 89 | int after_pathsep(char_u *b, char_u *p); 90 | int same_directory(char_u *f1, char_u *f2); 91 | int vim_chdirfile(char_u *fname, char *trigger_autocmd); 92 | int vim_stat(const char *name, stat_T *stp); 93 | char *parse_shape_opt(int what); 94 | int get_shape_idx(int mouse); 95 | void update_mouseshape(int shape_idx); 96 | int vim_chdir(char_u *new_dir); 97 | int get_user_name(char_u *buf, int len); 98 | void sort_strings(char_u **files, int count); 99 | int pathcmp(const char *p, const char *q, int maxlen); 100 | int filewritable(char_u *fname); 101 | int get2c(FILE *fd); 102 | int get3c(FILE *fd); 103 | int get4c(FILE *fd); 104 | time_T get8ctime(FILE *fd); 105 | char_u *read_string(FILE *fd, int cnt); 106 | int put_bytes(FILE *fd, long_u nr, int len); 107 | int put_time(FILE *fd, time_T the_time); 108 | void time_to_bytes(time_T the_time, char_u *buf); 109 | int has_non_ascii(char_u *s); 110 | void parse_queued_messages(void); 111 | int mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc); 112 | int build_argv_from_string(char_u *cmd, char ***argv, int *argc); 113 | int build_argv_from_list(list_T *l, char ***argv, int *argc); 114 | int write_session_file(char_u *filename); 115 | /* vim: set ft=c : */ 116 | -------------------------------------------------------------------------------- /lib/libvim/proto/move.pro: -------------------------------------------------------------------------------- 1 | /* move.c */ 2 | void reset_cursorline(void); 3 | void redraw_for_cursorline(win_T *wp); 4 | void update_topline_redraw(void); 5 | void update_topline(void); 6 | void update_curswant(void); 7 | void check_cursor_moved(win_T *wp); 8 | void changed_window_setting(void); 9 | void changed_window_setting_win(win_T *wp); 10 | void set_topline(win_T *wp, linenr_T lnum); 11 | void changed_cline_bef_curs(void); 12 | void changed_cline_bef_curs_win(win_T *wp); 13 | void changed_line_abv_curs(void); 14 | void changed_line_abv_curs_win(win_T *wp); 15 | void validate_botline(void); 16 | void invalidate_botline(void); 17 | void invalidate_botline_win(win_T *wp); 18 | void approximate_botline_win(win_T *wp); 19 | int cursor_valid(void); 20 | void validate_cursor(void); 21 | void validate_cline_row(void); 22 | void validate_virtcol(void); 23 | void validate_virtcol_win(win_T *wp); 24 | void validate_cursor_col(void); 25 | int win_col_off(win_T *wp); 26 | int curwin_col_off(void); 27 | int win_col_off2(win_T *wp); 28 | int curwin_col_off2(void); 29 | void curs_columns(int may_scroll); 30 | void scrolldown(long line_count, int byfold); 31 | void scrollup(long line_count, int byfold); 32 | void check_topfill(win_T *wp, int down); 33 | void scroll_cursor_top(int min_scroll, int always); 34 | void set_empty_rows(win_T *wp, int used); 35 | void scroll_cursor_bot(int min_scroll, int set_topbot); 36 | void scroll_cursor_halfway(int atend); 37 | void cursor_correct(void); 38 | int onepage(int dir, long count); 39 | void halfpage(int flag, linenr_T Prenum); 40 | void do_check_cursorbind(void); 41 | /* vim: set ft=c : */ 42 | -------------------------------------------------------------------------------- /lib/libvim/proto/normal.pro: -------------------------------------------------------------------------------- 1 | /* normal.c */ 2 | 3 | void *state_normal_cmd_initialize(); 4 | void state_normal_cmd_cleanup(void *ctx); 5 | executionStatus_T state_normal_cmd_execute(void *ctx, int key); 6 | int state_normal_pending_operator(void *ctx, pendingOp_T *pendingOp); 7 | 8 | void init_normal_cmds(void); 9 | void normal_cmd(oparg_T *oap, int toplevel); 10 | void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank); 11 | int do_mouse(oparg_T *oap, int c, int dir, long count, int fixindent); 12 | void check_visual_highlight(void); 13 | void end_visual_mode(void); 14 | void reset_VIsual_and_resel(void); 15 | void reset_VIsual(void); 16 | int find_ident_under_cursor(char_u **string, int find_type); 17 | int find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, 18 | char_u **string, int find_type); 19 | void clear_showcmd(void); 20 | int add_to_showcmd(int c); 21 | void add_to_showcmd_c(int c); 22 | void push_showcmd(void); 23 | void pop_showcmd(void); 24 | void do_check_scrollbind(int check); 25 | void check_scrollbind(linenr_T topline_diff, long leftcol_diff); 26 | int find_decl(char_u *ptr, int len, int locally, int thisblock, int flags_arg); 27 | void scroll_redraw(int up, long count); 28 | void handle_tabmenu(void); 29 | void do_nv_ident(int c1, int c2); 30 | int get_visual_text(cmdarg_T *cap, char_u **pp, int *lenp); 31 | void start_selection(void); 32 | void may_start_select(int c); 33 | /* vim: set ft=c : */ 34 | -------------------------------------------------------------------------------- /lib/libvim/proto/ops.pro: -------------------------------------------------------------------------------- 1 | /* ops.c */ 2 | void *state_change_initialize(oparg_T *oap); 3 | executionStatus_T state_change_execute(void *ctx, int c); 4 | void state_change_cleanup(void *ctx); 5 | 6 | int get_op_type(int char1, int char2); 7 | int op_on_lines(int op); 8 | int op_is_change(int op); 9 | int get_op_char(int optype); 10 | int get_extra_op_char(int optype); 11 | void op_shift(oparg_T *oap, int curs_top, int amount); 12 | void shift_line(int left, int round, int amount, int call_changed_bytes); 13 | void op_reindent(oparg_T *oap, int (*how)(void)); 14 | int get_expr_register(void); 15 | void set_expr_line(char_u *new_line); 16 | char_u *get_expr_line(void); 17 | char_u *get_expr_line_src(void); 18 | int valid_yank_reg(int regname, int writing); 19 | void get_yank_register_value(int regname, int *num_lines, char_u ***lines); 20 | int get_yank_register(int regname, int writing); 21 | int may_get_selection(int regname); 22 | void *get_register(int name, int copy); 23 | void put_register(int name, void *reg); 24 | void free_register(void *reg); 25 | int yank_register_mline(int regname); 26 | int do_record(int c); 27 | int do_execreg(int regname, int colon, int addcr, int silent); 28 | int insert_reg(int regname, int literally_arg); 29 | int get_spec_reg(int regname, char_u **argp, int *allocated, int errmsg); 30 | int cmdline_paste_reg(int regname, int literally_arg, int remcr); 31 | void adjust_clip_reg(int *rp); 32 | void shift_delete_registers(void); 33 | int op_delete(oparg_T *oap); 34 | int op_replace(oparg_T *oap, int c); 35 | void op_tilde(oparg_T *oap); 36 | int swapchar(int op_type, pos_T *pos); 37 | void op_insert(oparg_T *oap, long count1); 38 | void init_yank(void); 39 | void clear_registers(void); 40 | int op_yank(oparg_T *oap, int deleting, int mess); 41 | void do_put(int regname, int dir, long count, int flags); 42 | void adjust_cursor_eol(void); 43 | int preprocs_left(void); 44 | int get_register_name(int num); 45 | void ex_display(exarg_T *eap); 46 | char_u *skip_comment(char_u *line, int process, int include_space, 47 | int *is_comment); 48 | int do_join(long count, int insert_space, int save_undo, int use_formatoptions, 49 | int setmark); 50 | void op_format(oparg_T *oap, int keep_cursor); 51 | void op_formatexpr(oparg_T *oap); 52 | int fex_format(linenr_T lnum, long count, int c); 53 | void format_lines(linenr_T line_count, int avoid_fex); 54 | int paragraph_start(linenr_T lnum); 55 | void op_addsub(oparg_T *oap, linenr_T Prenum1, int g_cmd); 56 | void prepare_viminfo_registers(void); 57 | void finish_viminfo_registers(void); 58 | int read_viminfo_register(vir_T *virp, int force); 59 | void handle_viminfo_register(garray_T *values, int force); 60 | void write_viminfo_registers(FILE *fp); 61 | void x11_export_final_selection(void); 62 | void clip_free_selection(VimClipboard *cbd); 63 | void clip_get_selection(VimClipboard *cbd); 64 | void clip_yank_selection(int type, char_u *str, long len, VimClipboard *cbd); 65 | int clip_convert_selection(char_u **str, long_u *len, VimClipboard *cbd); 66 | void dnd_yank_drag_data(char_u *str, long len); 67 | char_u get_reg_type(int regname, long *reglen); 68 | char_u *get_reg_contents(int regname, int flags); 69 | void write_reg_contents(int name, char_u *str, int maxlen, int must_append); 70 | void write_reg_contents_lst(int name, char_u **strings, int maxlen, 71 | int must_append, int yank_type, long block_len); 72 | void write_reg_contents_ex(int name, char_u *str, int maxlen, int must_append, 73 | int yank_type, long block_len); 74 | void clear_oparg(oparg_T *oap); 75 | void cursor_pos_info(dict_T *dict); 76 | /* vim: set ft=c : */ 77 | -------------------------------------------------------------------------------- /lib/libvim/proto/option.pro: -------------------------------------------------------------------------------- 1 | /* option.c */ 2 | void set_init_1(int clean_arg); 3 | void set_string_default(char *name, char_u *val); 4 | void set_number_default(char *name, long val); 5 | void set_local_options_default(win_T *wp); 6 | void free_all_options(void); 7 | void set_init_2(void); 8 | void set_init_3(void); 9 | void set_helplang_default(char_u *lang); 10 | void init_gui_options(void); 11 | void set_title_defaults(void); 12 | int do_set(char_u *arg, int opt_flags); 13 | int string_to_key(char_u *arg, int multi_byte); 14 | void set_options_bin(int oldval, int newval, int opt_flags); 15 | int get_viminfo_parameter(int type); 16 | char_u *find_viminfo_parameter(int type); 17 | void check_options(void); 18 | void check_buf_options(buf_T *buf); 19 | void free_string_option(char_u *p); 20 | void clear_string_option(char_u **pp); 21 | int get_term_opt_idx(char_u **p); 22 | int set_term_option_alloced(char_u **p); 23 | int was_set_insecurely(char_u *opt, int opt_flags); 24 | void set_string_option_direct(char_u *name, int opt_idx, char_u *val, 25 | int opt_flags, int set_sid); 26 | void set_string_option_direct_in_win(win_T *wp, char_u *name, int opt_idx, 27 | char_u *val, int opt_flags, int set_sid); 28 | void set_string_option_direct_in_buf(buf_T *buf, char_u *name, int opt_idx, 29 | char_u *val, int opt_flags, int set_sid); 30 | int valid_spellang(char_u *val); 31 | char *check_colorcolumn(win_T *wp); 32 | char *check_stl_option(char_u *s); 33 | void set_term_option_sctx_idx(char *name, int opt_idx); 34 | int get_option_value(char_u *name, long *numval, char_u **stringval, 35 | int opt_flags); 36 | int get_option_value_strict(char_u *name, long *numval, char_u **stringval, 37 | int opt_type, void *from); 38 | char_u *option_iter_next(void **option, int opt_type); 39 | char *set_option_value(char_u *name, long number, char_u *string, 40 | int opt_flags); 41 | char_u *get_term_code(char_u *tname); 42 | char_u *get_highlight_default(void); 43 | char_u *get_encoding_default(void); 44 | int makeset(FILE *fd, int opt_flags, int local_only); 45 | int makefoldset(FILE *fd); 46 | void clear_termoptions(void); 47 | void free_termoptions(void); 48 | void free_one_termoption(char_u *var); 49 | void set_term_defaults(void); 50 | void comp_col(void); 51 | void unset_global_local_option(char_u *name, void *from); 52 | char_u *get_equalprg(void); 53 | void win_copy_options(win_T *wp_from, win_T *wp_to); 54 | void copy_winopt(winopt_T *from, winopt_T *to); 55 | void check_win_options(win_T *win); 56 | void clear_winopt(winopt_T *wop); 57 | void buf_copy_options(buf_T *buf, int flags); 58 | void reset_modifiable(void); 59 | void set_iminsert_global(void); 60 | void set_imsearch_global(void); 61 | void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags); 62 | int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, 63 | char_u ***file); 64 | int ExpandOldSetting(int *num_file, char_u ***file); 65 | int langmap_adjust_mb(int c); 66 | int has_format_option(int x); 67 | int shortmess(int x); 68 | void vimrc_found(char_u *fname, char_u *envname); 69 | void change_compatible(int on); 70 | int option_was_set(char_u *name); 71 | int reset_option_was_set(char_u *name); 72 | int can_bs(int what); 73 | void save_file_ff(buf_T *buf); 74 | int file_ff_differs(buf_T *buf, int ignore_empty); 75 | int check_ff_value(char_u *p); 76 | int tabstop_set(char_u *var, int **array); 77 | int tabstop_padding(colnr_T col, int ts_arg, int *vts); 78 | int tabstop_at(colnr_T col, int ts, int *vts); 79 | colnr_T tabstop_start(colnr_T col, int ts, int *vts); 80 | void tabstop_fromto(colnr_T start_col, colnr_T end_col, int ts_arg, int *vts, 81 | int *ntabs, int *nspcs); 82 | int tabstop_eq(int *ts1, int *ts2); 83 | int *tabstop_copy(int *oldts); 84 | int tabstop_count(int *ts); 85 | int tabstop_first(int *ts); 86 | long get_sw_value(buf_T *buf); 87 | long get_sw_value_indent(buf_T *buf); 88 | long get_sw_value_pos(buf_T *buf, pos_T *pos); 89 | long get_sw_value_col(buf_T *buf, colnr_T col); 90 | long get_sts_value(void); 91 | long get_scrolloff_value(void); 92 | long get_sidescrolloff_value(void); 93 | void find_mps_values(int *initc, int *findc, int *backwards, int switchit); 94 | unsigned int get_bkc_value(buf_T *buf); 95 | int signcolumn_on(win_T *wp); 96 | dict_T *get_winbuf_options(int bufopt); 97 | /* vim: set ft=c : */ 98 | -------------------------------------------------------------------------------- /lib/libvim/proto/os_mac_conv.pro: -------------------------------------------------------------------------------- 1 | /* os_mac_conv.c */ 2 | char_u *mac_string_convert(char_u *ptr, int len, int *lenp, int fail_on_error, 3 | int from_enc, int to_enc, int *unconvlenp); 4 | int macroman2enc(char_u *ptr, long *sizep, long real_size); 5 | int enc2macroman(char_u *from, size_t fromlen, char_u *to, int *tolenp, 6 | int maxtolen, char_u *rest, int *restlenp); 7 | void mac_conv_init(void); 8 | void mac_conv_cleanup(void); 9 | char_u *mac_utf16_to_enc(unsigned short *from, size_t fromLen, 10 | size_t *actualLen); 11 | unsigned short *mac_enc_to_utf16(char_u *from, size_t fromLen, 12 | size_t *actualLen); 13 | void *mac_enc_to_cfstring(char_u *from, size_t fromLen); 14 | char_u *mac_precompose_path(char_u *decompPath, size_t decompLen, 15 | size_t *precompLen); 16 | void mac_lang_init(void); 17 | /* vim: set ft=c : */ 18 | -------------------------------------------------------------------------------- /lib/libvim/proto/os_mswin.pro: -------------------------------------------------------------------------------- 1 | /* os_mswin.c */ 2 | void mch_exit_g(int r); 3 | void mch_early_init(void); 4 | int mch_input_isatty(void); 5 | void mch_settitle(char_u *title, char_u *icon); 6 | void mch_restore_title(int which); 7 | int mch_can_restore_title(void); 8 | int mch_can_restore_icon(void); 9 | int mch_FullName(char_u *fname, char_u *buf, int len, int force); 10 | int mch_isFullName(char_u *fname); 11 | void slash_adjust(char_u *p); 12 | int vim_stat(const char *name, stat_T *stp); 13 | void mch_settmode(int tmode); 14 | int mch_get_shellsize(void); 15 | void mch_set_shellsize(void); 16 | void mch_new_shellsize(void); 17 | void mch_suspend(void); 18 | void display_errors(void); 19 | int mch_has_exp_wildcard(char_u *p); 20 | int mch_has_wildcard(char_u *p); 21 | int mch_chdir(char *path); 22 | int mch_screenmode(char_u *arg); 23 | int mch_icon_load(HANDLE *iconp); 24 | int mch_libcall(char_u *libname, char_u *funcname, char_u *argstring, 25 | int argint, char_u **string_result, int *number_result); 26 | void DumpPutS(const char *psz); 27 | int mch_get_winpos(int *x, int *y); 28 | void mch_set_winpos(int x, int y); 29 | void mch_print_cleanup(void); 30 | int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit); 31 | int mch_print_begin(prt_settings_T *psettings); 32 | void mch_print_end(prt_settings_T *psettings); 33 | int mch_print_end_page(void); 34 | int mch_print_begin_page(char_u *msg); 35 | int mch_print_blank_page(void); 36 | void mch_print_start_line(int margin, int page_line); 37 | int mch_print_text_out(char_u *p, int len); 38 | void mch_print_set_font(int iBold, int iItalic, int iUnderline); 39 | void mch_print_set_bg(long_u bgcol); 40 | void mch_print_set_fg(long_u fgcol); 41 | char_u *mch_resolve_path(char_u *fname, int reparse_point); 42 | void win32_set_foreground(void); 43 | void serverInitMessaging(void); 44 | void serverSetName(char_u *name); 45 | char_u *serverGetVimNames(void); 46 | int serverSendReply(char_u *name, char_u *reply); 47 | int serverSendToVim(char_u *name, char_u *cmd, char_u **result, void *ptarget, 48 | int asExpr, int timeout, int silent); 49 | void serverForeground(char_u *name); 50 | char_u *serverGetReply(HWND server, int *expr_res, int remove, int wait, 51 | int timeout); 52 | void serverProcessPendingMessages(void); 53 | char *charset_id2name(int id); 54 | char *quality_id2name(DWORD id); 55 | int get_logfont(LOGFONTW *lf, char_u *name, HDC printer_dc, int verbose); 56 | void channel_init_winsock(void); 57 | /* vim: set ft=c : */ 58 | -------------------------------------------------------------------------------- /lib/libvim/proto/os_unix.pro: -------------------------------------------------------------------------------- 1 | /* os_unix.c */ 2 | int mch_chdir(char *path); 3 | int mch_char_avail(void); 4 | int mch_check_messages(void); 5 | long_u mch_total_mem(int special); 6 | void mch_delay(long msec, int ignoreinput); 7 | int mch_stackcheck(char *p); 8 | void mch_suspend(void); 9 | void mch_init(void); 10 | void reset_signals(void); 11 | int vim_handle_signal(int sig); 12 | int mch_check_win(int argc, char **argv); 13 | int mch_input_isatty(void); 14 | void ex_xrestore(exarg_T *eap); 15 | int mch_can_restore_title(void); 16 | int mch_can_restore_icon(void); 17 | void mch_settitle(char_u *title, char_u *icon); 18 | void mch_restore_title(int which); 19 | int vim_is_xterm(char_u *name); 20 | int use_xterm_like_mouse(char_u *name); 21 | int use_xterm_mouse(void); 22 | int vim_is_iris(char_u *name); 23 | int vim_is_vt300(char_u *name); 24 | int vim_is_fastterm(char_u *name); 25 | int mch_get_user_name(char_u *s, int len); 26 | int mch_get_uname(uid_t uid, char_u *s, int len); 27 | void mch_get_host_name(char_u *s, int len); 28 | long mch_get_pid(void); 29 | int mch_process_running(long pid); 30 | int mch_dirname(char_u *buf, int len); 31 | int mch_FullName(char_u *fname, char_u *buf, int len, int force); 32 | int mch_isFullName(char_u *fname); 33 | void fname_case(char_u *name, int len); 34 | long mch_getperm(char_u *name); 35 | int mch_setperm(char_u *name, long perm); 36 | int mch_fsetperm(int fd, long perm); 37 | void mch_copy_sec(char_u *from_file, char_u *to_file); 38 | vim_acl_T mch_get_acl(char_u *fname); 39 | void mch_set_acl(char_u *fname, vim_acl_T aclent); 40 | void mch_free_acl(vim_acl_T aclent); 41 | void mch_hide(char_u *name); 42 | int mch_isdir(char_u *name); 43 | int mch_isrealdir(char_u *name); 44 | int mch_can_exe(char_u *name, char_u **path, int use_path); 45 | int mch_nodetype(char_u *name); 46 | void mch_early_init(void); 47 | void mch_free_mem(void); 48 | void mch_exit(int r); 49 | void mch_settmode(int tmode); 50 | void get_stty(void); 51 | int get_tty_info(int fd, ttyinfo_T *info); 52 | void mch_setmouse(int on); 53 | void mch_bevalterm_changed(void); 54 | void check_mouse_termcode(void); 55 | int mch_screenmode(char_u *arg); 56 | int mch_get_shellsize(void); 57 | int mch_report_winsize(int fd, int rows, int cols); 58 | void mch_set_shellsize(void); 59 | void mch_new_shellsize(void); 60 | void may_send_sigint(int c, pid_t pid, pid_t wpid); 61 | int mch_call_shell(char_u *cmd, int options); 62 | void mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal); 63 | char *mch_job_status(job_T *job); 64 | job_T *mch_detect_ended_job(job_T *job_list); 65 | int mch_signal_job(job_T *job, char_u *how); 66 | void mch_clear_job(job_T *job); 67 | int mch_create_pty_channel(job_T *job, jobopt_T *options); 68 | void mch_breakcheck(int force); 69 | int mch_expandpath(garray_T *gap, char_u *path, int flags); 70 | int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, 71 | char_u ***file, int flags); 72 | int mch_has_exp_wildcard(char_u *p); 73 | int mch_has_wildcard(char_u *p); 74 | int mch_rename(const char *src, const char *dest); 75 | int gpm_enabled(void); 76 | int mch_libcall(char_u *libname, char_u *funcname, char_u *argstring, 77 | int argint, char_u **string_result, int *number_result); 78 | void setup_term_clip(void); 79 | void start_xterm_trace(int button); 80 | void stop_xterm_trace(void); 81 | void clear_xterm_clip(void); 82 | int clip_xterm_own_selection(VimClipboard *cbd); 83 | void clip_xterm_lose_selection(VimClipboard *cbd); 84 | void clip_xterm_request_selection(VimClipboard *cbd); 85 | void clip_xterm_set_selection(VimClipboard *cbd); 86 | int xsmp_handle_requests(void); 87 | void xsmp_init(void); 88 | void xsmp_close(void); 89 | /* vim: set ft=c : */ 90 | -------------------------------------------------------------------------------- /lib/libvim/proto/os_win32.pro: -------------------------------------------------------------------------------- 1 | /* os_win32.c */ 2 | HINSTANCE vimLoadLib(char *name); 3 | HINSTANCE find_imported_module_by_funcname(HINSTANCE hInst, 4 | const char *funcname); 5 | void *get_dll_import_func(HINSTANCE hInst, const char *funcname); 6 | int dyn_libintl_init(void); 7 | void dyn_libintl_end(void); 8 | void PlatformId(void); 9 | void mch_setmouse(int on); 10 | void mch_bevalterm_changed(void); 11 | void mch_update_cursor(void); 12 | int mch_char_avail(void); 13 | int mch_check_messages(void); 14 | void mch_init(void); 15 | void mch_exit(int r); 16 | int mch_check_win(int argc, char **argv); 17 | void fname_case(char_u *name, int len); 18 | int mch_get_user_name(char_u *s, int len); 19 | void mch_get_host_name(char_u *s, int len); 20 | long mch_get_pid(void); 21 | int mch_process_running(long pid); 22 | int mch_dirname(char_u *buf, int len); 23 | long mch_getperm(char_u *name); 24 | int mch_setperm(char_u *name, long perm); 25 | void mch_hide(char_u *name); 26 | int mch_ishidden(char_u *name); 27 | int mch_isdir(char_u *name); 28 | int mch_isrealdir(char_u *name); 29 | int mch_mkdir(char_u *name); 30 | int mch_rmdir(char_u *name); 31 | int mch_is_hard_link(char_u *fname); 32 | int mch_is_symbolic_link(char_u *name); 33 | int mch_is_linked(char_u *fname); 34 | int win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info); 35 | int mch_writable(char_u *name); 36 | int mch_can_exe(char_u *name, char_u **path, int use_path); 37 | int mch_nodetype(char_u *name); 38 | vim_acl_T mch_get_acl(char_u *fname); 39 | void mch_set_acl(char_u *fname, vim_acl_T acl); 40 | void mch_free_acl(vim_acl_T acl); 41 | void mch_settmode(int tmode); 42 | int mch_get_shellsize(void); 43 | void mch_set_shellsize(void); 44 | void mch_new_shellsize(void); 45 | void mch_set_winsize_now(void); 46 | int mch_call_shell(char_u *cmd, int options); 47 | void win32_build_env(dict_T *env, garray_T *gap, int is_terminal); 48 | void mch_job_start(char *cmd, job_T *job, jobopt_T *options); 49 | char *mch_job_status(job_T *job); 50 | job_T *mch_detect_ended_job(job_T *job_list); 51 | int mch_signal_job(job_T *job, char_u *how); 52 | void mch_clear_job(job_T *job); 53 | void mch_set_normal_colors(void); 54 | void mch_delay(long msec, int ignoreinput); 55 | int mch_remove(char_u *name); 56 | void mch_breakcheck(int force); 57 | long_u mch_total_mem(int special); 58 | int mch_wrename(WCHAR *wold, WCHAR *wnew); 59 | int mch_rename(const char *pszOldFile, const char *pszNewFile); 60 | char *default_shell(void); 61 | int mch_access(char *n, int p); 62 | int mch_open(const char *name, int flags, int mode); 63 | FILE *mch_fopen(const char *name, const char *mode); 64 | int mch_copy_file_attribute(char_u *from, char_u *to); 65 | int myresetstkoflw(void); 66 | int get_cmd_argsW(char ***argvp); 67 | void free_cmd_argsW(void); 68 | void used_file_arg(char *name, int literal, int full_path, int diff_mode); 69 | void set_alist_count(void); 70 | void fix_arg_enc(void); 71 | int mch_setenv(char *var, char *value, int x); 72 | void control_console_color_rgb(void); 73 | int use_vtp(void); 74 | int is_term_win32(void); 75 | int has_vtp_working(void); 76 | int has_conpty_working(void); 77 | int is_conpty_stable(void); 78 | void resize_console_buf(void); 79 | /* vim: set ft=c : */ 80 | -------------------------------------------------------------------------------- /lib/libvim/proto/pty.pro: -------------------------------------------------------------------------------- 1 | /* pty.c */ 2 | int setup_slavepty(int fd); 3 | int mch_openpty(char **ttyn); 4 | int mch_isatty(int fd); 5 | /* vim: set ft=c : */ 6 | -------------------------------------------------------------------------------- /lib/libvim/proto/quickfix.pro: -------------------------------------------------------------------------------- 1 | /* quickfix.c */ 2 | int qf_init(win_T *wp, char_u *efile, char_u *errorformat, int newlist, 3 | char_u *qf_title, char_u *enc); 4 | int qf_stack_get_bufnr(void); 5 | void qf_free_all(win_T *wp); 6 | void check_quickfix_busy(void); 7 | void copy_loclist_stack(win_T *from, win_T *to); 8 | void qf_jump(qf_info_T *qi, int dir, int errornr, int forceit); 9 | void qf_jump_newwin(qf_info_T *qi, int dir, int errornr, int forceit, 10 | int newwin); 11 | void qf_list(exarg_T *eap); 12 | void qf_age(exarg_T *eap); 13 | void qf_history(exarg_T *eap); 14 | void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, 15 | long amount_after); 16 | void qf_view_result(int split); 17 | void ex_cwindow(exarg_T *eap); 18 | void ex_cclose(exarg_T *eap); 19 | void ex_copen(exarg_T *eap); 20 | void ex_cbottom(exarg_T *eap); 21 | linenr_T qf_current_entry(win_T *wp); 22 | int grep_internal(cmdidx_T cmdidx); 23 | void ex_make(exarg_T *eap); 24 | int qf_get_size(exarg_T *eap); 25 | int qf_get_valid_size(exarg_T *eap); 26 | int qf_get_cur_idx(exarg_T *eap); 27 | int qf_get_cur_valid_idx(exarg_T *eap); 28 | void ex_cc(exarg_T *eap); 29 | void ex_cnext(exarg_T *eap); 30 | void ex_cbelow(exarg_T *eap); 31 | void ex_cfile(exarg_T *eap); 32 | void ex_vimgrep(exarg_T *eap); 33 | int get_errorlist(qf_info_T *qi_arg, win_T *wp, int qf_idx, list_T *list); 34 | int qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict); 35 | int set_errorlist(win_T *wp, list_T *list, int action, char_u *title, 36 | dict_T *what); 37 | int set_ref_in_quickfix(int copyID); 38 | void ex_cbuffer(exarg_T *eap); 39 | void ex_cexpr(exarg_T *eap); 40 | void ex_helpgrep(exarg_T *eap); 41 | /* vim: set ft=c : */ 42 | -------------------------------------------------------------------------------- /lib/libvim/proto/regexp.pro: -------------------------------------------------------------------------------- 1 | /* regexp.c */ 2 | int re_multiline(regprog_T *prog); 3 | char_u *skip_regexp(char_u *startp, int dirc, int magic, char_u **newp); 4 | int vim_regcomp_had_eol(void); 5 | void free_regexp_stuff(void); 6 | reg_extmatch_T *ref_extmatch(reg_extmatch_T *em); 7 | void unref_extmatch(reg_extmatch_T *em); 8 | char_u *regtilde(char_u *source, int magic); 9 | int vim_regsub(regmatch_T *rmp, char_u *source, typval_T *expr, char_u *dest, 10 | int copy, int magic, int backslash); 11 | int vim_regsub_multi(regmmatch_T *rmp, linenr_T lnum, char_u *source, 12 | char_u *dest, int copy, int magic, int backslash); 13 | char_u *reg_submatch(int no); 14 | list_T *reg_submatch_list(int no); 15 | regprog_T *vim_regcomp(char_u *expr_arg, int re_flags); 16 | void vim_regfree(regprog_T *prog); 17 | int regprog_in_use(regprog_T *prog); 18 | int vim_regexec_prog(regprog_T **prog, int ignore_case, char_u *line, 19 | colnr_T col); 20 | int vim_regexec(regmatch_T *rmp, char_u *line, colnr_T col); 21 | int vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col); 22 | long vim_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, 23 | colnr_T col, proftime_T *tm, int *timed_out); 24 | /* vim: set ft=c : */ 25 | -------------------------------------------------------------------------------- /lib/libvim/proto/screen.pro: -------------------------------------------------------------------------------- 1 | /* screen.c */ 2 | void redraw_later(int type); 3 | void redraw_win_later(win_T *wp, int type); 4 | void redraw_later_clear(void); 5 | void redraw_all_later(int type); 6 | void redraw_curbuf_later(int type); 7 | void redraw_buf_later(buf_T *buf, int type); 8 | void redraw_buf_line_later(buf_T *buf, linenr_T lnum); 9 | void redraw_buf_and_status_later(buf_T *buf, int type); 10 | int redraw_asap(int type); 11 | void redraw_after_callback(int call_update_screen); 12 | void redrawWinline(win_T *wp, linenr_T lnum); 13 | void after_updating_screen(int may_resize_shell); 14 | void update_curbuf(int type); 15 | int update_screen(int type_arg); 16 | int conceal_cursor_line(win_T *wp); 17 | void conceal_check_cursor_line(void); 18 | void update_debug_sign(buf_T *buf, linenr_T lnum); 19 | void updateWindow(win_T *wp); 20 | int screen_get_current_line_off(void); 21 | void screen_line(int row, int coloff, int endcol, int clear_width, int flags); 22 | void rl_mirror(char_u *str); 23 | void status_redraw_all(void); 24 | void status_redraw_curbuf(void); 25 | void redraw_statuslines(void); 26 | void win_redraw_last_status(frame_T *frp); 27 | void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, 28 | int match, int showtail); 29 | int stl_connected(win_T *wp); 30 | int get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len); 31 | void screen_putchar(int c, int row, int col, int attr); 32 | void screen_getbytes(int row, int col, char_u *bytes, int *attrp); 33 | void screen_puts(char_u *text, int row, int col, int attr); 34 | void screen_puts_len(char_u *text, int textlen, int row, int col, int attr); 35 | void screen_stop_highlight(void); 36 | void reset_cterm_colors(void); 37 | void screen_draw_rectangle(int row, int col, int height, int width, int invert); 38 | void check_for_delay(int check_msg_scroll); 39 | int screen_valid(int doclear); 40 | void screenalloc(int doclear); 41 | void free_screenlines(void); 42 | void screenclear(void); 43 | int can_clear(char_u *p); 44 | void screen_start(void); 45 | void windgoto(int row, int col); 46 | void setcursor(void); 47 | void setcursor_mayforce(int force); 48 | int win_ins_lines(win_T *wp, int row, int line_count, int invalid, 49 | int mayclear); 50 | int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear, 51 | int clear_attr); 52 | int screen_ins_lines(int off, int row, int line_count, int end, int clear_attr, 53 | win_T *wp); 54 | int screen_del_lines(int off, int row, int line_count, int end, int force, 55 | int clear_attr, win_T *wp); 56 | int skip_showmode(void); 57 | void unshowmode(int force); 58 | void clearmode(void); 59 | void draw_tabline(void); 60 | void get_trans_bufname(buf_T *buf); 61 | int redrawing(void); 62 | int messaging(void); 63 | void showruler(int always); 64 | int number_width(win_T *wp); 65 | int screen_screencol(void); 66 | int screen_screenrow(void); 67 | /* vim: set ft=c : */ 68 | -------------------------------------------------------------------------------- /lib/libvim/proto/search.pro: -------------------------------------------------------------------------------- 1 | /* search.c */ 2 | int search_regcomp(char_u *pat, int pat_save, int pat_use, int options, 3 | regmmatch_T *regmatch); 4 | char_u *get_search_pat(void); 5 | char_u *reverse_text(char_u *s); 6 | void save_re_pat(int idx, char_u *pat, int magic); 7 | void save_search_patterns(void); 8 | void restore_search_patterns(void); 9 | void free_search_patterns(void); 10 | void save_last_search_pattern(void); 11 | void restore_last_search_pattern(void); 12 | char_u *last_search_pattern(void); 13 | int ignorecase(char_u *pat); 14 | int ignorecase_opt(char_u *pat, int ic_in, int scs); 15 | int pat_has_uppercase(char_u *pat); 16 | char_u *last_csearch(void); 17 | int last_csearch_forward(void); 18 | int last_csearch_until(void); 19 | void set_last_csearch(int c, char_u *s, int len); 20 | void set_csearch_direction(int cdir); 21 | void set_csearch_until(int t_cmd); 22 | char_u *last_search_pat(void); 23 | void reset_search_dir(void); 24 | void set_last_search_pat(char_u *s, int idx, int magic, int setlast); 25 | void last_pat_prog(regmmatch_T *regmatch); 26 | int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, int dir, 27 | char_u *pat, long count, int options, int pat_use, 28 | linenr_T stop_lnum, proftime_T *tm, int *timed_out); 29 | void set_search_direction(int cdir); 30 | int do_search(oparg_T *oap, int dirc, char_u *pat, long count, int options, 31 | proftime_T *tm, int *timed_out); 32 | int search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat); 33 | int searchc(cmdarg_T *cap, int t_cmd); 34 | pos_T *findmatch(oparg_T *oap, int initc); 35 | pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int maxtravel); 36 | void showmatch(int c); 37 | int findsent(int dir, long count); 38 | int findpar(int *pincl, int dir, long count, int what, int both); 39 | int startPS(linenr_T lnum, int para, int both); 40 | int fwd_word(long count, int bigword, int eol); 41 | int bck_word(long count, int bigword, int stop); 42 | int end_word(long count, int bigword, int stop, int empty); 43 | int bckend_word(long count, int bigword, int eol); 44 | int current_word(oparg_T *oap, long count, int include, int bigword); 45 | int current_sent(oparg_T *oap, long count, int include); 46 | int current_block(oparg_T *oap, long count, int include, int what, int other); 47 | int current_tagblock(oparg_T *oap, long count_arg, int include); 48 | int current_par(oparg_T *oap, long count, int include, int type); 49 | int current_quote(oparg_T *oap, long count, int include, int quotechar); 50 | int current_search(long count, int forward); 51 | int linewhite(linenr_T lnum); 52 | void find_pattern_in_path(char_u *ptr, int dir, int len, int whole, 53 | int skip_comments, int type, long count, int action, 54 | linenr_T start_lnum, linenr_T end_lnum); 55 | int read_viminfo_search_pattern(vir_T *virp, int force); 56 | void write_viminfo_search_pattern(FILE *fp); 57 | /* vim: set ft=c : */ 58 | -------------------------------------------------------------------------------- /lib/libvim/proto/sha256.pro: -------------------------------------------------------------------------------- 1 | /* sha256.c */ 2 | void sha256_start(context_sha256_T *ctx); 3 | void sha256_update(context_sha256_T *ctx, char_u *input, UINT32_T length); 4 | void sha256_finish(context_sha256_T *ctx, char_u digest[32]); 5 | /* vim: set ft=c : */ 6 | -------------------------------------------------------------------------------- /lib/libvim/proto/sign.pro: -------------------------------------------------------------------------------- 1 | /* sign.c */ 2 | void init_signs(void); 3 | int buf_getsigntype(buf_T *buf, linenr_T lnum, int type); 4 | linenr_T buf_delsign(buf_T *buf, linenr_T atlnum, int id, char_u *group); 5 | int buf_findsign(buf_T *buf, int id, char_u *group); 6 | int buf_findsign_id(buf_T *buf, linenr_T lnum, char_u *groupname); 7 | int buf_findsigntype_id(buf_T *buf, linenr_T lnum, int typenr); 8 | int buf_signcount(buf_T *buf, linenr_T lnum); 9 | void buf_delete_signs(buf_T *buf, char_u *group); 10 | void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, 11 | long amount_after); 12 | int sign_define_by_name(char_u *name, char_u *icon, char_u *linehl, 13 | char_u *text, char_u *texthl); 14 | int sign_undefine_by_name(char_u *name); 15 | int sign_place(int *sign_id, char_u *sign_group, char_u *sign_name, buf_T *buf, 16 | linenr_T lnum, int prio); 17 | int sign_unplace(int sign_id, char_u *sign_group, buf_T *buf, linenr_T atlnum); 18 | linenr_T sign_jump(int sign_id, char_u *sign_group, buf_T *buf); 19 | void ex_sign(exarg_T *eap); 20 | void sign_getlist(char_u *name, list_T *retlist); 21 | void get_buffer_signs(buf_T *buf, list_T *l); 22 | void sign_get_placed(buf_T *buf, linenr_T lnum, int sign_id, char_u *sign_group, 23 | list_T *retlist); 24 | void sign_gui_started(void); 25 | int sign_get_attr(int typenr, int line); 26 | char_u *sign_get_text(int typenr); 27 | void *sign_get_image(int typenr); 28 | void free_signs(void); 29 | char_u *get_sign_name(expand_T *xp, int idx); 30 | void set_context_in_sign_cmd(expand_T *xp, char_u *arg); 31 | /* vim: set ft=c : */ 32 | -------------------------------------------------------------------------------- /lib/libvim/proto/state_insert_literal.pro: -------------------------------------------------------------------------------- 1 | /* state_insert_literal.c */ 2 | 3 | void *state_insert_literal_initialize(int *ret); 4 | 5 | executionStatus_T state_insert_literal_execute(void *ctx, int c); 6 | 7 | void state_insert_literal_cleanup(void *ctx); 8 | 9 | /* vim: set ft=c : */ 10 | -------------------------------------------------------------------------------- /lib/libvim/proto/state_machine.pro: -------------------------------------------------------------------------------- 1 | /* state_machine.c */ 2 | 3 | void sm_push(int mode, subMode_T subMode, void *context, state_execute executeFn, 4 | state_pending_operator pendingOperatorFn, 5 | state_cleanup cleanupFn); 6 | 7 | void sm_push_insert(int cmdchar, int startln, long count); 8 | void sm_push_insert_literal(int *ret); 9 | void sm_push_normal(); 10 | void sm_push_change(oparg_T *oap); 11 | void sm_push_cmdline(int cmdchar, long count, int indent); 12 | 13 | // Execute a cmd as if in normal mode, reverting to the previous state when complete 14 | void sm_execute_normal(char_u *cmd, int preserveState); 15 | 16 | void sm_execute(char_u *key); 17 | 18 | int sm_get_current_mode(void); 19 | subMode_T sm_get_current_sub_mode(void); 20 | int sm_get_pending_operator(pendingOp_T *pendingOp); 21 | 22 | sm_T *sm_get_current(void); 23 | 24 | /* vim: set ft=c : */ 25 | -------------------------------------------------------------------------------- /lib/libvim/proto/syntax.pro: -------------------------------------------------------------------------------- 1 | /* syntax.c */ 2 | void syn_set_timeout(proftime_T *tm); 3 | void syntax_start(win_T *wp, linenr_T lnum); 4 | void syn_stack_free_all(synblock_T *block); 5 | void syn_stack_apply_changes(buf_T *buf); 6 | void syntax_end_parsing(linenr_T lnum); 7 | int syntax_check_changed(linenr_T lnum); 8 | int get_syntax_attr(colnr_T col, int *can_spell, int keep_state); 9 | void syntax_clear(synblock_T *block); 10 | void reset_synblock(win_T *wp); 11 | void ex_syntax(exarg_T *eap); 12 | void ex_ownsyntax(exarg_T *eap); 13 | int syntax_present(win_T *win); 14 | void reset_expand_highlight(void); 15 | void set_context_in_echohl_cmd(expand_T *xp, char_u *arg); 16 | void set_context_in_syntax_cmd(expand_T *xp, char_u *arg); 17 | char_u *get_syntax_name(expand_T *xp, int idx); 18 | int syn_get_id(win_T *wp, long lnum, colnr_T col, int trans, int *spellp, 19 | int keep_state); 20 | int get_syntax_info(int *seqnrp); 21 | int syn_get_sub_char(void); 22 | int syn_get_stack_item(int i); 23 | int syn_get_foldlevel(win_T *wp, long lnum); 24 | void ex_syntime(exarg_T *eap); 25 | char_u *get_syntime_arg(expand_T *xp, int idx); 26 | void init_highlight(int both, int reset); 27 | int load_colors(char_u *name); 28 | int lookup_color(int idx, int foreground, int *boldp); 29 | void do_highlight(char_u *line, int forceit, int init); 30 | void free_highlight(void); 31 | void restore_cterm_colors(void); 32 | void set_normal_colors(void); 33 | char_u *hl_get_font_name(void); 34 | void hl_set_font_name(char_u *font_name); 35 | void hl_set_bg_color_name(char_u *name); 36 | void hl_set_fg_color_name(char_u *name); 37 | guicolor_T color_name2handle(char_u *name); 38 | int get_cterm_attr_idx(int attr, int fg, int bg); 39 | int get_tgc_attr_idx(int attr, guicolor_T fg, guicolor_T bg); 40 | int get_gui_attr_idx(int attr, guicolor_T fg, guicolor_T bg); 41 | void clear_hl_tables(void); 42 | int hl_combine_attr(int char_attr, int prim_attr); 43 | attrentry_T *syn_gui_attr2entry(int attr); 44 | int syn_attr2attr(int attr); 45 | attrentry_T *syn_term_attr2entry(int attr); 46 | attrentry_T *syn_cterm_attr2entry(int attr); 47 | char_u *highlight_has_attr(int id, int flag, int modec); 48 | char_u *highlight_color(int id, char_u *what, int modec); 49 | long_u highlight_gui_color_rgb(int id, int fg); 50 | int syn_name2id(char_u *name); 51 | int syn_name2attr(char_u *name); 52 | int highlight_exists(char_u *name); 53 | char_u *syn_id2name(int id); 54 | int syn_namen2id(char_u *linep, int len); 55 | int syn_check_group(char_u *pp, int len); 56 | int syn_id2attr(int hl_id); 57 | int syn_id2colors(int hl_id, guicolor_T *fgp, guicolor_T *bgp); 58 | void syn_id2cterm_bg(int hl_id, int *fgp, int *bgp); 59 | int syn_get_final_id(int hl_id); 60 | void highlight_gui_started(void); 61 | int highlight_changed(void); 62 | void set_context_in_highlight_cmd(expand_T *xp, char_u *arg); 63 | char_u *get_highlight_name(expand_T *xp, int idx); 64 | char_u *get_highlight_name_ext(expand_T *xp, int idx, int skip_cleared); 65 | void free_highlight_fonts(void); 66 | /* vim: set ft=c : */ 67 | -------------------------------------------------------------------------------- /lib/libvim/proto/tag.pro: -------------------------------------------------------------------------------- 1 | /* tag.c */ 2 | int do_tag(char_u *tag, int type, int count, int forceit, int verbose); 3 | void tag_freematch(void); 4 | void do_tags(exarg_T *eap); 5 | int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, 6 | int mincount, char_u *buf_ffname); 7 | void free_tag_stuff(void); 8 | int get_tagfname(tagname_T *tnp, int first, char_u *buf); 9 | void tagname_free(tagname_T *tnp); 10 | int expand_tags(int tagnames, char_u *pat, int *num_file, char_u ***file); 11 | int get_tags(list_T *list, char_u *pat, char_u *buf_fname); 12 | void get_tagstack(win_T *wp, dict_T *retdict); 13 | int set_tagstack(win_T *wp, dict_T *d, int action); 14 | /* vim: set ft=c : */ 15 | -------------------------------------------------------------------------------- /lib/libvim/proto/term.pro: -------------------------------------------------------------------------------- 1 | /* term.c */ 2 | guicolor_T termgui_mch_get_color(char_u *name); 3 | guicolor_T termgui_get_color(char_u *name); 4 | guicolor_T termgui_mch_get_rgb(guicolor_T color); 5 | int set_termname(char_u *term); 6 | void set_mouse_termcode(int n, char_u *s); 7 | void del_mouse_termcode(int n); 8 | void getlinecol(long *cp, long *rp); 9 | int add_termcap_entry(char_u *name, int force); 10 | int term_is_8bit(char_u *name); 11 | int term_is_gui(char_u *name); 12 | char_u *tltoa(unsigned long i); 13 | void termcapinit(char_u *name); 14 | void out_trash(void); 15 | void out_str_nf(char_u *s); 16 | void out_str_cf(char_u *s); 17 | void out_str(char_u *s); 18 | void term_windgoto(int row, int col); 19 | void term_cursor_right(int i); 20 | void term_append_lines(int line_count); 21 | void term_delete_lines(int line_count); 22 | void term_set_winpos(int x, int y); 23 | int term_get_winpos(int *x, int *y, varnumber_T timeout); 24 | void term_set_winsize(int height, int width); 25 | void term_fg_color(int n); 26 | void term_bg_color(int n); 27 | void term_fg_rgb_color(guicolor_T rgb); 28 | void term_bg_rgb_color(guicolor_T rgb); 29 | void term_settitle(char_u *title); 30 | void term_push_title(int which); 31 | void term_pop_title(int which); 32 | void ttest(int pairs); 33 | void add_long_to_buf(long_u val, char_u *dst); 34 | void check_shellsize(void); 35 | void limit_screen_size(void); 36 | void win_new_shellsize(void); 37 | void shell_resized(void); 38 | void shell_resized_check(void); 39 | void set_shellsize(int width, int height, int mustset); 40 | void settmode(int tmode); 41 | void starttermcap(void); 42 | void stoptermcap(void); 43 | void may_req_termresponse(void); 44 | void may_req_ambiguous_char_width(void); 45 | void may_req_bg_color(void); 46 | int swapping_screen(void); 47 | void setmouse(void); 48 | int mouse_has(int c); 49 | int mouse_model_popup(void); 50 | void scroll_start(void); 51 | void cursor_on_force(void); 52 | void cursor_on(void); 53 | void cursor_off(void); 54 | void term_cursor_mode(int forced); 55 | void term_cursor_color(char_u *color); 56 | int blink_state_is_inverted(void); 57 | void term_cursor_shape(int shape, int blink); 58 | void scroll_region_set(win_T *wp, int off); 59 | void scroll_region_reset(void); 60 | void clear_termcodes(void); 61 | void add_termcode(char_u *name, char_u *string, int flags); 62 | char_u *find_termcode(char_u *name); 63 | char_u *get_termcode(int i); 64 | void del_termcode(char_u *name); 65 | void set_mouse_topline(win_T *wp); 66 | int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen); 67 | void term_get_fg_color(char_u *r, char_u *g, char_u *b); 68 | void term_get_bg_color(char_u *r, char_u *g, char_u *b); 69 | char_u *replace_termcodes(char_u *from, char_u **bufp, int from_part, int do_lt, 70 | int special); 71 | int find_term_bykeys(char_u *src); 72 | void show_termcodes(void); 73 | int show_one_termcode(char_u *name, char_u *code, int printit); 74 | char_u *translate_mapping(char_u *str); 75 | void update_tcap(int attr); 76 | void swap_tcap(void); 77 | guicolor_T gui_get_color_cmn(char_u *name); 78 | guicolor_T gui_get_rgb_color_cmn(int r, int g, int b); 79 | void cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx); 80 | /* vim: set ft=c : */ 81 | -------------------------------------------------------------------------------- /lib/libvim/proto/terminal.pro: -------------------------------------------------------------------------------- 1 | /* terminal.c */ 2 | void init_job_options(jobopt_T *opt); 3 | buf_T *term_start(typval_T *argvar, char **argv, jobopt_T *opt, int flags); 4 | void ex_terminal(exarg_T *eap); 5 | int term_write_session(FILE *fd, win_T *wp); 6 | int term_should_restore(buf_T *buf); 7 | void free_terminal(buf_T *buf); 8 | void free_unused_terminals(void); 9 | void write_to_term(buf_T *buffer, char_u *msg, channel_T *channel); 10 | int term_job_running(term_T *term); 11 | int term_none_open(term_T *term); 12 | int term_try_stop_job(buf_T *buf); 13 | int term_check_timers(int next_due_arg, proftime_T *now); 14 | int term_in_normal_mode(void); 15 | void term_enter_job_mode(void); 16 | int send_keys_to_term(term_T *term, int c, int typed); 17 | int terminal_is_active(void); 18 | int term_use_loop(void); 19 | void term_win_entered(void); 20 | int terminal_loop(int blocking); 21 | void term_channel_closed(channel_T *ch); 22 | void term_check_channel_closed_recently(void); 23 | int term_do_update_window(win_T *wp); 24 | void term_update_window(win_T *wp); 25 | int term_is_finished(buf_T *buf); 26 | int term_show_buffer(buf_T *buf); 27 | void term_change_in_curbuf(void); 28 | int term_get_attr(buf_T *buf, linenr_T lnum, int col); 29 | char_u *term_get_status_text(term_T *term); 30 | int set_ref_in_term(int copyID); 31 | void set_terminal_default_colors(int cterm_fg, int cterm_bg); 32 | void f_term_dumpwrite(typval_T *argvars, typval_T *rettv); 33 | int term_swap_diff(void); 34 | void f_term_dumpdiff(typval_T *argvars, typval_T *rettv); 35 | void f_term_dumpload(typval_T *argvars, typval_T *rettv); 36 | void f_term_getaltscreen(typval_T *argvars, typval_T *rettv); 37 | void f_term_getattr(typval_T *argvars, typval_T *rettv); 38 | void f_term_getcursor(typval_T *argvars, typval_T *rettv); 39 | void f_term_getjob(typval_T *argvars, typval_T *rettv); 40 | void f_term_getline(typval_T *argvars, typval_T *rettv); 41 | void f_term_getscrolled(typval_T *argvars, typval_T *rettv); 42 | void f_term_getsize(typval_T *argvars, typval_T *rettv); 43 | void f_term_setsize(typval_T *argvars, typval_T *rettv); 44 | void f_term_getstatus(typval_T *argvars, typval_T *rettv); 45 | void f_term_gettitle(typval_T *argvars, typval_T *rettv); 46 | void f_term_gettty(typval_T *argvars, typval_T *rettv); 47 | void f_term_list(typval_T *argvars, typval_T *rettv); 48 | void f_term_scrape(typval_T *argvars, typval_T *rettv); 49 | void f_term_sendkeys(typval_T *argvars, typval_T *rettv); 50 | void f_term_getansicolors(typval_T *argvars, typval_T *rettv); 51 | void f_term_setansicolors(typval_T *argvars, typval_T *rettv); 52 | void f_term_setrestore(typval_T *argvars, typval_T *rettv); 53 | void f_term_setkill(typval_T *argvars, typval_T *rettv); 54 | void f_term_start(typval_T *argvars, typval_T *rettv); 55 | void f_term_wait(typval_T *argvars, typval_T *rettv); 56 | void term_send_eof(channel_T *ch); 57 | job_T *term_getjob(term_T *term); 58 | void term_free_conpty(term_T *term); 59 | int use_conpty(void); 60 | int terminal_enabled(void); 61 | /* vim: set ft=c : */ 62 | -------------------------------------------------------------------------------- /lib/libvim/proto/termlib.pro: -------------------------------------------------------------------------------- 1 | /* termlib.c */ 2 | int tgetent(char *tbuf, char *term); 3 | int tgetflag(char *id); 4 | int tgetnum(char *id); 5 | char *tgetstr(char *id, char **buf); 6 | char *tgoto(char *cm, int col, int line); 7 | int tputs(char *cp, int affcnt, void (*outc)(unsigned int)); 8 | /* vim: set ft=c : */ 9 | -------------------------------------------------------------------------------- /lib/libvim/proto/ui.pro: -------------------------------------------------------------------------------- 1 | /* ui.c */ 2 | void ui_inchar_undo(char_u *s, int len); 3 | int ui_inchar(char_u *buf, int maxlen, long wtime, int tb_change_cnt); 4 | int ui_wait_for_chars_or_timer(long wtime, 5 | int (*wait_func)(long wtime, int *interrupted, 6 | int ignore_input), 7 | int *interrupted, int ignore_input); 8 | int ui_char_avail(void); 9 | void ui_delay(long msec, int ignoreinput); 10 | void ui_suspend(void); 11 | void suspend_shell(void); 12 | int ui_get_shellsize(void); 13 | void ui_set_shellsize(int mustset); 14 | void ui_new_shellsize(void); 15 | int ui_get_winpos(int *x, int *y, varnumber_T timeout); 16 | void ui_breakcheck(void); 17 | void ui_breakcheck_force(int force); 18 | void clip_init(int can_use); 19 | void clip_update_selection(VimClipboard *clip); 20 | void clip_own_selection(VimClipboard *cbd); 21 | void clip_lose_selection(VimClipboard *cbd); 22 | void start_global_changes(void); 23 | int is_clipboard_needs_update(void); 24 | void end_global_changes(void); 25 | void clip_auto_select(void); 26 | int clip_isautosel_star(void); 27 | int clip_isautosel_plus(void); 28 | void clip_modeless(int button, int is_click, int is_drag); 29 | void clip_start_selection(int col, int row, int repeated_click); 30 | void clip_process_selection(int button, int col, int row, int_u repeated_click); 31 | void clip_may_redraw_selection(int row, int col, int len); 32 | void clip_clear_selection(VimClipboard *cbd); 33 | void clip_may_clear_selection(int row1, int row2); 34 | void clip_scroll_selection(int rows); 35 | void clip_copy_modeless_selection(int both); 36 | int clip_gen_own_selection(VimClipboard *cbd); 37 | void clip_gen_lose_selection(VimClipboard *cbd); 38 | void clip_gen_set_selection(VimClipboard *cbd); 39 | void clip_gen_request_selection(VimClipboard *cbd); 40 | int clip_gen_owner_exists(VimClipboard *cbd); 41 | int vim_is_input_buf_full(void); 42 | int vim_is_input_buf_empty(void); 43 | int vim_free_in_input_buf(void); 44 | int vim_used_in_input_buf(void); 45 | char_u *get_input_buf(void); 46 | void set_input_buf(char_u *p); 47 | void add_to_input_buf(char_u *s, int len); 48 | void add_to_input_buf_csi(char_u *str, int len); 49 | void trash_input_buf(void); 50 | int read_from_input_buf(char_u *buf, long maxlen); 51 | void fill_input_buf(int exit_on_error); 52 | void read_error_exit(void); 53 | void ui_cursor_shape_forced(int forced); 54 | void ui_cursor_shape(void); 55 | int check_col(int col); 56 | int check_row(int row); 57 | void open_app_context(void); 58 | int jump_to_mouse(int flags, int *inclusive, int which_button); 59 | int mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump); 60 | win_T *mouse_find_win(int *rowp, int *colp); 61 | int get_fpos_of_mouse(pos_T *mpos); 62 | int vcol2col(win_T *wp, linenr_T lnum, int vcol); 63 | void ui_focus_change(int in_focus); 64 | /* vim: set ft=c : */ 65 | -------------------------------------------------------------------------------- /lib/libvim/proto/undo.pro: -------------------------------------------------------------------------------- 1 | /* undo.c */ 2 | int u_save_cursor(void); 3 | int u_save(linenr_T top, linenr_T bot); 4 | int u_savesub(linenr_T lnum); 5 | int u_inssub(linenr_T lnum); 6 | int u_savedel(linenr_T lnum, long nlines); 7 | int undo_allowed(void); 8 | int u_savecommon(linenr_T top, linenr_T bot, linenr_T newbot, int reload); 9 | void u_compute_hash(char_u *hash); 10 | char_u *u_get_undo_file_name(char_u *buf_ffname, int reading); 11 | void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash); 12 | void u_read_undo(char_u *name, char_u *hash, char_u *orig_name); 13 | void u_undo(int count); 14 | void u_redo(int count); 15 | void undo_time(long step, int sec, int file, int absolute); 16 | void u_sync(int force); 17 | void ex_undolist(exarg_T *eap); 18 | void ex_undojoin(exarg_T *eap); 19 | void u_unchanged(buf_T *buf); 20 | void u_find_first_changed(void); 21 | void u_update_save_nr(buf_T *buf); 22 | void u_clearall(buf_T *buf); 23 | void u_saveline(linenr_T lnum); 24 | void u_clearline(void); 25 | void u_undoline(void); 26 | void u_blockfree(buf_T *buf); 27 | int bufIsChanged(buf_T *buf); 28 | int anyBufIsChanged(void); 29 | int bufIsChangedNotTerm(buf_T *buf); 30 | int curbufIsChanged(void); 31 | void u_eval_tree(u_header_T *first_uhp, list_T *list); 32 | /* vim: set ft=c : */ 33 | -------------------------------------------------------------------------------- /lib/libvim/proto/usercmd.pro: -------------------------------------------------------------------------------- 1 | /* usercmd.c */ 2 | char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, 3 | int *complp); 4 | char_u *set_context_in_user_cmd(expand_T *xp, char_u *arg_in); 5 | char_u *get_user_command_name(int idx); 6 | char_u *get_user_commands(expand_T *xp, int idx); 7 | char_u *get_user_cmd_addr_type(expand_T *xp, int idx); 8 | char_u *get_user_cmd_flags(expand_T *xp, int idx); 9 | char_u *get_user_cmd_nargs(expand_T *xp, int idx); 10 | char_u *get_user_cmd_complete(expand_T *xp, int idx); 11 | int cmdcomplete_str_to_type(char_u *complete_str); 12 | char *uc_fun_cmd(void); 13 | int parse_compl_arg(char_u *value, int vallen, int *complp, long *argt, 14 | char_u **compl_arg); 15 | void ex_command(exarg_T *eap); 16 | void ex_comclear(exarg_T *eap); 17 | void uc_clear(garray_T *gap); 18 | void ex_delcommand(exarg_T *eap); 19 | void do_ucmd(exarg_T *eap); 20 | /* vim: set ft=c : */ 21 | -------------------------------------------------------------------------------- /lib/libvim/proto/userfunc.pro: -------------------------------------------------------------------------------- 1 | /* userfunc.c */ 2 | void func_init(void); 3 | int get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate); 4 | char_u *deref_func_name(char_u *name, int *lenp, partial_T **partialp, 5 | int no_autoload); 6 | int get_func_tv(char_u *name, int len, typval_T *rettv, char_u **arg, 7 | linenr_T firstline, linenr_T lastline, int *doesrange, 8 | int evaluate, partial_T *partial, dict_T *selfdict); 9 | ufunc_T *find_func(char_u *name); 10 | void save_funccal(funccal_entry_T *entry); 11 | void restore_funccal(void); 12 | void free_all_functions(void); 13 | int func_call(char_u *name, typval_T *args, partial_T *partial, 14 | dict_T *selfdict, typval_T *rettv); 15 | int call_callback(callback_T *callback, int len, typval_T *rettv, int argcount, 16 | typval_T *argvars, int (*argv_func)(int, typval_T *, int), 17 | linenr_T firstline, linenr_T lastline, int *doesrange, 18 | int evaluate, dict_T *selfdict); 19 | int call_func(char_u *funcname, int len, typval_T *rettv, int argcount_in, 20 | typval_T *argvars_in, int (*argv_func)(int, typval_T *, int), 21 | linenr_T firstline, linenr_T lastline, int *doesrange, 22 | int evaluate, partial_T *partial, dict_T *selfdict_in); 23 | char_u *trans_function_name(char_u **pp, int skip, int flags, funcdict_T *fdp, 24 | partial_T **partial); 25 | void ex_function(exarg_T *eap); 26 | int eval_fname_script(char_u *p); 27 | int translated_function_exists(char_u *name); 28 | int function_exists(char_u *name, int no_deref); 29 | char_u *get_expanded_name(char_u *name, int check); 30 | void func_dump_profile(FILE *fd); 31 | void prof_child_enter(proftime_T *tm); 32 | void prof_child_exit(proftime_T *tm); 33 | char_u *get_user_func_name(expand_T *xp, int idx); 34 | void ex_delfunction(exarg_T *eap); 35 | void func_unref(char_u *name); 36 | void func_ptr_unref(ufunc_T *fp); 37 | void func_ref(char_u *name); 38 | void func_ptr_ref(ufunc_T *fp); 39 | void ex_return(exarg_T *eap); 40 | void ex_call(exarg_T *eap); 41 | int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv); 42 | void discard_pending_return(void *rettv); 43 | char_u *get_return_cmd(void *rettv); 44 | char_u *get_func_line(int c, void *cookie, int indent); 45 | void func_line_start(void *cookie); 46 | void func_line_exec(void *cookie); 47 | void func_line_end(void *cookie); 48 | int func_has_ended(void *cookie); 49 | int func_has_abort(void *cookie); 50 | dict_T *make_partial(dict_T *selfdict_in, typval_T *rettv); 51 | char_u *func_name(void *cookie); 52 | linenr_T *func_breakpoint(void *cookie); 53 | int *func_dbg_tick(void *cookie); 54 | int func_level(void *cookie); 55 | int current_func_returned(void); 56 | int free_unref_funccal(int copyID, int testing); 57 | hashtab_T *get_funccal_local_ht(void); 58 | dictitem_T *get_funccal_local_var(void); 59 | hashtab_T *get_funccal_args_ht(void); 60 | dictitem_T *get_funccal_args_var(void); 61 | void list_func_vars(int *first); 62 | dict_T *get_current_funccal_dict(hashtab_T *ht); 63 | hashitem_T *find_hi_in_scoped_ht(char_u *name, hashtab_T **pht); 64 | dictitem_T *find_var_in_scoped_ht(char_u *name, int no_autoload); 65 | int set_ref_in_previous_funccal(int copyID); 66 | int set_ref_in_call_stack(int copyID); 67 | int set_ref_in_functions(int copyID); 68 | int set_ref_in_func_args(int copyID); 69 | int set_ref_in_func(char_u *name, ufunc_T *fp_in, int copyID); 70 | /* vim: set ft=c : */ 71 | -------------------------------------------------------------------------------- /lib/libvim/proto/version.pro: -------------------------------------------------------------------------------- 1 | /* version.c */ 2 | void init_longVersion(void); 3 | int highest_patch(void); 4 | int has_patch(int n); 5 | void ex_version(exarg_T *eap); 6 | void list_in_columns(char_u **items, int size, int current); 7 | void list_version(void); 8 | void maybe_intro_message(void); 9 | void intro_message(int colon); 10 | void ex_intro(exarg_T *eap); 11 | /* vim: set ft=c : */ 12 | -------------------------------------------------------------------------------- /lib/libvim/proto/winclip.pro: -------------------------------------------------------------------------------- 1 | /* winclip.c */ 2 | int utf8_to_utf16(char_u *instr, int inlen, short_u *outstr, int *unconvlenp); 3 | int utf16_to_utf8(short_u *instr, int inlen, char_u *outstr); 4 | void MultiByteToWideChar_alloc(UINT cp, DWORD flags, LPCSTR in, int inlen, 5 | LPWSTR *out, int *outlen); 6 | void WideCharToMultiByte_alloc(UINT cp, DWORD flags, LPCWSTR in, int inlen, 7 | LPSTR *out, int *outlen, LPCSTR def, 8 | LPBOOL useddef); 9 | void win_clip_init(void); 10 | int clip_mch_own_selection(VimClipboard *cbd); 11 | void clip_mch_lose_selection(VimClipboard *cbd); 12 | void clip_mch_request_selection(VimClipboard *cbd); 13 | void clip_mch_set_selection(VimClipboard *cbd); 14 | short_u *enc_to_utf16(char_u *str, int *lenp); 15 | char_u *utf16_to_enc(short_u *str, int *lenp); 16 | void acp_to_enc(char_u *str, int str_size, char_u **out, int *outlen); 17 | void enc_to_acp(char_u *str, int str_size, char_u **out, int *outlen); 18 | /* vim: set ft=c : */ 19 | -------------------------------------------------------------------------------- /lib/libvim/proto/window.pro: -------------------------------------------------------------------------------- 1 | /* window.c */ 2 | void do_window(int nchar, long Prenum, int xchar); 3 | void get_wincmd_addr_type(char_u *arg, exarg_T *eap); 4 | int win_split(int size, int flags); 5 | int win_split_ins(int size, int flags, win_T *new_wp, int dir); 6 | int win_valid(win_T *win); 7 | int win_valid_any_tab(win_T *win); 8 | int win_count(void); 9 | int make_windows(int count, int vertical); 10 | void win_move_after(win_T *win1, win_T *win2); 11 | void win_equal(win_T *next_curwin, int current, int dir); 12 | void close_windows(buf_T *buf, int keep_curwin); 13 | int one_window(void); 14 | int win_close(win_T *win, int free_buf); 15 | void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp); 16 | void win_free_all(void); 17 | win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp); 18 | void close_others(int message, int forceit); 19 | void curwin_init(void); 20 | void win_init_empty(win_T *wp); 21 | int win_alloc_first(void); 22 | win_T *win_alloc_popup_win(void); 23 | void win_init_popup_win(win_T *wp, buf_T *buf); 24 | void win_init_size(void); 25 | void free_tabpage(tabpage_T *tp); 26 | int win_new_tabpage(int after); 27 | int may_open_tabpage(void); 28 | int make_tabpages(int maxcount); 29 | int valid_tabpage(tabpage_T *tpc); 30 | int valid_tabpage_win(tabpage_T *tpc); 31 | void close_tabpage(tabpage_T *tab); 32 | tabpage_T *find_tabpage(int n); 33 | int tabpage_index(tabpage_T *ftp); 34 | void goto_tabpage(int n); 35 | void goto_tabpage_tp(tabpage_T *tp, int trigger_enter_autocmds, 36 | int trigger_leave_autocmds); 37 | void goto_tabpage_win(tabpage_T *tp, win_T *wp); 38 | void tabpage_move(int nr); 39 | void win_goto(win_T *wp); 40 | win_T *win_find_nr(int winnr); 41 | tabpage_T *win_find_tabpage(win_T *win); 42 | win_T *win_vert_neighbor(tabpage_T *tp, win_T *wp, int up, long count); 43 | win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, int left, long count); 44 | void win_enter(win_T *wp, int undo_sync); 45 | win_T *buf_jump_open_win(buf_T *buf); 46 | win_T *buf_jump_open_tab(buf_T *buf); 47 | int win_unlisted(win_T *wp); 48 | void win_free_popup(win_T *win); 49 | void win_append(win_T *after, win_T *wp); 50 | void win_remove(win_T *wp, tabpage_T *tp); 51 | int win_alloc_lines(win_T *wp); 52 | void win_free_lsize(win_T *wp); 53 | void shell_new_rows(void); 54 | void shell_new_columns(void); 55 | void win_size_save(garray_T *gap); 56 | void win_size_restore(garray_T *gap); 57 | int win_comp_pos(void); 58 | void win_setheight(int height); 59 | void win_setheight_win(int height, win_T *win); 60 | void win_setwidth(int width); 61 | void win_setwidth_win(int width, win_T *wp); 62 | void win_setminheight(void); 63 | void win_setminwidth(void); 64 | void win_drag_status_line(win_T *dragwin, int offset); 65 | void win_drag_vsep_line(win_T *dragwin, int offset); 66 | void set_fraction(win_T *wp); 67 | void win_new_height(win_T *wp, int height); 68 | void scroll_to_fraction(win_T *wp, int prev_height); 69 | void win_new_width(win_T *wp, int width); 70 | void win_comp_scroll(win_T *wp); 71 | void command_height(void); 72 | void last_status(int morewin); 73 | int tabline_height(void); 74 | int min_rows(void); 75 | int only_one_window(void); 76 | void check_lnums(int do_curwin); 77 | void reset_lnums(void); 78 | void make_snapshot(int idx); 79 | void restore_snapshot(int idx, int close_curwin); 80 | int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, 81 | tabpage_T *tp, int no_display); 82 | int switch_win_noblock(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, 83 | tabpage_T *tp, int no_display); 84 | void restore_win(win_T *save_curwin, tabpage_T *save_curtab, int no_display); 85 | void restore_win_noblock(win_T *save_curwin, tabpage_T *save_curtab, 86 | int no_display); 87 | void switch_buffer(bufref_T *save_curbuf, buf_T *buf); 88 | void restore_buffer(bufref_T *save_curbuf); 89 | int win_hasvertsplit(void); 90 | int match_add(win_T *wp, char_u *grp, char_u *pat, int prio, int id, 91 | list_T *pos_list, char_u *conceal_char); 92 | int match_delete(win_T *wp, int id, int perr); 93 | void clear_matches(win_T *wp); 94 | matchitem_T *get_match(win_T *wp, int id); 95 | int get_win_number(win_T *wp, win_T *first_win); 96 | int get_tab_number(tabpage_T *tp); 97 | int win_getid(typval_T *argvars); 98 | int win_gotoid(typval_T *argvars); 99 | void win_id2tabwin(typval_T *argvars, list_T *list); 100 | win_T *win_id2wp(int id); 101 | int win_id2win(typval_T *argvars); 102 | void win_findbuf(typval_T *argvars, list_T *list); 103 | void get_framelayout(frame_T *fr, list_T *l, int outer); 104 | /* vim: set ft=c : */ 105 | -------------------------------------------------------------------------------- /lib/libvim/protodef.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | #ifdef PROTO 10 | // cproto runs into trouble when these types are missing 11 | typedef double _Float16; 12 | typedef double _Float32; 13 | typedef double _Float64; 14 | typedef double _Float128; 15 | typedef double _Float32x; 16 | typedef double _Float64x; 17 | #endif 18 | -------------------------------------------------------------------------------- /lib/libvim/regexp.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 4 | * 5 | * This is NOT the original regular expression code as written by Henry 6 | * Spencer. This code has been modified specifically for use with Vim, and 7 | * should not be used apart from compiling Vim. If you want a good regular 8 | * expression library, get the original code. 9 | * 10 | * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 11 | */ 12 | 13 | #ifndef _REGEXP_H 14 | #define _REGEXP_H 15 | 16 | /* 17 | * The number of sub-matches is limited to 10. 18 | * The first one (index 0) is the whole match, referenced with "\0". 19 | * The second one (index 1) is the first sub-match, referenced with "\1". 20 | * This goes up to the tenth (index 9), referenced with "\9". 21 | */ 22 | #define NSUBEXP 10 23 | 24 | /* 25 | * In the NFA engine: how many braces are allowed. 26 | * TODO(RE): Use dynamic memory allocation instead of static, like here 27 | */ 28 | #define NFA_MAX_BRACES 20 29 | 30 | /* 31 | * In the NFA engine: how many states are allowed 32 | */ 33 | #define NFA_MAX_STATES 100000 34 | #define NFA_TOO_EXPENSIVE -1 35 | 36 | /* Which regexp engine to use? Needed for vim_regcomp(). 37 | * Must match with 'regexpengine'. */ 38 | #define AUTOMATIC_ENGINE 0 39 | #define BACKTRACKING_ENGINE 1 40 | #define NFA_ENGINE 2 41 | 42 | typedef struct regengine regengine_T; 43 | 44 | /* 45 | * Structure returned by vim_regcomp() to pass on to vim_regexec(). 46 | * This is the general structure. For the actual matcher, two specific 47 | * structures are used. See code below. 48 | */ 49 | typedef struct regprog 50 | { 51 | regengine_T *engine; 52 | unsigned regflags; 53 | unsigned re_engine; // automatic, backtracking or nfa engine 54 | unsigned re_flags; // second argument for vim_regcomp() 55 | int re_in_use; // prog is being executed 56 | } regprog_T; 57 | 58 | /* 59 | * Structure used by the back track matcher. 60 | * These fields are only to be used in regexp.c! 61 | * See regexp.c for an explanation. 62 | */ 63 | typedef struct 64 | { 65 | /* These four members implement regprog_T */ 66 | regengine_T *engine; 67 | unsigned regflags; 68 | unsigned re_engine; 69 | unsigned re_flags; 70 | int re_in_use; 71 | 72 | int regstart; 73 | char_u reganch; 74 | char_u *regmust; 75 | int regmlen; 76 | char_u program[1]; /* actually longer.. */ 77 | } bt_regprog_T; 78 | 79 | /* 80 | * Structure representing a NFA state. 81 | * An NFA state may have no outgoing edge, when it is a NFA_MATCH state. 82 | */ 83 | typedef struct nfa_state nfa_state_T; 84 | struct nfa_state 85 | { 86 | int c; 87 | nfa_state_T *out; 88 | nfa_state_T *out1; 89 | int id; 90 | int lastlist[2]; /* 0: normal, 1: recursive */ 91 | int val; 92 | }; 93 | 94 | /* 95 | * Structure used by the NFA matcher. 96 | */ 97 | typedef struct 98 | { 99 | /* These three members implement regprog_T */ 100 | regengine_T *engine; 101 | unsigned regflags; 102 | unsigned re_engine; 103 | unsigned re_flags; 104 | int re_in_use; 105 | 106 | nfa_state_T *start; /* points into state[] */ 107 | 108 | int reganch; /* pattern starts with ^ */ 109 | int regstart; /* char at start of pattern */ 110 | char_u *match_text; /* plain text to match with */ 111 | 112 | int has_zend; /* pattern contains \ze */ 113 | int has_backref; /* pattern contains \1 .. \9 */ 114 | char_u *pattern; 115 | int nsubexp; /* number of () */ 116 | int nstate; 117 | nfa_state_T state[1]; /* actually longer.. */ 118 | } nfa_regprog_T; 119 | 120 | /* 121 | * Structure to be used for single-line matching. 122 | * Sub-match "no" starts at "startp[no]" and ends just before "endp[no]". 123 | * When there is no match, the pointer is NULL. 124 | */ 125 | typedef struct 126 | { 127 | regprog_T *regprog; 128 | char_u *startp[NSUBEXP]; 129 | char_u *endp[NSUBEXP]; 130 | int rm_ic; 131 | } regmatch_T; 132 | 133 | /* 134 | * Structure to be used for multi-line matching. 135 | * Sub-match "no" starts in line "startpos[no].lnum" column "startpos[no].col" 136 | * and ends in line "endpos[no].lnum" just before column "endpos[no].col". 137 | * The line numbers are relative to the first line, thus startpos[0].lnum is 138 | * always 0. 139 | * When there is no match, the line number is -1. 140 | */ 141 | typedef struct 142 | { 143 | regprog_T *regprog; 144 | lpos_T startpos[NSUBEXP]; 145 | lpos_T endpos[NSUBEXP]; 146 | int rmm_ic; 147 | colnr_T rmm_maxcol; /* when not zero: maximum column */ 148 | } regmmatch_T; 149 | 150 | /* 151 | * Structure used to store external references: "\z\(\)" to "\z\1". 152 | * Use a reference count to avoid the need to copy this around. When it goes 153 | * from 1 to zero the matches need to be freed. 154 | */ 155 | typedef struct 156 | { 157 | short refcnt; 158 | char_u *matches[NSUBEXP]; 159 | } reg_extmatch_T; 160 | 161 | struct regengine 162 | { 163 | regprog_T *(*regcomp)(char_u *, int); 164 | void (*regfree)(regprog_T *); 165 | int (*regexec_nl)(regmatch_T *, char_u *, colnr_T, int); 166 | long (*regexec_multi)(regmmatch_T *, win_T *, buf_T *, linenr_T, colnr_T, proftime_T *, int *); 167 | char_u *expr; 168 | }; 169 | 170 | #endif /* _REGEXP_H */ 171 | -------------------------------------------------------------------------------- /lib/libvim/sdsalloc.h: -------------------------------------------------------------------------------- 1 | /* SDSLib 2.0 -- A C dynamic strings library 2 | * 3 | * Copyright (c) 2006-2015, Salvatore Sanfilippo 4 | * Copyright (c) 2015, Oran Agra 5 | * Copyright (c) 2015, Redis Labs, Inc 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of Redis nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* SDS allocator selection. 34 | * 35 | * This file is used in order to change the SDS allocator at compile time. 36 | * Just define the following defines to what you want to use. Also add 37 | * the include of your alternate allocator if needed (not needed in order 38 | * to use the default libc allocator). */ 39 | 40 | #define s_malloc malloc 41 | #define s_realloc realloc 42 | #define s_free free 43 | -------------------------------------------------------------------------------- /lib/libvim/version.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | */ 8 | 9 | /* 10 | * Define the version number, name, etc. 11 | * The patchlevel is in included_patches[], in version.c. 12 | * 13 | * This doesn't use string concatenation, some compilers don't support it. 14 | */ 15 | 16 | #define VIM_VERSION_MAJOR 8 17 | #define VIM_VERSION_MAJOR_STR "8" 18 | #define VIM_VERSION_MINOR 1 19 | #define VIM_VERSION_MINOR_STR "1" 20 | #define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR) 21 | 22 | #define VIM_VERSION_BUILD 282 23 | #define VIM_VERSION_BUILD_BCD 0x11a 24 | #define VIM_VERSION_BUILD_STR "282" 25 | #define VIM_VERSION_PATCHLEVEL 0 26 | #define VIM_VERSION_PATCHLEVEL_STR "0" 27 | /* Used by MacOS port should be one of: development, alpha, beta, final */ 28 | #define VIM_VERSION_RELEASE final 29 | 30 | /* 31 | * VIM_VERSION_NODOT is used for the runtime directory name. 32 | * VIM_VERSION_SHORT is copied into the swap file (max. length is 6 chars). 33 | * VIM_VERSION_MEDIUM is used for the startup-screen. 34 | * VIM_VERSION_LONG is used for the ":version" command and "Vim -h". 35 | */ 36 | #define VIM_VERSION_NODOT "vim81" 37 | #define VIM_VERSION_SHORT "8.1" 38 | #define VIM_VERSION_MEDIUM "8.1" 39 | #define VIM_VERSION_LONG "VIM - Vi IMproved 8.1 (2018 May 18)" 40 | #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 8.1 (2018 May 18, compiled " 41 | #define VIM_VERSION_LONG_ONLY "VIM - Vi IMproved 8.1" 42 | #define VIM_VERSION_DATE_ONLY "2018 May 18" 43 | -------------------------------------------------------------------------------- /lib/libvim/vimio.h: -------------------------------------------------------------------------------- 1 | /* vi:set ts=8 sts=4 sw=4 noet: 2 | * 3 | * VIM - Vi IMproved by Bram Moolenaar 4 | * 5 | * Do ":help uganda" in Vim to read copying and usage conditions. 6 | * Do ":help credits" in Vim to see a list of people who contributed. 7 | * See README.txt for an overview of the Vim source code. 8 | */ 9 | 10 | /* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */ 11 | #if _MSC_VER >= 1400 12 | #define _CRT_SECURE_NO_DEPRECATE 13 | #define _CRT_NONSTDC_NO_DEPRECATE 14 | #endif 15 | 16 | /* cproto fails on missing include files */ 17 | #ifndef PROTO 18 | #include 19 | #endif 20 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | VERSION = "1.0.11" 2 | CC = clang 3 | DEFINES = -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN # -DMANUAL_AX -DGUI_MOVES 4 | LIBS = lib/libvim.a -lm -lncurses -liconv -framework Carbon -framework Cocoa 5 | WARN_FLAGS = -Wall -Wno-array-bounds \ 6 | -Wno-unknown-warning-option \ 7 | -Wno-cpp -Wno-pointer-sign \ 8 | -Wno-unused-parameter \ 9 | -Wno-strict-overflow \ 10 | -Wno-return-type -Werror 11 | CFLAGS = $(WARN_FLAGS) $(DEFINES) -g -Ilib -Ilib/libvim/proto -std=c99 -O2 #-fsanitize=address -fsanitize=undefined 12 | ODIR = bin 13 | SRC = src 14 | 15 | _OBJ = helpers.om workspace.om event_tap.o ax.o buffer.o line.o env_vars.o 16 | OBJ = $(patsubst %, $(ODIR)/%, $(_OBJ)) 17 | 18 | .PHONY: all x86 arm64 universal sign lib clean 19 | 20 | all: $(ODIR)/svim 21 | 22 | x86: CFLAGS = $(WARN_FLAGS) $(DEFINES) -g -Ilib -Ilib/libvim/proto -std=c99 -O2 -target x86_64-apple-macos12.0 23 | x86: $(ODIR)/svim 24 | mv $(ODIR)/svim $(ODIR)/svim_x86 25 | rm -rf $(ODIR)/*.o 26 | rm -rf $(ODIR)/*.om 27 | 28 | arm64: CFLAGS = $(WARN_FLAGS) $(DEFINES) -g -Ilib -Ilib/libvim/proto -std=c99 -O2 -target arm64-apple-macos12.0 29 | arm64: $(ODIR)/svim 30 | mv $(ODIR)/svim $(ODIR)/svim_arm64 31 | rm -rf $(ODIR)/*.o 32 | rm -rf $(ODIR)/*.om 33 | 34 | universal: 35 | $(MAKE) x86 36 | $(MAKE) arm64 37 | lipo -create -output $(ODIR)/svim $(ODIR)/svim_x86 $(ODIR)/svim_arm64 38 | 39 | sign: 40 | $(MAKE) universal 41 | codesign -fs 'svim-cert' $(ODIR)/svim 42 | 43 | bundle: clean 44 | $(MAKE) sign 45 | @mkdir bundle 46 | cp $(ODIR)/svim bundle/ 47 | cp -r examples/ bundle/ 48 | tar -czf bundle_$(VERSION).tgz bundle/ 49 | rm -rf bundle/ 50 | 51 | lib: 52 | cd libvim/src/ && make 53 | cp libvim/src/libvim.a lib/libvim.a 54 | 55 | bin/svim: $(SRC)/main.m $(OBJ) | $(ODIR) 56 | $(CC) $(CFLAGS) $^ -o $@ $(LIBS) 57 | 58 | $(ODIR)/%.o: $(SRC)/%.c $(SRC)/%.h | $(ODIR) 59 | $(CC) -c -o $@ $< $(CFLAGS) 60 | 61 | $(ODIR)/%.om: $(SRC)/%.m $(SRC)/%.h | $(ODIR) 62 | $(CC) -c -o $@ $< $(CFLAGS) 63 | 64 | $(ODIR): 65 | mkdir $(ODIR) 66 | 67 | .PHONY: clean 68 | 69 | clean: 70 | rm -rf $(ODIR) 71 | -------------------------------------------------------------------------------- /src/ax.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "buffer.h" 4 | 5 | #define ROLE_TEXT 1 6 | #define ROLE_TABLE 1 << 1 7 | #define ROLE_SCROLL 1 << 2 8 | 9 | #define FLAG_SHIFT 1 << 17 10 | #define FLAG_COMMAND 1 << 20 11 | 12 | #define ENTER 0x0D 13 | #define ESCAPE 0x1B 14 | 15 | #ifdef GUI_MOVES 16 | 17 | #define J 0x6A 18 | #define K 0x6B 19 | #define L 0x6C 20 | #define OE 0xF6 21 | 22 | #endif //GUI_MOVES 23 | 24 | extern char* cfstring_get_cstring(CFStringRef text_ref); 25 | 26 | struct ax { 27 | bool is_privileged; 28 | bool is_supported; 29 | 30 | uint32_t role; 31 | CFTypeRef selected_element; 32 | AXUIElementRef system_element; 33 | 34 | struct buffer buffer; 35 | }; 36 | 37 | struct ax g_ax; 38 | void ax_begin(struct ax* ax); 39 | void ax_clear(struct ax* ax); 40 | 41 | CGEventRef ax_process_event(struct ax* ax, CGEventRef event); 42 | void ax_front_app_changed(struct ax* ax, pid_t pid); 43 | -------------------------------------------------------------------------------- /src/buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "libvim/libvim.h" 5 | #include "line.h" 6 | #include "env_vars.h" 7 | 8 | #define BUFFER_CLEAR "%d" 9 | #define NORMAL_MODE "" 10 | #define INSERT_MODE "i" 11 | 12 | #define VISUAL_BLOCK 0x16 13 | #define VISUAL_LINE 0x56 14 | 15 | extern const char* read_file(char* path); 16 | extern bool vfork_exec(char *command, struct env_vars* env_vars); 17 | extern char* string_copy(char* s); 18 | 19 | struct cursor { 20 | uint32_t mode; 21 | long position; 22 | long selection; 23 | }; 24 | 25 | struct buffer { 26 | buf_T* vbuf; 27 | char_u* raw; 28 | bool did_change; 29 | 30 | struct line command_line; 31 | char cmd_line_mode; 32 | 33 | struct line** lines; 34 | uint32_t line_count; 35 | 36 | struct cursor cursor; 37 | }; 38 | 39 | void buffer_begin(struct buffer* buffer); 40 | void buffer_input(struct buffer* buffer, UniChar key, UniCharCount count); 41 | void buffer_clear(struct buffer* buffer); 42 | void buffer_revsync_text(struct buffer* buffer); 43 | void buffer_revsync_cursor(struct buffer* buffer); 44 | void buffer_call_script(struct buffer* buffer, bool supported); 45 | 46 | struct line* line_create(); 47 | void line_destroy(struct line* line); 48 | -------------------------------------------------------------------------------- /src/env_vars.c: -------------------------------------------------------------------------------- 1 | #include "env_vars.h" 2 | 3 | void env_vars_init(struct env_vars* env_vars) { 4 | env_vars->vars = NULL; 5 | env_vars->count = 0; 6 | } 7 | 8 | void env_vars_unset(struct env_vars* env_vars, char* key) { 9 | struct key_value_pair* key_value_pair = NULL; 10 | for (int i = 0; i < env_vars->count; i++) { 11 | if (strcmp(env_vars->vars[i]->key, key) == 0) 12 | key_value_pair = env_vars->vars[i]; 13 | } 14 | 15 | if (key_value_pair == NULL) return; 16 | 17 | if (env_vars->count == 1) { 18 | free(env_vars->vars); 19 | env_vars->vars = NULL; 20 | env_vars->count = 0; 21 | } else { 22 | struct key_value_pair* tmp[env_vars->count - 1]; 23 | int count = 0; 24 | for (int i = 0; i < env_vars->count; i++) { 25 | if (env_vars->vars[i] == key_value_pair) continue; 26 | tmp[count++] = env_vars->vars[i]; 27 | } 28 | env_vars->count--; 29 | env_vars->vars = realloc(env_vars->vars, 30 | sizeof(struct key_value_pair*)*env_vars->count); 31 | memcpy(env_vars->vars, 32 | tmp, 33 | sizeof(struct key_value_pair*)*env_vars->count); 34 | } 35 | 36 | if (key_value_pair->key) free(key_value_pair->key); 37 | if (key_value_pair->value) free(key_value_pair->value); 38 | free(key_value_pair); 39 | } 40 | 41 | void env_vars_set(struct env_vars* env_vars, char* key, char* value) { 42 | env_vars_unset(env_vars, key); 43 | 44 | env_vars->count++; 45 | env_vars->vars = realloc(env_vars->vars, 46 | env_vars->count * sizeof(struct key_value_pair*)); 47 | env_vars->vars[env_vars->count - 1] = malloc(sizeof(struct key_value_pair)); 48 | env_vars->vars[env_vars->count - 1]->key = key; 49 | env_vars->vars[env_vars->count - 1]->value = value; 50 | } 51 | 52 | char* env_vars_get_value_for_key(struct env_vars* env_vars, char* key) { 53 | for (int i = 0; i < env_vars->count; i++) { 54 | if (strcmp(env_vars->vars[i]->key, key) == 0) 55 | return env_vars->vars[i]->value; 56 | } 57 | return NULL; 58 | } 59 | 60 | void env_vars_destroy(struct env_vars* env_vars) { 61 | for (int i = 0; i < env_vars->count; i++) { 62 | if (env_vars->vars[i]->key) free(env_vars->vars[i]->key); 63 | if (env_vars->vars[i]->value) free(env_vars->vars[i]->value); 64 | free(env_vars->vars[i]); 65 | } 66 | free(env_vars->vars); 67 | } 68 | -------------------------------------------------------------------------------- /src/env_vars.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | struct key_value_pair { 6 | char* key; 7 | char* value; 8 | }; 9 | 10 | struct env_vars { 11 | uint32_t count; 12 | struct key_value_pair** vars; 13 | }; 14 | 15 | void env_vars_init(struct env_vars* env_vars); 16 | void env_vars_unset(struct env_vars* env_vars, char* key); 17 | void env_vars_set(struct env_vars* env_vars, char* key, char* value); 18 | char* env_vars_get_value_for_key(struct env_vars* env_vars, char* key); 19 | void env_vars_destroy(struct env_vars* env_vars); 20 | -------------------------------------------------------------------------------- /src/event_tap.c: -------------------------------------------------------------------------------- 1 | #include "event_tap.h" 2 | 3 | bool event_tap_check_blacklist(struct event_tap* event_tap, 4 | char* app, char* bundle_id ) { 5 | if (!app || !bundle_id) return true; 6 | for (int i = 0; i < event_tap->blacklist_count; i++) 7 | if (strcmp(event_tap->blacklist[i], app) == 0 8 | || strcmp(event_tap->blacklist[i], bundle_id) == 0) { 9 | return true; 10 | } 11 | 12 | return false; 13 | } 14 | 15 | static CGEventRef key_handler(CGEventTapProxy proxy, CGEventType type, 16 | CGEventRef event, void* reference) { 17 | switch (type) { 18 | case kCGEventTapDisabledByTimeout: 19 | printf("Timeout\n"); 20 | case kCGEventTapDisabledByUserInput: { 21 | printf("restarting event-tap\n"); 22 | CGEventTapEnable(((struct event_tap*) reference)->handle, true); 23 | } break; 24 | case kCGEventKeyDown: { 25 | if (((struct event_tap*) reference)->front_app_ignored) { 26 | if (g_ax.selected_element && g_ax.role) { 27 | ax_clear(&g_ax); 28 | } 29 | return event; 30 | } 31 | 32 | return ax_process_event(&g_ax, event); 33 | } break; 34 | } 35 | return event; 36 | } 37 | 38 | bool event_tap_enabled(struct event_tap* event_tap) { 39 | bool result = (event_tap->handle && CGEventTapIsEnabled(event_tap->handle)); 40 | return result; 41 | } 42 | 43 | void event_tap_load_blacklist(struct event_tap* event_tap) { 44 | event_tap->blacklist = NULL; 45 | event_tap->blacklist_count = 0; 46 | event_tap->front_app_ignored = true; 47 | 48 | char* home = getenv("HOME"); 49 | char buf[512]; 50 | snprintf(buf, sizeof(buf), "%s/%s", home, ".config/svim/blacklist"); 51 | 52 | FILE *file = fopen(buf, "r"); 53 | 54 | if (!file) return; 55 | 56 | char line[255]; 57 | while (fgets(line, 255, file)) { 58 | uint32_t len = strlen(line); 59 | if (line[len - 1] == '\n') line[len - 1] = '\0'; 60 | event_tap->blacklist = realloc(event_tap->blacklist, 61 | sizeof(char**) * ++event_tap->blacklist_count); 62 | 63 | event_tap->blacklist[event_tap->blacklist_count - 1] = string_copy(line); 64 | } 65 | fclose(file); 66 | } 67 | 68 | bool event_tap_begin(struct event_tap* event_tap) { 69 | event_tap_load_blacklist(event_tap); 70 | 71 | event_tap->mask = 1 << kCGEventKeyDown; 72 | event_tap->handle = CGEventTapCreate(kCGAnnotatedSessionEventTap, 73 | kCGHeadInsertEventTap, 74 | kCGEventTapOptionDefault, 75 | event_tap->mask, 76 | &key_handler, 77 | event_tap); 78 | 79 | bool result = event_tap_enabled(event_tap); 80 | if (result) { 81 | event_tap->runloop_source = CFMachPortCreateRunLoopSource( 82 | kCFAllocatorDefault, 83 | event_tap->handle, 84 | 0); 85 | CFRunLoopAddSource(CFRunLoopGetMain(), 86 | event_tap->runloop_source, 87 | kCFRunLoopCommonModes); 88 | } 89 | 90 | return result; 91 | } 92 | 93 | void event_tap_end(struct event_tap* event_tap) { 94 | if (event_tap_enabled(event_tap)) { 95 | CGEventTapEnable(event_tap->handle, false); 96 | CFMachPortInvalidate(event_tap->handle); 97 | CFRunLoopRemoveSource(CFRunLoopGetMain(), 98 | event_tap->runloop_source, 99 | kCFRunLoopCommonModes); 100 | CFRelease(event_tap->runloop_source); 101 | CFRelease(event_tap->handle); 102 | event_tap->handle = NULL; 103 | 104 | for (int i = 0; i < event_tap->blacklist_count; i++) 105 | if (event_tap->blacklist[i]) free(event_tap->blacklist[i]); 106 | 107 | if (event_tap->blacklist) free(event_tap->blacklist); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/event_tap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include "ax.h" 6 | #include "buffer.h" 7 | 8 | extern const char* get_name_for_pid(uint64_t pid); 9 | extern char* string_copy(char* s); 10 | 11 | struct event_tap { 12 | bool front_app_ignored; 13 | uint32_t blacklist_count; 14 | char** blacklist; 15 | CFMachPortRef handle; 16 | CFRunLoopSourceRef runloop_source; 17 | CGEventMask mask; 18 | }; 19 | 20 | struct event_tap g_event_tap; 21 | bool event_tap_enabled(struct event_tap *event_tap); 22 | bool event_tap_begin(struct event_tap *event_tap); 23 | void event_tap_end(struct event_tap *event_tap); 24 | bool event_tap_check_blacklist(struct event_tap* event_tap, char* app, char* bundle_id); 25 | -------------------------------------------------------------------------------- /src/helpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Cocoa/Cocoa.h" 3 | #include 4 | #include "env_vars.h" 5 | 6 | #define FORK_TIMEOUT 60 7 | 8 | char* string_copy(char* s); 9 | char* cfstring_get_cstring(CFStringRef text_ref); 10 | const char* get_name_for_pid(uint64_t pid); 11 | const char* read_file(char* path); 12 | bool vfork_exec(char *command, struct env_vars* env_vars); 13 | -------------------------------------------------------------------------------- /src/helpers.m: -------------------------------------------------------------------------------- 1 | #include "helpers.h" 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 5 | bool vfork_exec(char *command, struct env_vars* env_vars) { 6 | int pid = vfork(); 7 | if (pid == -1) return false; 8 | if (pid != 0) return true; 9 | 10 | alarm(FORK_TIMEOUT); 11 | 12 | if (env_vars) { 13 | for (int i = 0; i < env_vars->count; i++) { 14 | setenv(env_vars->vars[i]->key, env_vars->vars[i]->value, 1); 15 | } 16 | } 17 | 18 | char *exec[] = { "/usr/bin/env", "sh", "-c", command, NULL}; 19 | exit(execvp(exec[0], exec)); 20 | } 21 | #pragma clang diagnostic pop 22 | 23 | char* cfstring_get_cstring(CFStringRef text_ref) { 24 | CFIndex length = CFStringGetLength(text_ref); 25 | uint32_t size = CFStringGetMaximumSizeForEncoding(length, 26 | kCFStringEncodingUTF8); 27 | char* buf = malloc(sizeof(char)*(size + 1)); 28 | CFStringGetCString(text_ref, buf, size + 1, kCFStringEncodingUTF8); 29 | return buf; 30 | } 31 | 32 | char* string_copy(char* s) { 33 | int length = strlen(s); 34 | char* result = malloc(length + 1); 35 | if (!result) return NULL; 36 | 37 | memcpy(result, s, length); 38 | result[length] = '\0'; 39 | return result; 40 | } 41 | 42 | const char* get_name_for_pid(uint64_t pid) { 43 | return [[[NSRunningApplication runningApplicationWithProcessIdentifier:pid] localizedName] UTF8String]; 44 | } 45 | 46 | const char* read_file(char* path) { 47 | struct stat buffer; 48 | 49 | if (stat(path, &buffer) != 0 || buffer.st_mode & S_IFDIR) 50 | return NULL; 51 | 52 | int fd = open(path, O_RDONLY); 53 | int len = lseek(fd, 0, SEEK_END); 54 | char* file = mmap(0, len, PROT_READ, MAP_PRIVATE, fd, 0); 55 | close(fd); 56 | 57 | return string_copy(file); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/line.c: -------------------------------------------------------------------------------- 1 | #include "line.h" 2 | #include 3 | #include 4 | 5 | static inline uint32_t unicode_character_count(char* text) { 6 | char* read = text; 7 | uint32_t counter = 0; 8 | while (*read) { counter += ((*read++ & 0xC0) != 0x80); } 9 | return counter; 10 | } 11 | 12 | static inline uint32_t char_count_for_unicode_char_count(char* text, uint32_t uni_count) { 13 | char* read = text; 14 | uint32_t uni_counter = 0; 15 | uint32_t byte_counter = 0; 16 | while (*read) { 17 | uni_counter += ((*read++ & 0xC0) != 0x80); 18 | byte_counter++; 19 | if (uni_counter >= uni_count) break; 20 | } 21 | 22 | return byte_counter; 23 | } 24 | 25 | struct line* line_create() { 26 | struct line* line = malloc(sizeof(struct line)); 27 | memset(line, 0, sizeof(struct line)); 28 | return line; 29 | } 30 | 31 | void line_set_text(struct line* line, char* text) { 32 | if (!text) return; 33 | 34 | line->length = unicode_character_count(text); 35 | 36 | uint32_t len = strlen(text); 37 | line->raw = realloc(line->raw, sizeof(char) * (len + 1)); 38 | memcpy(line->raw, text, sizeof(char) * (len + 1)); 39 | line->raw_length = len; 40 | } 41 | 42 | void line_clear(struct line* line) { 43 | if (line->raw) free(line->raw); 44 | line->raw = NULL; 45 | line->cursor_offset = 0; 46 | line->length = 0; 47 | line->raw_length = 0; 48 | } 49 | 50 | void line_destroy(struct line* line) { 51 | line_clear(line); 52 | free(line); 53 | } 54 | 55 | uint32_t line_get_position_from_raw_position(struct line* line, 56 | uint32_t raw_pos) { 57 | if (line->raw_length >= raw_pos) { 58 | char raw[raw_pos + 1]; 59 | 60 | memcpy(raw, line->raw, sizeof(char) * raw_pos); 61 | raw[raw_pos] = '\0'; 62 | 63 | return unicode_character_count(raw); 64 | } 65 | return 0; 66 | } 67 | 68 | uint32_t line_get_raw_position_from_position(struct line* line, uint32_t pos) { 69 | return (line->length >= pos) 70 | ? char_count_for_unicode_char_count(line->raw, pos) 71 | : 0; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/line.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | struct line { 8 | uint32_t length; 9 | uint32_t raw_length; 10 | uint32_t cursor_offset; 11 | 12 | char* raw; 13 | }; 14 | 15 | struct line* line_create(); 16 | void line_clear(struct line* line); 17 | void line_destroy(struct line* line); 18 | void line_set_text(struct line* line, char* text); 19 | uint32_t line_get_position_from_raw_position(struct line* line, 20 | uint32_t raw_pos); 21 | uint32_t line_get_raw_position_from_position(struct line* line, uint32_t pos); 22 | -------------------------------------------------------------------------------- /src/main.m: -------------------------------------------------------------------------------- 1 | #include "Carbon/Carbon.h" 2 | #include "Cocoa/Cocoa.h" 3 | #include "event_tap.h" 4 | #include "ax.h" 5 | #include "workspace.h" 6 | 7 | void* g_workspace; 8 | 9 | static void acquire_lockfile(void) { 10 | char *user = getenv("USER"); 11 | if (!user) printf("Error: User variable not set.\n"), exit(1); 12 | 13 | char buffer[256]; 14 | snprintf(buffer, 256, "/tmp/svim_%s.lock" , user); 15 | 16 | int handle = open(buffer, O_CREAT | O_WRONLY, 0600); 17 | if (handle == -1) { 18 | printf("Error: Could not create lock-file.\n"); 19 | exit(1); 20 | } 21 | 22 | struct flock lockfd = { 23 | .l_start = 0, 24 | .l_len = 0, 25 | .l_pid = getpid(), 26 | .l_type = F_WRLCK, 27 | .l_whence = SEEK_SET 28 | }; 29 | 30 | if (fcntl(handle, F_SETLK, &lockfd) == -1) { 31 | printf("Error: Could not acquire lock-file.\nsvim already running?\n"); 32 | exit(1); 33 | } 34 | } 35 | 36 | int main (int argc, char *argv[]) { 37 | NSApplicationLoad(); 38 | signal(SIGCHLD, SIG_IGN); 39 | signal(SIGPIPE, SIG_IGN); 40 | 41 | acquire_lockfile(); 42 | ax_begin(&g_ax); 43 | event_tap_begin(&g_event_tap); 44 | workspace_begin(&g_workspace); 45 | 46 | CFRunLoopRun(); 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /src/workspace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "event_tap.h" 4 | 5 | bool g_front_app_ignored; 6 | 7 | extern char* string_copy(char* s); 8 | 9 | @interface workspace_context : NSObject { 10 | } 11 | - (id)init; 12 | @end 13 | 14 | void workspace_begin(void **context); 15 | -------------------------------------------------------------------------------- /src/workspace.m: -------------------------------------------------------------------------------- 1 | #include "workspace.h" 2 | #include "buffer.h" 3 | #include "event_tap.h" 4 | 5 | void workspace_begin(void **context) { 6 | workspace_context *ws_context = [workspace_context alloc]; 7 | *context = ws_context; 8 | 9 | [ws_context init]; 10 | } 11 | 12 | @implementation workspace_context 13 | - (id)init { 14 | if ((self = [super init])) { 15 | [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self 16 | selector:@selector(appSwitched:) 17 | name:NSWorkspaceDidActivateApplicationNotification 18 | object:nil]; 19 | } 20 | 21 | return self; 22 | } 23 | 24 | - (void)dealloc { 25 | [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self]; 26 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 27 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; 28 | [super dealloc]; 29 | } 30 | 31 | - (void)appSwitched:(NSNotification *)notification { 32 | char* name = NULL; 33 | char* bundle_id = NULL; 34 | pid_t pid = 0; 35 | if (notification && notification.userInfo) { 36 | NSRunningApplication* app = [notification.userInfo objectForKey:NSWorkspaceApplicationKey]; 37 | if (app) { 38 | name = (char*)[[app localizedName] UTF8String]; 39 | bundle_id = (char*)[[app bundleIdentifier] UTF8String]; 40 | pid = app.processIdentifier; 41 | } 42 | } 43 | 44 | g_event_tap.front_app_ignored = event_tap_check_blacklist(&g_event_tap, 45 | name, 46 | bundle_id ); 47 | ax_front_app_changed(&g_ax, pid); 48 | } 49 | 50 | @end 51 | --------------------------------------------------------------------------------