init
This commit is contained in:
19
lua/commands.lua
Normal file
19
lua/commands.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
-- mason, write correct names only
|
||||
vim.api.nvim_create_user_command("MasonInstallAll", function()
|
||||
vim.cmd "MasonInstall css-lsp html-lsp lua-language-server typescript-language-server stylua prettier"
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "*",
|
||||
callback = function ()
|
||||
pcall(vim.treesitter.start)
|
||||
end
|
||||
})
|
||||
|
||||
local create_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
create_cmd("TSInstallAll", function()
|
||||
local spec = require("lazy.core.config").plugins["nvim-treesitter"]
|
||||
local opts = type(spec.opts()) == "table" and spec.opts() or {}
|
||||
require("nvim-treesitter").install(opts.ensure_installed)
|
||||
end, {})
|
||||
3
lua/lazy_config.lua
Normal file
3
lua/lazy_config.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
install = { colorscheme = { "vague" } },
|
||||
}
|
||||
30
lua/mappings.lua
Normal file
30
lua/mappings.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- general mappings
|
||||
map("n", "<C-s>", "<cmd> w <CR>")
|
||||
map("i", "jk", "<ESC>")
|
||||
map("n", "<C-c>", "<cmd> %y+ <CR>") -- copy whole filecontent
|
||||
|
||||
-- nvimtree
|
||||
map("n", "<C-n>", "<cmd> NvimTreeToggle <CR>")
|
||||
map("n", "<C-h>", "<cmd> NvimTreeFocus <CR>")
|
||||
|
||||
-- telescope
|
||||
map("n", "<leader>ff", "<cmd> Telescope find_files <CR>")
|
||||
map("n", "<leader>fo", "<cmd> Telescope oldfiles <CR>")
|
||||
map("n", "<leader>fw", "<cmd> Telescope live_grep <CR>")
|
||||
map("n", "<leader>gt", "<cmd> Telescope git_status <CR>")
|
||||
|
||||
-- bufferline, cycle buffers
|
||||
map("n", "<Tab>", "<cmd> BufferLineCycleNext <CR>")
|
||||
map("n", "<S-Tab>", "<cmd> BufferLineCyclePrev <CR>")
|
||||
map("n", "<C-q>", "<cmd> bd <CR>")
|
||||
|
||||
-- comment.nvim
|
||||
map("n", "<leader>/", "gcc", { remap = true })
|
||||
map("v", "<leader>/", "gc", { remap = true })
|
||||
|
||||
-- format
|
||||
map("n", "<leader>fm", function()
|
||||
require("conform").format()
|
||||
end)
|
||||
40
lua/options.lua
Normal file
40
lua/options.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
local o = vim.o
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
|
||||
o.laststatus = 3 -- global statusline
|
||||
o.showmode = false
|
||||
|
||||
o.clipboard = "unnamedplus"
|
||||
|
||||
-- Indenting
|
||||
o.expandtab = true
|
||||
o.shiftwidth = 2
|
||||
o.smartindent = true
|
||||
o.tabstop = 2
|
||||
o.softtabstop = 2
|
||||
|
||||
vim.opt.fillchars = { eob = " " }
|
||||
o.ignorecase = true
|
||||
o.smartcase = true
|
||||
o.mouse = "a"
|
||||
|
||||
o.number = true
|
||||
|
||||
o.signcolumn = "yes"
|
||||
o.splitbelow = true
|
||||
o.splitright = true
|
||||
o.termguicolors = true
|
||||
o.timeoutlen = 400
|
||||
o.undofile = true
|
||||
o.cursorline = true
|
||||
|
||||
-- add binaries installed by mason.nvim to path
|
||||
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
|
||||
vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "data" .. "/mason/bin"
|
||||
|
||||
vim.api.nvim_set_hl(0, "IndentLine", { link = "Comment" })
|
||||
|
||||
23
lua/plugins/configs/blink.lua
Normal file
23
lua/plugins/configs/blink.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
return {
|
||||
snippets = { preset = "luasnip" },
|
||||
cmdline = { enabled = true },
|
||||
appearance = { nerd_font_variant = "normal" },
|
||||
fuzzy = { implementation = "prefer_rust" },
|
||||
sources = { default = { "lsp", "snippets", "buffer", "path" } },
|
||||
|
||||
keymap = {
|
||||
preset = "default",
|
||||
["<CR>"] = { "accept", "fallback" },
|
||||
["<C-b>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-f"] = { "scroll_documentation_down", "fallback" },
|
||||
},
|
||||
|
||||
completion = {
|
||||
ghost_text = { enabled = true },
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 200,
|
||||
window = { border = "single" },
|
||||
},
|
||||
},
|
||||
}
|
||||
8
lua/plugins/configs/bufferline.lua
Normal file
8
lua/plugins/configs/bufferline.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
options = {
|
||||
themable = true,
|
||||
offsets = {
|
||||
{ filetype = "NvimTree", highlight = "NvimTreeNormal" },
|
||||
},
|
||||
},
|
||||
}
|
||||
6
lua/plugins/configs/conform.lua
Normal file
6
lua/plugins/configs/conform.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { "prettier" },
|
||||
},
|
||||
}
|
||||
44
lua/plugins/configs/lspconfig.lua
Normal file
44
lua/plugins/configs/lspconfig.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
capabilities.textDocument.completion.completionItem = {
|
||||
documentationFormat = { "markdown", "plaintext" },
|
||||
snippetSupport = true,
|
||||
preselectSupport = true,
|
||||
insertReplaceSupport = true,
|
||||
labelDetailsSupport = true,
|
||||
deprecatedSupport = true,
|
||||
commitCharactersSupport = true,
|
||||
tagSupport = { valueSet = { 1 } },
|
||||
resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"detail",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config("*", { capabilities = capabilities })
|
||||
local servers = { "html", "cssls" , 'lua_ls' }
|
||||
|
||||
vim.lsp.enable(servers)
|
||||
8
lua/plugins/configs/telescope.lua
Normal file
8
lua/plugins/configs/telescope.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
defaults = {
|
||||
sorting_strategy = "ascending",
|
||||
layout_config = {
|
||||
horizontal = { prompt_position = "top" },
|
||||
},
|
||||
},
|
||||
}
|
||||
3
lua/plugins/configs/treesitter.lua
Normal file
3
lua/plugins/configs/treesitter.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" },
|
||||
}
|
||||
135
lua/plugins/init.lua
Normal file
135
lua/plugins/init.lua
Normal file
@@ -0,0 +1,135 @@
|
||||
return {
|
||||
{ lazy = true, "nvim-lua/plenary.nvim" },
|
||||
|
||||
{ "nvim-tree/nvim-web-devicons", opts = {} },
|
||||
{ "echasnovski/mini.statusline", opts = {} },
|
||||
{ "lewis6991/gitsigns.nvim", opts = {} },
|
||||
|
||||
"EdenEast/nightfox.nvim",
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {},
|
||||
init = function()
|
||||
-- Load nvim-tree early if Neovim starts without a file
|
||||
if vim.fn.argc() == 0 then
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
require("nvim-tree.api").tree.open()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}, {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate | TSInstallAll",
|
||||
opts = function()
|
||||
return require "plugins.configs.treesitter"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
opts = require "plugins.configs.bufferline",
|
||||
},
|
||||
|
||||
-- we use blink plugin only when in insert mode
|
||||
-- so lets lazyload it at InsertEnter event
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
version = "1.*",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
|
||||
-- snippets engine
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
|
||||
-- autopairs , autocompletes ()[] etc
|
||||
{ "windwp/nvim-autopairs", opts = {} },
|
||||
},
|
||||
-- made opts a function cuz cmp config calls cmp module
|
||||
-- and we lazyloaded cmp so we dont want that file to be read on startup!
|
||||
opts = function()
|
||||
return require "plugins.configs.blink"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
build = ":MasonUpdate",
|
||||
cmd = { "Mason", "MasonInstall" },
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = require "plugins.configs.conform",
|
||||
},
|
||||
|
||||
{
|
||||
"nvimdev/indentmini.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
char="",
|
||||
},
|
||||
},
|
||||
|
||||
-- files finder etc
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
opts = require "plugins.configs.telescope",
|
||||
},
|
||||
|
||||
{
|
||||
"vague-theme/vague.nvim",
|
||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other plugins
|
||||
config = function()
|
||||
-- NOTE: you do not need to call setup if you don't want to.
|
||||
require("vague").setup({
|
||||
-- optional configuration here
|
||||
})
|
||||
vim.cmd("colorscheme vague")
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"nanotech/jellybeans.vim",
|
||||
lazy = false, -- load during startup
|
||||
priority = 1000, -- make sure it loads before other UI plugins
|
||||
},
|
||||
{
|
||||
"dgox16/oldworld.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
},
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
lazy = false, -- load on startup
|
||||
priority = 1000, -- make sure it loads before other colorschemes
|
||||
config = function()
|
||||
require("rose-pine").setup({
|
||||
dark_variant = "main", -- options: "main", "moon", "dawn"
|
||||
bold_vert_split = false,
|
||||
dim_nc_background = true,
|
||||
disable_background = false,
|
||||
})
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user