Skip to content

Commit 20d9a9b

Browse files
committed
Add Source Original vimrc When Using Neovim as a vim til
1 parent af56ab2 commit 20d9a9b

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
1212

13-
_997 TILs and counting..._
13+
_998 TILs and counting..._
1414

1515
---
1616

@@ -1118,6 +1118,7 @@ _997 TILs and counting..._
11181118
- [Split Different](vim/split-different.md)
11191119
- [Split The Current Window](vim/split-the-current-window.md)
11201120
- [Splitting For New Files](vim/splitting-for-new-files.md)
1121+
- [Source Original vimrc When Using Neovim](vim/source-original-vimrc-when-using-neovim.md)
11211122
- [Swap Occurrences Of Two Words](vim/swap-occurrences-of-two-words.md)
11221123
- [Swapping Split Windows](vim/swapping-split-windows.md)
11231124
- [Tabs To Spaces](vim/tabs-to-spaces.md)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Source Original vimrc When Using Neovim
2+
3+
If you install [Neovim](https://neovim.io/) and open up a new `nvim` session,
4+
you might notice that none of your carefully crafted `~/.vimrc` configuration
5+
is taking effect.
6+
7+
This is because the `~/.vimrc` file is not part of Neovim's default
8+
`runtimepath` (see `:h runtimepath` for details on what is included).
9+
10+
For custom user-land configuration of your Neovim sessions, you should start
11+
with an `init.vim` file. For Mac users, it will likely be placed in
12+
`~/.config/nvim/`. To be sure where it belongs, you can run `:echo
13+
stdpath('config')`.
14+
15+
In that file, you can add any Neovim-specific configuration. You can also take
16+
the opportunity to source your `~/.vimrc` file so that you get all those
17+
configurations. These lines will do the trick.
18+
19+
```vimrc
20+
if filereadable(expand('~/.vimrc'))
21+
source ~/.vimrc
22+
endif
23+
```
24+
25+
Things tend to be backward compatible, so you aren't likely to run into issues
26+
with what's in your `~/.vimrc`. At any rate, it is a good starting point for
27+
getting back to a familiar configuration.
28+
29+
See `:h nvim` for more details about how to transition.

0 commit comments

Comments
 (0)