2

I am looking to alias my vim command to nvim permanently as I use nvim only and it's easier to open files using vim "filename". I agree I am a bit lazy here. But I was wondering if I can map them permanently.

I used alias vim="nvim" but it lasts only for the current session of terminal. When terminal restarts I have to do this again.

phd
  • 69,888
  • 11
  • 97
  • 133
  • 1
    Does this answer your question? [Trying to make a permanent Alias - UNIX](https://stackoverflow.com/questions/28994932/trying-to-make-a-permanent-alias-unix) – phd Jan 26 '21 at 17:40
  • 1
    https://stackoverflow.com/search?q=%5Bbash%5D+permanent+alias – phd Jan 26 '21 at 17:40
  • Thank you, But I use zsh, and since I am new to this I am having trouble how to update my zshrc. Thank you – Mr Null Pointer Jan 26 '21 at 18:01
  • 1
    https://stackoverflow.com/a/56044397/7976758 Found in https://stackoverflow.com/search?q=%5Bzsh%5D+permanent+alias – phd Jan 26 '21 at 18:35
  • 1
    Simply append `alias vim="nvim"` at the end of the file. – phd Jan 26 '21 at 18:36
  • Worked like charm, Thank you so much. :) – Mr Null Pointer Jan 26 '21 at 23:14
  • 1
    You could also move `vim` to `vim_original`, and then create a symlink from `vim` to `nvim`. With this approach, it would work for every shell (bash too), and for every user (if this is OK for you). – user1934428 Jan 28 '21 at 11:59
  • @MrNullPointer Since you solved your problem, how about you close the question? – Marlon Richert Feb 05 '21 at 10:25

2 Answers2

11

In .zshrc use:

alias vim="nvim" - that's the easiest solution. A similar is probably available for bash.

Good article about zsh aliases: https://www.thorsten-hans.com/5-types-of-zsh-aliases

-7

Thank you for the help guys, I changed my .zshrc file and it worked..