├── .gitignore ├── LICENSE ├── README.md ├── convert_file_to_vim_list.py ├── example.png └── plugin ├── tips ├── eastereggs.txt ├── external.txt ├── globals.txt ├── markers.txt ├── medium.txt ├── miscallenous.txt ├── moving.txt ├── othermodes.txt ├── phrases.txt └── selection.txt └── vim-tips.vim /.gitignore: -------------------------------------------------------------------------------- 1 | tmp_config 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Michael B 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vim-Tips 2 | 3 | A simple plugin that display a tip at startup, no configuration required 4 | 5 | ![](example.png) 6 | 7 | ## Installation 8 | 9 | Use your favorite plugin manager; ex `vim-plug`: 10 | 11 | ```vim 12 | Plug 'michaelb/vim-tips' 13 | ``` 14 | 15 | vim-tips should be, vim (incl <8), neovim, linux, macOS and windows compatible 16 | 17 | ## Usage 18 | 19 | vim-tips prints a message in the command area at startup. 20 | 21 | However, you can request tips by calling the function `GetTip()` to get a string value usable in vimscript. Ex: 22 | 23 | ``` 24 | let tip = GetTip() 25 | echo tip 26 | ``` 27 | 28 | Don't forget to load vim-tips beforehand if necessary (you need it at startup) by preceding calls to GetTip() by a 29 | `runtime plugin/vim-tips.vim` 30 | 31 | ## Add tips to vim-startify (courtesy of R0LA1mRifcF8yAkk) 32 | To display a tip (and not a quote) in your vim-startify you can include the following in your config file: 33 | 34 | `let g:startify_custom_header = 'startify#pad([GetTip()])'` 35 | 36 | You'll probably also want to deactivate the basic tip display at startup. 37 | 38 | 39 | ## Important note 40 | 41 | If you are using an autoload session restore (from mksession) it displays a message and therefore hide the vim-tips message. 42 | 43 | 44 | 45 | ## Your own mappings (deprecated for now, didn't work very well anyway) 46 | 47 | vim-tips reads from your vim/neovim config file and displays the lines it recognizes. 48 | 49 | For example; 50 | `nnoremap gd :ALEGoToDefinition` 51 | will display the tip "Config => gd :ALEGoToDefinition (normal mode)". 52 | 53 | If you'd like to display tips more often (and see less mappings from your own config file), you can adjust the tips frequency via 54 | `let g:vim_tips_tips_frequency=0.5` (with a value between 0.0 and 1.0, higher value increase tips frequency) 55 | 56 | ## Hiding the message at startup 57 | 58 | You can specify `let g:vim_tips_display_at_startup=0` (default :`1`) to not have a message displayed at startup. You can then get tips by using the `GetTip()` function 59 | 60 | ##Special thanks 61 | 62 | To @R0LA1mRifcF8yAkk and @Kamilcuk who have opened so many relevant issues, and helped me catch edge cases and suggested improvements. 63 | -------------------------------------------------------------------------------- /convert_file_to_vim_list.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | if len(sys.argv) != 2: 4 | print("This script requires an argument corresponding to the file path to listify") 5 | 6 | filepath = sys.argv[1] 7 | 8 | with open(filepath, 'r') as f: 9 | print("[", end="") 10 | for line in f.readlines(): 11 | print("\"" + line.strip("\n") + "\",", end="") 12 | print("]") 13 | -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelb/vim-tips/6cfa50cb45ceb8a2f4f9087ec12c3950454db90e/example.png -------------------------------------------------------------------------------- /plugin/tips/eastereggs.txt: -------------------------------------------------------------------------------- 1 | :help 42 : Easter Egg 2 | :help holy-grail :Easter Egg 3 | :help! :Easter Egg 4 | :help map-modes :Easter Egg 5 | :help UserGettingBored :Easter Egg 6 | :help showmatches :Easter Egg 7 | :Ni! :Easter Egg 8 | :smile :Easter Egg 9 | -------------------------------------------------------------------------------- /plugin/tips/external.txt: -------------------------------------------------------------------------------- 1 | :%!sort -u : sort contents, keeping unique lines only 2 | !sort : sort lines selected in visual range 3 | !grep word : keep only lines containing in selected range 4 | -------------------------------------------------------------------------------- /plugin/tips/globals.txt: -------------------------------------------------------------------------------- 1 | :g/one\|two/ : list lines containing "one" or "two" 2 | :g/^\s*$/d : delete all blank lines 3 | :g/green/d : delete all lines containing "green" 4 | :v/green/d : delete all lines not containing "green" 5 | :v/./.,/./-1join : compress empty lines 6 | :g/search_pattern/# : display with line numbers 7 | g~iw : switch case of current word 8 | gUiw : make current word uppercase 9 | guiw : make current word lowercase 10 | -------------------------------------------------------------------------------- /plugin/tips/markers.txt: -------------------------------------------------------------------------------- 1 | `. : jump to exact spot in last modification line 2 | : retrace your movements in file (backward) 3 | : retrace your movements in file (forward) 4 | :ju(mps) : list of your movements {{help|jump-motions}} 5 | :history : list of all your command 6 | m{a-z} : marks current position as {a-z}, eg: ma marks as "a" 7 | 'a : move to first character of 'a-marked line 8 | y'a : yank from current position to (incl.) 'a-marked line 9 | -------------------------------------------------------------------------------- /plugin/tips/medium.txt: -------------------------------------------------------------------------------- 1 | ^ w e $ : bigger movements: beginning of line, word, end of word, end of line 2 | c : starts a change command 3 | C : change to end of line (same as c$) 4 | ce : change to end of word (a complete change command) 5 | * # g* g# : find word under cursor (forwards/backwards) 6 | % : match brackets {}[]() 7 | :ls : list of buffers(eg following) 8 | :cd .. : move to parent directory 9 | Vu : lowercase line 10 | VU : uppercase line 11 | ~ : invert case (upper->lower; lower->upper) of current character 12 | gf : open file name under cursor (SUPER) 13 | ga : display hex, ascii value of character under cursor 14 | g8 : display hex value of utf-8 character under cursor 15 | xp : swap next two characters around 16 | CTRL-A,CTRL-X : increment, decrement next number on same line as the cursor 17 | CTRL-R=5*5 : insert 25 into text 18 | = : (re)indent the text on the current line or on the area selected (SUPER) 19 | =% : (re)indent the current braces { ... } 20 | G=gg : auto (re)indent entire document 21 | . : repeat previous command 22 | :& : redo last substitution 23 | @ :repeat last ": command" 24 | :vs : vertical split 25 | :vs filename : open "filename" in new vertical split 26 | :sp : horizontal split 27 | gv : reselect last visual area (super useful) 28 | o : navigate visual area (after visual selection) 29 | CTRL + ] : jump to definition of function under cursor (need tags) 30 | "_d (motion) : delete without destroying default buffer contents ex: "_dd 31 | g :count words/lines in file 32 | :sav new_name : save file as filename 33 | CTRL + w + w .... : cycle splits 34 | ls : show current buffer 35 | b number : open buffer #number in this window 36 | ? : jump to definition tag (call ALEGoToDefinition) 37 | CTRL + T : jump back from definition tag to old position 38 | :r [name] : insert the file [name] below the cursor. 39 | :r !{cmd} : execute {cmd} and insert its standard output below the cursor. 40 | -------------------------------------------------------------------------------- /plugin/tips/miscallenous.txt: -------------------------------------------------------------------------------- 1 | :w! sudo tee % :write as root (ask password) 2 | CTRL + w + = :resize splits equally 3 | [[ : jump to function start 4 | :new file.txt : open file.txt in new split 5 | gt : show next tab 6 | =% : indent code between parenthesis 7 | C-w : (in insert mode) erases word from start to position 8 | C-u : (in insert mode) erases line from start to position 9 | // : run your previous search 10 | C-w-x : exchange with next window 11 | set