Merge commits till d9dba624a9502b0b172523dad30dc080e4170811 from dev to master

This commit is contained in:
Arkaprabha Chakraborty
2024-03-27 23:52:39 +05:30
parent 63d4076533
commit 8b4bacceb6
25 changed files with 461 additions and 659 deletions

View File

@@ -1,50 +1,20 @@
![neolite.png](blob/neolite.png)
# Updates
- A minimal configuration has been pushed to the [minimal](https://github.com/arkorty/neolite/tree/minimal) branch.
# About
Neolite is a fast and lightweight configuration of Neovim. For the uninitiated, Neovim is a terminal based text editor which can be extended using the [Lua](https://www.lua.org/about.html) scripting language. Neovim out-of-the-box doesn't come with a lot of features, but it is highly extensible. It comes with native LSP support (lets your IDE do all that auto-completion magic). Vim has been in use since forever, so you don't have to worry about the project going stale anytime soon.
You also have the added benefit of becoming a true Vim chad once you start using Neovim instead of that pathetic web browser (ahem.. VS Code) disguised as an IDE.
You also have the added benefit of becoming a true Vim chad once you start using Neovim instead of some web browser (ahem.. VS Code) disguised as an IDE.
# Dependencies
- [cURL](https://github.com/curl/curl)
- [Git](https://github.com/git/git)
- [Neovim](https://github.com/neovim/neovim)
- [Make](https://www.gnu.org/software/make)
# Optional Dependencies
- [npm](https://github.com/npm/cli)
- [Lazygit](https://github.com/jesseduffield/lazygit)
# Quick Start
Once you have all the dependencies sorted, run the command below and we'll take care of the rest.
```
curl -sLf https://raw.githubusercontent.com/arkorty/neolite/master/install.sh | bash
```
# Screenshots
### File Tree & Active Buffer
![file-tree.png](blob/file-tree.png)
### Fuzzy Finder
![fuzzy-finder.png](blob/fuzzy-finder.png)
### Terminal & Lazygit
![lazygit.png](blob/lazygit.png)
### Live Grep
![live-grep.png](blob/live-grep.png)
# License

View File

@@ -1,16 +1,12 @@
require("plugins")
require("options")
require("keybinds")
require("statusline")
require("completions")
require("colorschemes")
require("file-tree")
require("terminal")
require("buffer-tabs")
require("fuzzy-finder")
require("syntax-highlight")
require("lsp-config")
require("lsp-format")
require("transparency")
require("visible-indents")
require("git-integration")
require("mappings")
require("setup.lualine")
require("setup.cmp")
require("setup.telescope")
require("setup.treesitter")
require("setup.nvim-lspconfig")
require("setup.null-ls")
require("setup.gitsigns")
require("setup.colorscheme")
require("setup.gui")

View File

@@ -1,36 +0,0 @@
# Project: Neolite
# Script: install.sh
# License: MIT
# Author: Arkaprabha Chakraborty
# Edited: 11-03-23
#
# Copyright (C) 2023 Arkaprabha Chakraborty
#!/bin/bash
if command -v nvim >/dev/null 2>&1 ; then
:
else
echo "No installation of Neovim was found"
echo "Quitting now..."
exit 127
fi
NPMDP=""
if command -v npm >/dev/null 2>&1 ; then
NPMDP="pyright prettier"
else
echo "No installation of npm was found"
echo "Some lsp packages will not be installed automatically"
fi
[ -d "$HOME/.local/share/nvim/site/pack/packer" ] && rm -rf $HOME/.local/share/nvim/site/pack/packer
git clone --depth 1 https://github.com/wbthomason/packer.nvim $HOME/.local/share/nvim/site/pack/packer/start/packer.nvim
[ -d "$HOME/.config/nvim" ] && mv $HOME/.config/nvim $HOME/.config/nvim-$(date "+%F-%T").bak
mkdir -p $HOME/.config/nvim && git clone --depth 1 https://github.com/arkorty/neolite.git $HOME/.config/nvim
nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync"
nvim +TSUpdate "+MasonInstall stylua rustfmt black clang-format $NPMDP"

32
lazy-lock.json Normal file
View File

@@ -0,0 +1,32 @@
{
"LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
"bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"copilot.vim": { "branch": "release", "commit": "9484e35cf222e9360e05450622a884f95c662c4c" },
"dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
"gitsigns.nvim": { "branch": "main", "commit": "078041e9d060a386b0c9d3a8c7a7b019a35d3fb0" },
"gruvbox.nvim": { "branch": "main", "commit": "6e4027ae957cddf7b193adfaec4a8f9e03b4555f" },
"kanagawa.nvim": { "branch": "master", "commit": "bfa818c7bf6259152f1d89cf9fbfba3554c93695" },
"lazy.nvim": { "branch": "main", "commit": "e888d5b64c34bc41f7ef2e8850a5e67e4b3e2731" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"melange-nvim": { "branch": "master", "commit": "ec15b091304580f1d37e711c3a54bc828b09e255" },
"nightfox.nvim": { "branch": "main", "commit": "e352a32e0f54feb2550ebdab815ae8f7f26ed63b" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-cmp": { "branch": "main", "commit": "97dc716fc914c46577a4f254035ebef1aa72558a" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-lspconfig": { "branch": "master", "commit": "6e5c78ebc9936ca74add66bda22c566f951b6ee5" },
"nvim-treesitter": { "branch": "master", "commit": "07a404570f3d912afdfe92bbf74ff55886293369" },
"nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" },
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" }
}

View File

@@ -1,13 +0,0 @@
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
local ok, bufferline = pcall(require, "bufferline")
if not ok then
return
end
bufferline.setup({
options = {
mode = "tabs", -- set to "buffers" to only show buffers instead
},
})

View File

@@ -1,210 +0,0 @@
local colorscheme = "catppuccin" -- Set colorscheme { gruvbox, onedark, catppuccin, nord, dracula, alduin }
if colorscheme == "onedark" then
-- Onedark Default Configuration
local ok, onedark = pcall(require, "onedark")
if not ok then
return
end
onedark.setup({
-- Main options --
style = "darker", -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light'
transparent = false, -- Show/hide background
term_colors = true, -- Change terminal color as per the selected theme style
ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden
cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu
-- toggle theme style ---
toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example '<leader>ts'
toggle_style_list = { "dark", "darker", "cool", "deep", "warm", "warmer", "light" }, -- List of styles to toggle between
-- Change code style ---
-- Options are italic, bold, underline, none
-- You can configure multiple style with comma seperated, For e.g., keywords = 'italic,bold'
code_style = {
comments = "italic",
keywords = "none",
functions = "none",
strings = "none",
variables = "none",
},
-- Lualine options --
lualine = {
transparent = false, -- lualine center bar transparency
},
-- Custom Highlights --
colors = {}, -- Override default colors
highlights = {}, -- Override highlight groups
-- Plugins Config --
diagnostics = {
darker = true, -- darker colors for diagnostic
undercurl = true, -- use undercurl instead of underline for diagnostics
background = true, -- use background color for virtual text
},
})
-- Load One Dark
onedark.load()
end
if colorscheme == "catppuccin" then
-- Catppuccin
local ok, catppuccin = pcall(require, "catppuccin")
if not ok then
return
end
catppuccin.setup({
flavour = "macchiato", -- latte, frappe, macchiato, mocha
background = {
-- :h background
light = "latte",
dark = "mocha",
},
transparent_background = false,
show_end_of_buffer = false, -- show the '~' characters after the end of buffers
term_colors = false,
dim_inactive = {
enabled = false,
shade = "dark",
percentage = 0.15,
},
no_italic = false, -- Force no italic
no_bold = false, -- Force no bold
styles = {
comments = { "italic" },
conditionals = { "italic" },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
color_overrides = {},
custom_highlights = {},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
telescope = true,
notify = false,
mini = false,
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
},
})
-- Load Catppuccin
vim.cmd.colorscheme("catppuccin")
end
if colorscheme == "gruvbox" then
-- setup must be called before loading the colorscheme
-- Default options:
local ok, gruvbox = pcall(require, "gruvbox")
if not ok then
return
end
gruvbox.setup({
undercurl = true,
underline = true,
bold = true,
italic = {
strings = true,
comments = true,
operators = false,
folds = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {},
dim_inactive = false,
transparent_mode = false,
})
-- Load Gruvbox
vim.o.background = "dark" -- or "light" for light mode
vim.cmd([[colorscheme gruvbox]])
end
if colorscheme == "nord" then
local ok = pcall(require, "nord")
if not ok then
return
end
vim.cmd([[colorscheme nord]])
end
if colorscheme == "everforest" then
local ok = pcall(require, "nord")
if not ok then
return
end
vim.cmd([[colorscheme everforest]])
end
if colorscheme == "alduin" then
vim.cmd([[colorscheme alduin]])
end
if colorscheme == "dracula" then
local ok, dracula = pcall(require, "dracula")
if not ok then
return
end
dracula.setup({
-- customize dracula color palette
colors = {
bg = "#282A36",
fg = "#F8F8F2",
selection = "#44475A",
comment = "#6272A4",
red = "#FF5555",
orange = "#FFB86C",
yellow = "#F1FA8C",
green = "#50fa7b",
purple = "#BD93F9",
cyan = "#8BE9FD",
pink = "#FF79C6",
bright_red = "#FF6E6E",
bright_green = "#69FF94",
bright_yellow = "#FFFFA5",
bright_blue = "#D6ACFF",
bright_magenta = "#FF92DF",
bright_cyan = "#A4FFFF",
bright_white = "#FFFFFF",
menu = "#21222C",
visual = "#3E4452",
gutter_fg = "#4B5263",
nontext = "#3B4048",
},
-- show the '~' characters after the end of buffers
show_end_of_buffer = true, -- default false
-- use transparent background
transparent_bg = true, -- default false
-- set custom lualine background color
lualine_bg_color = "#44475a", -- default nil
-- set italic comment
italic_comment = true, -- default false
-- overrides the default highlights see `:h synIDattr`
overrides = {
-- Examples
-- NonText = { fg = dracula.colors().white }, -- set NonText fg to white
-- NvimTreeIndentMarker = { link = "NonText" }, -- link to NonText highlight
-- Nothing = {} -- clear highlight of Nothing
},
})
vim.cmd([[colorscheme dracula]])
end

View File

@@ -1,62 +0,0 @@
local ok, cmp = pcall(require, "cmp")
if not ok then
return
end
local luasnip_ok, luasnip = pcall(require, "luasnip")
if not luasnip_ok then
return
end
local luasnip_vscode_ok, luasnip_vscode = pcall(require, "luasnip/loaders/from_vscode")
if not luasnip_vscode_ok then
return
end
luasnip_vscode.lazy_load()
cmp.setup({
view = {
--entries = { name = "custom", selection_order = "near_cursor" },
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
["<C-k>"] = cmp.mapping.scroll_docs(-4),
["<C-j>"] = cmp.mapping.scroll_docs(4),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item(),
["<CR>"] = cmp.mapping.confirm(),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
experimental = {
ghost_text = false,
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local lk_ok, lspkind = pcall(require, "lspkind")
if not lk_ok then
return
end
local kind = lspkind.cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. (strings[1] or "") .. " "
kind.menu = " (" .. (strings[2] or "") .. ")"
return kind
end,
},
})

View File

@@ -1,73 +0,0 @@
-- disable netrw
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
local ok, nvim_tree = pcall(require, "nvim-tree")
if not ok then
return
end
-- file tree options
nvim_tree.setup({
sort_by = "case_sensitive",
update_cwd = true,
renderer = {
group_empty = true,
root_folder_label = ":t",
indent_width = 2,
},
filters = {
dotfiles = false,
git_clean = false,
no_buffer = false,
exclude = {},
},
actions = {
open_file = {
resize_window = true,
},
},
update_focused_file = {
enable = true,
update_cwd = false,
ignore_list = {},
},
git = {
enable = true,
ignore = false,
show_on_dirs = true,
show_on_open_dirs = true,
timeout = 200,
},
})
-- open file tree at startup
local function open_nvim_tree(data)
-- buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1
if not directory then
return
end
-- create a new, empty buffer
vim.cmd.enew()
-- wipe the directory buffer
vim.cmd.bw(data.buf)
-- change to the directory
vim.cmd.cd(data.file)
-- open the tree
local api_ok, api = pcall(require, "nvim-tree.api")
if not api_ok then
return
end
api.tree.open()
end
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })

View File

@@ -1,49 +0,0 @@
local opts = { noremap = true, silent = true }
--Local term_opts = { silent = true }
local bind = vim.api.nvim_set_keymap
local set = vim.keymap.set
-- Bind a leader key
bind("", ";", "<Nop>", opts) -- undo any previous bind
vim.g.mapleader = ";"
vim.g.maplocalleader = ";"
-- Modes
-- Normal Mode = 'n',
-- Insert Mode = 'i',
-- Visual Mode = 'v',
-- Visual Block Mode = 'x',
-- Terminal Mode = 't',
-- Command Mode = 'c',
-- Normal mode --
-- Nvim tree
bind("n", "<C-f>", ":NvimTreeToggle<CR>", opts)
-- Fuzzy finder
local telescope_status_ok, telescope = pcall(require, "telescope.builtin")
if telescope_status_ok then
set("n", "<Leader>ff", telescope.find_files, {})
set("n", "<Leader>fg", telescope.live_grep, {})
set("n", "<Leader>fb", telescope.buffers, {})
set("n", "<Leader>fh", telescope.help_tags, {})
end
-- Better tabs
bind("n", "<S-t>", ":tabnew<CR>", opts)
bind("n", "<S-c>", ":tabclose<CR>", opts)
bind("n", "<S-n>", ":tabprev<CR>", opts)
bind("n", "<S-m>", ":tabnext<CR>", opts)
-- Better window navigation
bind("n", "<C-Left>", "<C-w>h", opts)
bind("n", "<C-Down>", "<C-w>j", opts)
bind("n", "<C-Up>", "<C-w>k", opts)
bind("n", "<C-Right>", "<C-w>l", opts)
-- Resize with arrows
bind("n", "<C-k>", ":resize -2<CR>", opts)
bind("n", "<C-j>", ":resize +2<CR>", opts)
bind("n", "<C-l>", ":vertical resize -2<CR>", opts)
bind("n", "<C-h>", ":vertical resize +2<CR>", opts)

View File

@@ -1,33 +0,0 @@
local ok, null_ls = pcall(require, "null-ls")
if not ok then
return
end
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
require("null-ls").setup({
sources = {
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.clang_format,
},
-- you can reuse a shared lspconfig on_attach callback here
--on_attach = function(client, bufnr)
-- if client.supports_method("textDocument/formatting") then
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
-- vim.api.nvim_create_autocmd("BufWritePre", {
-- group = augroup,
-- buffer = bufnr,
-- callback = function()
-- vim.lsp.buf.format({
-- bufnr = bufnr,
-- filter = function()
-- return client.name == "null-ls"
-- end,
-- })
-- end,
-- })
-- end
--end,
})

59
lua/mappings.lua Normal file
View File

@@ -0,0 +1,59 @@
local opts = { noremap = true, silent = true }
--Local term_opts = { silent = true }
local keymap = vim.keymap.set
-- Bind a leader key
keymap("", "<Space>", "<Nop>", opts) -- release previously binded key
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Modes
-- Normal Mode = 'n',
-- Insert Mode = 'i',
-- Visual Mode = 'v',
-- Visual Block Mode = 'x',
-- Terminal Mode = 't',
-- Command Mode = 'c',
-- Resize with arrow-keys
keymap("n", "<C-Up>", ":resize -2<CR>", opts)
keymap("n", "<C-Down>", ":resize +2<CR>", opts)
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
-- Telescope fuzzy finder
local telescope_status_ok, telescope = pcall(require, "telescope.builtin")
if telescope_status_ok then
keymap("n", "<Leader>ff", telescope.find_files, {})
keymap("n", "<Leader>ll", telescope.live_grep, {})
keymap("n", "<Leader>bb", telescope.buffers, {})
keymap("n", "<Leader>tt", telescope.treesitter, {})
end
-- Lsp controls
keymap("n", "<Leader>ls", ":LspStart<CR>", opts)
keymap("n", "<Leader>lS", ":LspStop<CR>", opts)
keymap("n", "<Leader>lr", ":LspRestart<CR>", opts)
keymap("n", "<Leader>li", ":LspInfo<CR>", opts)
-- Buffer controls
keymap("n", "<Leader>BB", ":bdelete<CR>", opts)
keymap("n", "<Leader>jj", ":bprevious<CR>", opts)
keymap("n", "<Leader>kk", ":bnext<CR>", opts)
keymap("n", "P", '"+p', opts)
keymap("v", "Y", '"+y', opts)
-- Toggleterm controls
function _G.set_terminal_keymaps()
local topts = { buffer = 0 }
keymap("t", "<esc>", [[<C-\><C-n>]], topts)
keymap("t", "<C-h>", [[<Cmd>wincmd h<CR>]], topts)
keymap("t", "<C-j>", [[<Cmd>wincmd j<CR>]], topts)
keymap("t", "<C-k>", [[<Cmd>wincmd k<CR>]], topts)
keymap("t", "<C-l>", [[<Cmd>wincmd l<CR>]], topts)
keymap("t", "<C-w>", [[<C-\><C-n><C-w>]], topts)
end
vim.cmd("autocmd! TermOpen term://*toggleterm#* lua set_terminal_keymaps()")

View File

@@ -1,78 +1,81 @@
local ok, packer = pcall(require, "packer")
if not ok then
return
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
packer.startup(function(use)
-- Visible indentation
use("lukas-reineke/indent-blankline.nvim")
use("AlessandroYorba/Alduin")
local plugins = {
{ "stevearc/dressing.nvim", event = "VeryLazy" },
{ "ellisonleao/gruvbox.nvim", priority = 1000, config = true },
{ "EdenEast/nightfox.nvim" },
{ "rebelot/kanagawa.nvim" },
{ "savq/melange-nvim" },
{
"akinsho/bufferline.nvim",
version = "*",
dependencies = "nvim-tree/nvim-web-devicons",
config = true,
},
{ "lewis6991/gitsigns.nvim" },
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
{ "neovim/nvim-lspconfig" },
{ "jose-elias-alvarez/null-ls.nvim" },
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "saadparwaiz1/cmp_luasnip" },
{ "onsails/lspkind.nvim" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "nvim-treesitter/nvim-treesitter" },
{ "simrat39/rust-tools.nvim" },
{ "nvim-lualine/lualine.nvim" },
{ "norcalli/nvim-colorizer.lua" },
{ "github/copilot.vim" },
{
"nvim-telescope/telescope.nvim",
--tag = "0.1.2",
branch = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } },
},
--{
-- "nvim-neo-tree/neo-tree.nvim",
-- branch = "v3.x",
-- dependencies = {
-- "nvim-lua/plenary.nvim",
-- "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
-- "MunifTanjim/nui.nvim",
-- -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
-- },
--},
{
{
"akinsho/toggleterm.nvim",
version = "*",
opts = {
open_mapping = [[<C-\>]],
hide_numbers = true,
start_in_insert = true,
direction = "tab",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
},
},
},
},
}
-- Git integration
use("lewis6991/gitsigns.nvim")
local opts = {}
-- Transparency enabler
use("xiyaowong/transparent.nvim")
-- Nord colorscheme
use("shaunsingh/nord.nvim")
-- Dracula colorscheme
use("Mofiqul/dracula.nvim")
-- Onedark colorscheme
use("navarasu/onedark.nvim")
-- Gruvbox colorscheme
use("ellisonleao/gruvbox.nvim")
--Everforest colorscheme
use("sainnhe/everforest")
-- Catppuccin colorscheme
use({ "catppuccin/nvim", as = "catppuccin" })
-- Plugin manager
use("wbthomason/packer.nvim")
-- Terminal
use({ "akinsho/toggleterm.nvim", tag = "*" })
-- File tree
use({ "nvim-tree/nvim-tree.lua", requires = { "nvim-tree/nvim-web-devicons" }, tag = "nightly" })
-- Statusline
use({ "nvim-lualine/lualine.nvim", requires = { "kyazdani42/nvim-web-devicons", opt = true } })
-- Buffer tabs
use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" })
use({ "nvim-telescope/telescope.nvim", tag = "0.1.x", requires = { { "nvim-lua/plenary.nvim" } } })
-- LSP manager
use("williamboman/mason.nvim")
use("williamboman/mason-lspconfig.nvim")
use("neovim/nvim-lspconfig")
-- Formatting
use("jose-elias-alvarez/null-ls.nvim")
-- Snippets
use("L3MON4D3/LuaSnip") --snippet engine
use("rafamadriz/friendly-snippets") -- a bunch of snippets to use
-- Completions
use("hrsh7th/nvim-cmp") -- The completion plugin
use("hrsh7th/cmp-buffer") -- buffer completions
use("hrsh7th/cmp-path") -- path completions
use("saadparwaiz1/cmp_luasnip") -- snippet completions
use("onsails/lspkind.nvim")
use("hrsh7th/cmp-nvim-lsp")
-- Syntax highlighting
use("nvim-treesitter/nvim-treesitter")
-- Rust tools
use("simrat39/rust-tools.nvim")
end)
require("lazy").setup(plugins, opts)

126
lua/setup/cmp.lua Normal file
View File

@@ -0,0 +1,126 @@
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then
return
end
require("luasnip/loaders/from_vscode").lazy_load()
local check_backspace = function()
local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
end
local kind_icons = {
Text = "󰉿",
Method = "󰆧",
Function = "󰊕",
Constructor = "",
Field = "",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈙",
Reference = "",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "",
Event = "",
Operator = "󰆕",
TypeParameter = "",
Misc = "",
}
-- find more here: https://www.nerdfonts.com/cheat-sheet
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
-- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
fallback()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {
"i",
"s",
}),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
-- Kind icons
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
vim_item.menu = ({
nvim_lsp = "[LSP]",
luasnip = "[Snippet]",
buffer = "[Buffer]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
experimental = {
ghost_text = false,
native_menu = false,
},
})

View File

@@ -0,0 +1,7 @@
local ok, nightfox = pcall(require, "nightfox")
if not ok then
return
end
-- setup must be called before loading
vim.cmd("colorscheme carbonfox")

8
lua/setup/gui.lua Normal file
View File

@@ -0,0 +1,8 @@
if vim.g.neovide then
vim.g.neovide_padding_top = 8
vim.g.neovide_padding_bottom = 8
vim.g.neovide_padding_right = 8
vim.g.neovide_padding_left = 8
vim.g.neovide_transparency = 1
vim.o.guifont = "JetBrainsMonoNL Nerd Font:h10"
end

35
lua/setup/null-ls.lua Normal file
View File

@@ -0,0 +1,35 @@
local ok, null_ls = pcall(require, "null-ls")
if not ok then
return
end
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
null_ls.setup({
sources = {
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.clang_format,
},
-- you can reuse a shared lspconfig on_attach callback here
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({
bufnr = bufnr,
filter = function()
return client.name == "null-ls"
end,
})
end,
})
end
end,
})

93
lua/setup/nvim-cmp.lua Normal file
View File

@@ -0,0 +1,93 @@
local ok, cmp = pcall(require, "cmp")
if not ok then
return
end
local luasnip_ok, luasnip = pcall(require, "luasnip")
if not luasnip_ok then
return
end
local luasnip_vscode_ok, luasnip_vscode = pcall(require, "luasnip/loaders/from_vscode")
if not luasnip_vscode_ok then
return
end
local lspkind_ok, lspkind = pcall(require, "lspkind")
if not lspkind_ok then
return
end
luasnip_vscode.lazy_load()
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup({
view = {
--entries = { name = "custom", selection_order = "near_cursor" },
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
experimental = {
ghost_text = false,
},
formatting = {
fields = { "abbr", "kind", "menu" },
format = function(entry, vim_item)
local kind = lspkind.cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. (strings[1] or "") .. " "
kind.menu = (strings[2] or "")
return kind
end,
},
})

View File

@@ -3,16 +3,24 @@ if not status_ok then
return
end
local actions_ok, actions = pcall(require, "telescope.actions")
if not actions_ok then
return
end
telescope.setup({
defaults = {
-- Default configuration for telescope goes here:
-- config_key = value,
mappings = {
i = {
-- map actions.which_key to <C-h> (default: <C-/>)
-- actions.which_key shows the mappings for your picker,
-- map telescope.actions.which_key to <C-h> (default: <C-/>)
-- telescope.actions.which_key shows the mappings for your picker,
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
["<C-h>"] = "which_key",
["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next,
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
},
},
},
@@ -36,3 +44,5 @@ telescope.setup({
-- please take a look at the readme of the extension you want to configure
},
})
telescope.load_extension("fzf")

View File

@@ -1,16 +0,0 @@
local ok, toggleterm = pcall(require, "toggleterm")
if not ok then
return
end
toggleterm.setup({
open_mapping = [[<C-\>]],
hide_numbers = true,
start_in_insert = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
},
})

View File

@@ -1,33 +0,0 @@
local ok, transparency = pcall(require, "transparency")
if not ok then
return
end
transparency.setup({
groups = { -- table: default groups
"Normal",
"NormalNC",
"Comment",
"Constant",
"Special",
"Identifier",
"Statement",
"PreProc",
"Type",
"Underlined",
"Todo",
"String",
"Function",
"Conditional",
"Repeat",
"Operator",
"Structure",
"LineNr",
"NonText",
"SignColumn",
"CursorLineNr",
"EndOfBuffer",
},
extra_groups = {}, -- table: additional groups that should be cleared
exclude_groups = {}, -- table: groups you don't want to clear
})

View File

@@ -1,12 +0,0 @@
local ok, indent_blankline = pcall(require, "indent_blankline")
if not ok then
return
end
vim.cmd([[let g:indent_blankline_char = '¦']])
indent_blankline.setup({
-- for example, context is off by default, use this to turn it on
show_current_context = true,
show_current_context_start = true,
})