Heavily based on kickstart.nvim and AstroNvim, this Neovim "distribution" (its just a configuration but shh) has been created with the aim of being a solid, modular, intuitive and enjoyable way to use vim/neovim. Including a built-in norminette and stdheader, it is an amazing code editor for 42 students!
42-Nvim was created with expandability in mind. In order to install, forking this repository is recommended. This way, you can edit your config, change your setup, etc and still be able to sync it to Github! Also, if there are any changes from upstream (here), you will be able to update without breaking your configuration. If you also end up adding plugins that could benefit the community, simply make a pull/merge request and it will be reviewed. If a general use-case is warranted, your config will be merged and moved into the built-in section. More on that later.
Once you forked this repo, simply execute the following (make sure to change <your_name_here>
to your github login!):
mv ~/.config/nvim ~/.config/nvim.bak
git clone git@github.com:<your_name_here>/42-nvim.git ~/.config/nvim
vim ~/.config/nvim/lua/config/42/init.lua
This will also launch vim
one last time to edit your user42
and mail42
as well as allow you to turn on the built-in norminette
, if you want that.
Once that is done, you can simply start nvim
! Lazy will then download and install a bunch of packages, so make sure you let it install everything before closing.
You should also install a few dependencies for extra functionality:
gcc
, git
, make
, unzip
which should be pre-installed, but it's better to double-check.$PATH
.:Mason
will bring out the LSP installer, with which you can install software such as clang-format
. clangd
will be installed and configured automatically.
It is recommended to run the following:
chmod a+x ~/.config/nvim/.clangdflags.sh
bash ~/.config/nvim/.clangdflags.sh
This will tell clangd
to use the -Wall -Werror -Wextra
flags when running.
You should also take a tour in the config folder! just to see whats going on, figure out a couple keybinds maybe. I left notes and comnents everywhere, explaining which plugin does what (and left a bunch of comments that were imported from Kickstart.nvim. Again, huge kudos to them).
As said, 42-Nvim was made to be extended. Therefore, a custom
subfolder exists in both the config
and the plugins
folders, with examples. Both plugins/custom
and config/custom
won't ever be changed or modified upstream - this will be where you import and configure your plugins. There are examples that are there, so feel free to explore and import whatever you'd like!
As a reminder, if you feel like a plugin/configuration could benefit more people, you can create a pull/merge request. I will review it, and if it does improve the "distro" in any way, I'll merge it and move it to the built-ins folder.
For theming, a _themeselect.lua
file is waiting for you in the config/custom
subfolder where you can choose which theme to use. If you want to install your own, you can always drop a .lua
file in plugins/themes
, as if it were an extra plugin. Once in Neovim, press Space-T to open up a theme selector!
Here's a little peek at the folder structure:
~/.config/nvim
┌───────────┘
├─ init.lua -- init file.
├─ .clangdflags.sh -- run this :)
└─ lua
├─ lazy_load.lua -- This calls the plugin manager. Delete the 42 line if you aren't from 42 (somehow).
├─ config
│ ├─ vim_settings.lua -- Here, you can configure your general vim settings.
│ ├─ 42 -- The init.lua file in this folder stores the user42, mail42 and norminette settings. Change them to suit your preferences.
│ ├─ builtin -- The config files for built-in plugins. Don't touch anything here as they may change! Or deal with the git conflicts :)
│ ├─ custom <<-- Here's the folder where you will load your configuration! The init.lua file and _themeselect.lua will have examples.
│ └─ init.lua -- Don't touch this, it's used to load all the config.
└─ plugins
├─ 42 -- The init.lua file in this folder loads the 42Stdheader (Lausanne, by default. Change this if you are not from Lausanne!)
├─ builtin -- This folder contains all the built-in plugins that make 42-Nvim what it is. Don't touch as it might get modified.
├─ custom <<-- This is where you want to add your lua files to add custom plugins. An example file lives there.
└─ themes -- This folder contains all the current themes. You may add your own or delete those you don't use.
Press space, then s
and h
to bring out a help menu.
When opening Neovim without any arguments, press u
to launch Lazy and update all of your plugins. f
will launch Telescope to search a file in the current directory. p
will push your current Neovim config to your git clone and P
will pull it instead. Relaunch after pulling your config!
While in normal mode, pressing leader keys and doing nothing afterwards will show you which possible keybinds can be achieved. This is done thanks to which-key.
Again, feel free to mess around and explore the config files. You may (will) learn a thing or two!
As I said, this would not have been possible without these two goats:
In addition, I'd like to link back to every built-in plugin that made this "distribution" possible. This should make it easier to navigate and see which plugins are installed, as well as making their documentation a little bit faster to access. And of course to credit them for their amazing work :)
(if i missed one im sorry)
You can contact me on Discord by sending a friend request to broller
if you need help with anything, although I'd prefer if you could open an issue if applicable!
Enjoy 42-Nvim! :)