diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..b3d0cb0 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,14 @@ +vim.o.mouse = "a" +vim.o.selection="exclusive" +vim.o.selectmode="mouse,key" +vim.o.keymodel="startsel,stopsel" + +-- Configs +require("config.lazy") +-- Plugins +require("plugins.colorscheme") +require("plugins.nvim-web-devicons") +require("plugins.nvim-tree") +require("plugins.fzf-lua") +require("plugins.lualine") + diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..87f013d --- /dev/null +++ b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,36 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { } }, + -- automatically check for plugin updates + checker = { enabled = false }, +}) + diff --git a/.config/nvim/lua/plugins/coc.lua b/.config/nvim/lua/plugins/coc.lua new file mode 100644 index 0000000..2cd4e54 --- /dev/null +++ b/.config/nvim/lua/plugins/coc.lua @@ -0,0 +1,4 @@ +return { + "neoclide/coc.nvim", + branch = "release", +} diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..ae8c8f4 --- /dev/null +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,12 @@ +return { + "navarasu/onedark.nvim", + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require('onedark').setup { + style = 'cool' + } + -- Enable theme + require('onedark').load() + end +} + diff --git a/.config/nvim/lua/plugins/fzf-lua.lua b/.config/nvim/lua/plugins/fzf-lua.lua new file mode 100644 index 0000000..5ceadd9 --- /dev/null +++ b/.config/nvim/lua/plugins/fzf-lua.lua @@ -0,0 +1,16 @@ +return { + "ibhagwan/fzf-lua", + -- optional for icon support + dependencies = { "nvim-tree/nvim-web-devicons" }, + -- or if using mini.icons/mini.nvim + -- dependencies = { "echasnovski/mini.icons" }, + opts = {}, + config = function() + require("fzf-lua").setup({ + fzf_bin = "sk", + grep = { + glob_flag = "--glob", + } + }) + end, +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..1a3b484 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,16 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require("lualine").setup({ + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + } + }) + end, +} diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..b1892a0 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,14 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "1.14.0", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + require("nvim-tree").setup {} + end, +} + diff --git a/.config/nvim/lua/plugins/nvim-web-devicons.lua b/.config/nvim/lua/plugins/nvim-web-devicons.lua new file mode 100644 index 0000000..5461475 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-web-devicons.lua @@ -0,0 +1,5 @@ +return { + "nvim-tree/nvim-web-devicons", + opts = {} +} + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..275115e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.config/nvim/lazy-lock.json + diff --git a/README.md b/README.md index e69de29..82c41f8 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,29 @@ +# My personal Neovim configs +I usually don't make my configs public, but I'm making an exception for this one just for convenience and portability. Feel free to fork this or do whatever. + +## Requirements +- `fzf` + - Required by `fzf-lua`. It can be installed with your OS' package manager. If the `fzf` version is too old or you can't install it for some reason, you can try `skim`, which can be installed with `cargo install skim`. Type `sk` in your terminal to make sure it is installed. +- `ripgrep` + - Also required by `fzf-lua`. Although it is technically optional. Just like `fzf`, it can either be installed with the package manager of your choice or with `cargo install ripgrep`. +- Nerd Fonts + - Required by `nvim-web-devicons`. You can download them from nerdfonts.com. Place them in the `~/.fonts` folder, run `fc-cache -fv`, and configure your terminal emulator to use the font that you downloaded. I personally picked "NotoSansM NerdFontMono". +- Node.js + - required by CoC. You can install it with this command: `curl -sL install-node.vercel.app/lts | bash`. +- `rust-analyzer` + - Very optional but I do a lot of coding in Rust. You can install `rust-analyzer` with `rustup component add rust-analyzer`. Make sure to also run `:CocInstall coc-rust-analyzer` from Neovim. + + + +## Usage +Run `./sync-config.sh` to copy the current configs to this repo. Eventually I will have another `./install.sh` script to do everything automatically. + + +## FAQ +(although nobody has actually asked anything yet but whatever) + +- Q: Lmao why didn't just use a tool to manage dotfiles + A: I wanted to have an individual repo just for neovim stuff, along with a shell script to set everything up. I may create another repo some day with other dotfiles for the rest of my system though. + + + diff --git a/sync-config.sh b/sync-config.sh new file mode 100644 index 0000000..e69de29