Skip to content
forked from katcipis/my.vim

My vimrc configuration, plugins and some other vim useful stuff :-)

License

Notifications You must be signed in to change notification settings

matheusvill/my.vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Introduction

My vimrc configuration, plugins and some other vim useful stuff (mainly taken from Practical Vim: Edit Text at the Speed of Thought).

#Navigation

  • Centralize on cursor: zz
  • Forward word navigation at word start: w
  • Forward word navigation at word end: e
  • Backward word navigation at word start: b
  • Backward word navigation at word end: ge
  • Mark line: m[register]
  • Goto marked line : '[register]
  • Goto file under cursor : gf

Project wide substitution

  • vim -o [files list or regex]
  • set hidden
  • argdo %s,[old-text],[new-text],ge
  • argdo update

It is a good idea to put set hidden on your .vimrc.

Execute Ex command on a pattern

Executing a command only on lines that matches a pattern:

[range]g/[pattern]/[ex command]

Example, deleting all lines (entire file, using %) that contains "vim" on it:

%g/vim/d

Registers

  • Listing registers: :reg
  • Executing command with specified register: "[reg][command]

Examples:

  • Pasting from yank register (0): "0P
  • Yanking to the system clipboard register (+): "+y

Macros

  • Start recording macro : q[register]
  • Stop recording macro : q
  • Execute macro: @[register]
  • Execute macro on parallel: :[range]normal @[register]

Autocomplete

  • Start: [C-n]
  • Accept: [C-y]
  • Exit: [C-e]
  • Omni Complete: [C-x][C-o]

Spell Checker

  • Enable: set spell
  • Disable: set nospell
  • Next: ]s
  • Previous: [s
  • Correct word under cursor: z=
  • Add word to dict: zg
  • Remove word from dict: zw

#Perform action inside a text object

Pattern: [action]i[delimiter]

The delimiter is what defines where the text object start and where it ends.

The idea is that you are performing an action inside (just remember that i means inside) the text object that is enclosed by the delimiter.

Examples:

  • Start change inside braces: ci{
  • Delete the contents of a string: di"
  • Yanking everything inside parentheses: yi(

#Perform action until a char is found

Pattern: [action]t[char]

Examples:

  • Delete everything until a { is found and start editing: ct{
  • Delete everything until a ( is found: dt(
  • Yanking everything until a ) is found: yt)

#Forcing a tab

When tabs are being replaced by spaces it can be hard to force a tab. On INSERT mode just run: [C-v]TAB.

This can be used to force any special character.

#FTPlugin

It is an awesome way to have different ways to configure vim according to the file type.

Check here for more details.

About

My vimrc configuration, plugins and some other vim useful stuff :-)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 94.7%
  • Makefile 5.3%