initial commit
This commit is contained in:
12
README.md
Normal file
12
README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# KeoviZ
|
||||
|
||||
Keyonz's Neovim config.
|
||||
|
||||
Careful the colorscheme is supposed to work with (KonfiZ)[https://github.com/Keyoonz/KonfiZ] which generates automatically the colors based on the wallpaper.
|
||||
|
||||
## Installation
|
||||
If you already have a config backup it or remove it and then you are good to install this configuration.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Keyoonz/KeoviZ ~/.config/nvim
|
||||
```
|
||||
3
init.lua
Normal file
3
init.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
require("config.keymaps")
|
||||
require("config.options")
|
||||
require("config.lazy")
|
||||
8
lua/assets/icons.lua
Normal file
8
lua/assets/icons.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
diagnostics = {
|
||||
Error = "",
|
||||
Warn = "",
|
||||
Info = "",
|
||||
Hint = "",
|
||||
}
|
||||
}
|
||||
23
lua/config/keymaps.lua
Normal file
23
lua/config/keymaps.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
vim.keymap.set("n", "<leader>c", "", { desc = "lsp" })
|
||||
vim.keymap.set("n", "<leader>cd", function()
|
||||
vim.diagnostic.open_float()
|
||||
end, { desc = "Show diagnostics" })
|
||||
vim.keymap.set("n", "<leader>cf", function()
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = "Format buffer" })
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, { desc = "code actions" })
|
||||
|
||||
vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = "go to left window" })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = "go to left window" })
|
||||
vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = "go to left window" })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = "go to left window" })
|
||||
|
||||
vim.keymap.set('n', '<A-k>', ':m .-2<CR>==', { desc = "Swap with above line" })
|
||||
vim.keymap.set('n', '<A-j>', ':m .1<CR>==', { desc = "Swap with above line" })
|
||||
|
||||
vim.keymap.set('n', '<esc>', function()
|
||||
vim.cmd("nohlsearch")
|
||||
end, { desc = "Clear search result" })
|
||||
35
lua/config/lazy.lua
Normal file
35
lua/config/lazy.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
-- 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 = { "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
15
lua/config/options.lua
Normal file
15
lua/config/options.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = {
|
||||
tab = "> ",
|
||||
trail = "-",
|
||||
nbsp = "+",
|
||||
}
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.expandtab = false
|
||||
|
||||
vim.opt.cmdheight = 0
|
||||
29
lua/plugins/bufferline.lua
Normal file
29
lua/plugins/bufferline.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
return {
|
||||
'akinsho/bufferline.nvim',
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
vim.o.showtabline = 2
|
||||
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
mode = "buffers",
|
||||
always_show_bufferline = false,
|
||||
numbers = "none",
|
||||
diagnostics = "nvim_lsp",
|
||||
separator_style = "slant",
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = false,
|
||||
close_command = function(n) Snacks.bufdelete(n) end,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "snacks_layout_box",
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{ "<S-h>", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev Buffer" },
|
||||
{ "<S-l>", "<cmd>BufferLineCycleNext<cr>", desc = "Next Buffer" },
|
||||
}
|
||||
}
|
||||
53
lua/plugins/cmp.lua
Normal file
53
lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
return {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = function(fallback)
|
||||
if luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
28
lua/plugins/fold.lua
Normal file
28
lua/plugins/fold.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
return {
|
||||
"kevinhwang91/nvim-ufo",
|
||||
dependencies = {
|
||||
"kevinhwang91/promise-async", -- required by nvim-ufo
|
||||
"nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
config = function()
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "v:lua.require('ufo').foldexpr()"
|
||||
vim.opt.foldlevel = 99 -- open all folds initially
|
||||
vim.opt.foldlevelstart = 99 -- set foldlevel when buffer loads
|
||||
|
||||
|
||||
local ufo = require('ufo')
|
||||
|
||||
-- Optional: keymaps for folding
|
||||
vim.keymap.set('n', 'zR', ufo.openAllFolds)
|
||||
vim.keymap.set('n', 'zM', ufo.closeAllFolds)
|
||||
vim.keymap.set('n', 'K', function()
|
||||
local winid = ufo.peekFoldedLinesUnderCursor()
|
||||
if not winid then
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end)
|
||||
|
||||
ufo.setup()
|
||||
end,
|
||||
}
|
||||
28
lua/plugins/lsp.lua
Normal file
28
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
return {
|
||||
{
|
||||
'mason-org/mason.nvim',
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
'mason-org/mason-lspconfig.nvim',
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
'clangd',
|
||||
'harper_ls',
|
||||
},
|
||||
automatic_enable = {
|
||||
exclude = {
|
||||
'harper_ls',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function()
|
||||
local lspconfig = require 'lspconfig'
|
||||
lspconfig.harper_ls.setup { filetypes = { 'markdown' } }
|
||||
end,
|
||||
},
|
||||
}
|
||||
65
lua/plugins/lualine.lua
Normal file
65
lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
local lualine = require("lualine")
|
||||
local icons = require("assets.icons")
|
||||
local default_config = {
|
||||
options = {
|
||||
theme = "nightfly",
|
||||
globalstatus = true,
|
||||
section_separators = '',
|
||||
component_separators = '',
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch' },
|
||||
lualine_c = {
|
||||
"filename",
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warn = icons.diagnostics.Warn,
|
||||
info = icons.diagnostics.Info,
|
||||
hint = icons.diagnostics.Hint,
|
||||
},
|
||||
}
|
||||
},
|
||||
lualine_x = { 'filetype' },
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = { 'location' }
|
||||
},
|
||||
extensions = {
|
||||
'lazy',
|
||||
'mason',
|
||||
},
|
||||
}
|
||||
-- Minimal config for Snacks Explorer
|
||||
local explorer_config = {
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {
|
||||
function() return "Explorer" end
|
||||
}
|
||||
}
|
||||
}
|
||||
-- Setup default lualine on startup
|
||||
lualine.setup(default_config)
|
||||
-- Autocommand to switch layout when Snacks Explorer is open
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "WinEnter" }, {
|
||||
callback = function()
|
||||
local filetype = vim.bo.filetype
|
||||
if filetype:match("snacks_picker_list") then
|
||||
require("lualine").setup(explorer_config)
|
||||
else
|
||||
require("lualine").setup(default_config)
|
||||
end
|
||||
end
|
||||
})
|
||||
end,
|
||||
}
|
||||
9
lua/plugins/nvim-kolorz.lua
Normal file
9
lua/plugins/nvim-kolorz.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
"Keyoonz/nvim-kolorz",
|
||||
name = "nvim-kolorz",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd("colorscheme nvim-kolorz")
|
||||
end,
|
||||
}
|
||||
57
lua/plugins/snacks.lua
Normal file
57
lua/plugins/snacks.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
return {
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
explorer = {
|
||||
enabled = true,
|
||||
},
|
||||
bufdelete = {
|
||||
enabled = true,
|
||||
},
|
||||
picker = {
|
||||
enabled = true,
|
||||
},
|
||||
quickfile = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- explorer
|
||||
{ "<leader>e", function() Snacks.explorer() end, desc = "File Explorer" },
|
||||
-- Files
|
||||
{ "<leader>f", "", desc = "Files" },
|
||||
{ "<leader>fd", function() Snacks.bufdelete() end, desc = "Delete Buffer" },
|
||||
{ "<leader>ff", function() Snacks.picker.files() end, desc = "Find Files" },
|
||||
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||
{ "<leader>fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" },
|
||||
{ "<leader>fr", function() Snacks.picker.recent() end, desc = "Recent" },
|
||||
{ "<leader>f/", function() Snacks.picker.lines() end, desc = "Grep Lines" },
|
||||
-- picker
|
||||
{ "<leader>/", function() Snacks.picker.grep() end, desc = "Grep" },
|
||||
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
|
||||
-- -- Grep
|
||||
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
|
||||
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
|
||||
{ "<leader>sg", function() Snacks.picker.grep() end, desc = "Grep" },
|
||||
{ "<leader>sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } },
|
||||
-- -- search
|
||||
{ '<leader>sh', function() Snacks.picker.search_history() end, desc = "Search History" },
|
||||
{ "<leader>sc", function() Snacks.picker.command_history() end, desc = "Command History" },
|
||||
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
|
||||
{ "<leader>sD", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
|
||||
{ "<leader>sd", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
|
||||
{ "<leader>sH", function() Snacks.picker.help() end, desc = "Help Pages" },
|
||||
{ "<leader>si", function() Snacks.picker.icons() end, desc = "Icons" },
|
||||
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
|
||||
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undo History" },
|
||||
{ "<leader>uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
|
||||
-- -- LSP
|
||||
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition" },
|
||||
{ "gD", function() Snacks.picker.lsp_declarations() end, desc = "Goto Declaration" },
|
||||
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
|
||||
{ "gi", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
|
||||
{ "gt", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
|
||||
}
|
||||
}
|
||||
18
lua/plugins/treesitter.lua
Normal file
18
lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user