diff --git a/content/technical/2015/09/vim-open-file-at-colon-line-number.md b/content/technical/2015/09/vim-open-file-at-colon-line-number.md new file mode 100644 index 0000000..21de9ac --- /dev/null +++ b/content/technical/2015/09/vim-open-file-at-colon-line-number.md @@ -0,0 +1,19 @@ +I regularly encounter paths that have line numbers attached such as, +`./spec/features/cases/edit_spec.rb:112`, or `src/fetcher.rs:543`, and want to +view or edit the file at the given line. For far too long I've been opening the +file in `vim` and then jumping to the relevant line. This week I wrote a shell +(`zsh`) function that does this automatically. It is simply called `v` and is +used in place of `vim` to edit a file. E.g. + +
+ Animated GIF of v function in action +
Demo
+
+ +## Source + +The source of the function is below. It was written for `zsh` but should be +easy to adapt for other shells. + + + diff --git a/content/technical/2015/09/vim-open-file-at-colon-line-number.yaml b/content/technical/2015/09/vim-open-file-at-colon-line-number.yaml new file mode 100644 index 0000000..517b1ae --- /dev/null +++ b/content/technical/2015/09/vim-open-file-at-colon-line-number.yaml @@ -0,0 +1,13 @@ +--- +title: Open Paths With Line Numbers in Vim +extra: A shell function to open path/to/file.txt123 style paths at the specified line + in vim. +kind: article +section: technical +created_at: 2015-09-20 12:58:00.000000000 +10:00 +keywords: +- vim +- shell +- zsh +- productivity +short_url: http://j.mp/1YpZeKP diff --git a/output/images/2015/vDemo.gif b/output/images/2015/vDemo.gif new file mode 100644 index 0000000..0fd25d3 Binary files /dev/null and b/output/images/2015/vDemo.gif differ