first commit
This commit is contained in:
commit
65451f9c9d
4
init.lua
Normal file
4
init.lua
Normal file
@ -0,0 +1,4 @@
|
||||
require("config.options")
|
||||
require("config.keymaps")
|
||||
require("config.autocmds")
|
||||
require("config.lazy")
|
8
lua/config/autocmds.lua
Normal file
8
lua/config/autocmds.lua
Normal file
@ -0,0 +1,8 @@
|
||||
-- Highlight on yank
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
8
lua/config/keymaps.lua
Normal file
8
lua/config/keymaps.lua
Normal file
@ -0,0 +1,8 @@
|
||||
-- ESC to stop highlighting search
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Easier navigration between windows
|
||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
47
lua/config/lazy.lua
Normal file
47
lua/config/lazy.lua
Normal file
@ -0,0 +1,47 @@
|
||||
-- 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)
|
||||
|
||||
-- Setup lazy.nvim
|
||||
local lazy = require("lazy")
|
||||
|
||||
lazy.setup({
|
||||
spec = {
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
lazy = false,
|
||||
version = false,
|
||||
},
|
||||
install = { colorscheme = { "moonfly", "wildcharm" } },
|
||||
checker = { enabled = true, notify = false },
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>l", lazy.home)
|
51
lua/config/options.lua
Normal file
51
lua/config/options.lua
Normal file
@ -0,0 +1,51 @@
|
||||
-- Leader
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
vim.opt.timeoutlen = 300
|
||||
|
||||
-- Numbers
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Mouse
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
-- Use system clipboard
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
-- Indent
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- History
|
||||
vim.opt.undofile = true
|
||||
vim.opt.updatetime = 250
|
||||
|
||||
-- Search
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- UI
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.scrolloff = 5
|
||||
vim.opt.wrap = false
|
||||
|
||||
-- Splits
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
|
||||
-- Whitespaces
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||
|
||||
-- Preview substitutions
|
||||
vim.opt.inccommand = 'split'
|
||||
|
||||
-- Colors
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Statusline
|
||||
vim.opt.laststatus = 3
|
||||
vim.opt.showmode = false
|
5
lua/plugins/autopairs.lua
Normal file
5
lua/plugins/autopairs.lua
Normal file
@ -0,0 +1,5 @@
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {},
|
||||
}
|
20
lua/plugins/blink-cmp.lua
Normal file
20
lua/plugins/blink-cmp.lua
Normal file
@ -0,0 +1,20 @@
|
||||
return {
|
||||
"saghen/blink.cmp",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
version = "*",
|
||||
event = "InsertEnter",
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = { preset = "enter" },
|
||||
appearance = {
|
||||
use_nvim_cmp_as_default = false,
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer" },
|
||||
},
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
}
|
7
lua/plugins/bufferline.lua
Normal file
7
lua/plugins/bufferline.lua
Normal file
@ -0,0 +1,7 @@
|
||||
return {
|
||||
'akinsho/bufferline.nvim',
|
||||
version = "*",
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
lazy = false,
|
||||
opts = {},
|
||||
}
|
20
lua/plugins/conform.lua
Normal file
20
lua/plugins/conform.lua
Normal file
@ -0,0 +1,20 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
keys = {
|
||||
{
|
||||
"<leader>cf",
|
||||
function()
|
||||
require("conform").format({
|
||||
async = true,
|
||||
timeout_ms = 3000,
|
||||
lsp_format = "fallback",
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
},
|
||||
},
|
||||
}
|
20
lua/plugins/fzf.lua
Normal file
20
lua/plugins/fzf.lua
Normal file
@ -0,0 +1,20 @@
|
||||
return {
|
||||
"ibhagwan/fzf-lua",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local fzf_lua = require("fzf-lua")
|
||||
|
||||
-- Setup
|
||||
fzf_lua.setup({})
|
||||
|
||||
-- Register as the UI for vim.ui.select
|
||||
fzf_lua.register_ui_select()
|
||||
|
||||
-- Keymaps
|
||||
vim.keymap.set("n", "<leader>ff", fzf_lua.files)
|
||||
vim.keymap.set("n", "<leader>fb", fzf_lua.buffers)
|
||||
vim.keymap.set("n", "<leader>fh", fzf_lua.oldfiles)
|
||||
vim.keymap.set("n", "<leader>fg", fzf_lua.live_grep)
|
||||
end
|
||||
}
|
57
lua/plugins/lsp.lua
Normal file
57
lua/plugins/lsp.lua
Normal file
@ -0,0 +1,57 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = "Mason",
|
||||
keys = { { "<Leader>cm", "<cmd>Mason<cr>" } },
|
||||
opts = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "williamboman/mason.nvim" },
|
||||
opts = {
|
||||
ensure_installed = { "lua_ls", "gopls" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
cmd = { "LspInfo", "LspInstall", "LspUninstall" },
|
||||
opts = {
|
||||
servers = {
|
||||
lua_ls = {},
|
||||
ccls = {},
|
||||
gopls = {},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- Servers
|
||||
for server, config in pairs(opts.servers) do
|
||||
config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
|
||||
lspconfig[server].setup(config)
|
||||
end
|
||||
|
||||
-- Keybinds
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action)
|
||||
|
||||
-- Signs
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
9
lua/plugins/lualine.lua
Normal file
9
lua/plugins/lualine.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
lazy = false,
|
||||
opts = {
|
||||
options = { section_separators = '', component_separators = '' },
|
||||
extensions = { "fzf", "lazy", "man", "mason", "nvim-tree"},
|
||||
},
|
||||
}
|
12
lua/plugins/moonfly.lua
Normal file
12
lua/plugins/moonfly.lua
Normal file
@ -0,0 +1,12 @@
|
||||
return {
|
||||
"bluz71/vim-moonfly-colors",
|
||||
name = "moonfly",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
init = function()
|
||||
vim.g.moonflyTransparent = true
|
||||
end,
|
||||
config = function()
|
||||
vim.cmd("colorscheme moonfly")
|
||||
end
|
||||
}
|
14
lua/plugins/nvim-tree.lua
Normal file
14
lua/plugins/nvim-tree.lua
Normal file
@ -0,0 +1,14 @@
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
event = "VeryLazy",
|
||||
-- lazy = false,
|
||||
config = function()
|
||||
require("nvim-tree").setup({})
|
||||
|
||||
local api = require("nvim-tree.api")
|
||||
|
||||
vim.keymap.set("n", "<leader>e", api.tree.toggle )
|
||||
end,
|
||||
}
|
48
lua/plugins/treesitter.lua
Normal file
48
lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,48 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
configs.setup({
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"diff",
|
||||
"html",
|
||||
"javascript",
|
||||
"jsdoc",
|
||||
"json",
|
||||
"jsonc",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"printf",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"xml",
|
||||
"yaml",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user