diff --git a/README.md b/README.md index df58eac..d580062 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_775 TILs and counting..._ +_776 TILs and counting..._ --- @@ -784,6 +784,7 @@ _775 TILs and counting..._ - [Difference Between :wq and :x](vim/difference-between-wq-and-x.md) - [Display Word Count Stats](vim/display-word-count-stats.md) - [Edges Of The Selection](vim/edges-of-the-selection.md) +- [Edit A File At A Specific Line Number](vim/edit-a-file-at-a-specific-line-number.md) - [End Of The Word](vim/end-of-the-word.md) - [Escaping Terminal-Mode In An Nvim Terminal](vim/escaping-terminal-mode-in-an-nvim-terminal.md) - [Filter Lines Through An External Program](vim/filter-lines-through-an-external-program.md) diff --git a/vim/edit-a-file-at-a-specific-line-number.md b/vim/edit-a-file-at-a-specific-line-number.md new file mode 100644 index 0000000..0cd701c --- /dev/null +++ b/vim/edit-a-file-at-a-specific-line-number.md @@ -0,0 +1,17 @@ +# Edit A File At A Specific Line Number + +I use long-running Vim sessions where I constantly open files as new buffers +with the `:edit` (or `:e`) command. Generally, when I open a new file I +end up with the cursor at the top of the buffer and go from there. But what +if I have a specific line number in mind and I want the cursor to start +there? + +The `:edit` command can receive arguments, including a line number argument. To +open up to line 159, I can include the `+159` argument in the command. + +``` +:edit +159 path/to/the/file.txt +``` + +See `:h :edit` and `:h +cmd` for more details about how `:edit` works and +what the different arguments can do.