{"id":21722420,"url":"https://github.com/timstott/practical-vim","last_synced_at":"2025-03-20T21:57:31.773Z","repository":{"id":26001946,"uuid":"29444448","full_name":"timstott/practical-vim","owner":"timstott","description":null,"archived":false,"fork":false,"pushed_at":"2015-03-23T09:16:05.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T19:07:10.090Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timstott.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-18T23:01:04.000Z","updated_at":"2015-01-18T23:01:04.000Z","dependencies_parsed_at":"2022-07-25T15:22:01.446Z","dependency_job_id":null,"html_url":"https://github.com/timstott/practical-vim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timstott%2Fpractical-vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timstott%2Fpractical-vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timstott%2Fpractical-vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timstott%2Fpractical-vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timstott","download_url":"https://codeload.github.com/timstott/practical-vim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244695610,"owners_count":20494846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T02:28:49.729Z","updated_at":"2025-03-20T21:57:31.754Z","avatar_url":"https://github.com/timstott.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Practical Vim - Tips and Exercises\n\n## Tip 35 - Run commands in shell\n\nSend buffer content to stdin and use stdout to populate our buffer.\n\n:[range] ! sh\n\n## Tip 34 - Recall commands from history\n\nUse `\u003cC-p\u003e` or `\u003cC-n\u003e` instead of arrow keys (also works in terminal).\n\nHistorical Ex commands command line window  `q:`.\nHistorical search command line window  `q/`.\nUse `C-f` while in command line to enter command line window (both Ex and search)\n\n## Tip 33 - Insert the current word at the command prompt\n\n`:%s/\u003cC-r\u003e\u003cC-w\u003e/something/g`\n\n## Tip 30 - Run normal mode commands across range\n\nDo command on line (e.g. `A;`) and the repeat on visual selection or range\n`:'\u003c,'\u003enormal .`\n\nOr in a single command\n`:%normal A;`\n\nWith macros\n`:%normal @a;`\n\nvar foo = 1\nvar ok = true\nvar hello = 'world'\nvar foobar = 'barbaz'\n\n\n## Tip 29 - Duplicate and move lines using `:t` and `:m` commands\n\nCopy the end of the document to below current cursor\n:$copy.\n:$t.\n\nCopy current line to below line 6\n:t6\n\nMove the end of document to below current cursor\n:$m.\n\n## Tip X\n\nExit inset and visual mode with \u003cC-c\u003e\n\n## Tip 28 - Execute a command on one more consecutive lines\n\nLine numbers as address\n:2,6p\nEcho lines 2 to 6\n\n:{start},{end}\n\nSymbols\n\n       | description\n-------|------------\nnumber | line number\n.      | current line (where the cursor is placed)\n$      | end of file\n%      | all lines in current file\n\nOffset from current line\n:.,.+3p\nEcho current line + 3 lines\n\n## Tip 26 - Append afer a ragged visual block\n\nvar hello = 'world';\nvar ok = true;\nvar foo = 1;\n\n## Tip 21 - Visual modes\n\nIn visual mode you can switch between visual modes the same way as normal mode.\n\n      | description\n------|------------\nv     | visual char\nV     | visual line\n\u003cC-v\u003e | visual block\n\n## Tip 15 - Past from a register without leaving normal mode\n\nIn insert mode, paste content from register\n\nregisters | description\n----------|-----------------\n +        | system clipboard\n \"        | text of last deleted or yanked line\n\nkeys            | description\n----------------|-----------------------\n\u003cC-r\u003e{register} | paste content from register\n\u003cC-r\u003e\u003cC-p\u003e{register} | paste from register and fix indent\n\n## Tip 13 - Move in insert mode\n\n        | description\n--------|--------------------------\n`\u003cC-h\u003e` | Delete back one character\n`\u003cC-w\u003e` | Delete back one word\n`\u003cC-u\u003e` | Delete back to start of line\n\n`\u003cC-o\u003e` Switch to Insert Normal mode\n\n## Tip 11 - Combine and conquer\n\nSample of operator commands\n\n   |\n---|---------------\nc  | change\ng~ | swap case\ngu | make lowercase\ngU | make uppercase\n\nhello HELLO HeLlO\n\nWhen operator command is invoked twice it acts on the current line (e.g. cc)\n\nText objects from plugin:\n\n---|-----------\nae | entire file\n\n=ae autoindent entire file\ngUae make entire file uppercase\n\n## Tip 10 - Simple math\n\n\u003cC-a\u003e perform addition (enter twice because tmux prefix)\n\u003cC-x\u003e perform substraction\n\n100\n\nAdd/Substract count with 10\u003cC-a\u003e\n\n110\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimstott%2Fpractical-vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimstott%2Fpractical-vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimstott%2Fpractical-vim/lists"}