fix nvim path
This commit is contained in:
parent
70044dd399
commit
d97a9a390b
5
.config/nvim/lua/commands.lua
Normal file
5
.config/nvim/lua/commands.lua
Normal file
@ -0,0 +1,5 @@
|
||||
-- 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, {})
|
33
.config/nvim/lua/mappings.lua
Normal file
33
.config/nvim/lua/mappings.lua
Normal file
@ -0,0 +1,33 @@
|
||||
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>/", function()
|
||||
require("Comment.api").toggle.linewise.current()
|
||||
end)
|
||||
|
||||
map("v", "<leader>/", "<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>")
|
||||
|
||||
-- format
|
||||
map("n", "<leader>fm", function()
|
||||
require("conform").format()
|
||||
end)
|
38
.config/nvim/lua/options.lua
Normal file
38
.config/nvim/lua/options.lua
Normal file
@ -0,0 +1,38 @@
|
||||
local opt = vim.opt
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
opt.laststatus = 3 -- global statusline
|
||||
opt.showmode = false
|
||||
|
||||
opt.clipboard = "unnamedplus"
|
||||
|
||||
-- Indenting
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 2
|
||||
opt.smartindent = true
|
||||
opt.tabstop = 2
|
||||
opt.softtabstop = 2
|
||||
|
||||
opt.fillchars = { eob = " " }
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Numbers
|
||||
opt.number = true
|
||||
opt.ruler = false
|
||||
|
||||
opt.signcolumn = "yes"
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = 400
|
||||
opt.undofile = true
|
||||
|
||||
opt.timeoutlen = 400
|
||||
opt.updatetime = 250
|
||||
|
||||
-- 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"
|
8
.config/nvim/lua/plugins/configs/bufferline.lua
Normal file
8
.config/nvim/lua/plugins/configs/bufferline.lua
Normal file
@ -0,0 +1,8 @@
|
||||
require("bufferline").setup {
|
||||
options = {
|
||||
themable = true,
|
||||
offsets = {
|
||||
{ filetype = "NvimTree", highlight = "NvimTreeNormal" },
|
||||
},
|
||||
},
|
||||
}
|
49
.config/nvim/lua/plugins/configs/cmp.lua
Normal file
49
.config/nvim/lua/plugins/configs/cmp.lua
Normal file
@ -0,0 +1,49 @@
|
||||
local cmp = require "cmp"
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<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 },
|
||||
|
||||
-- luasnip
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
},
|
||||
sources = cmp.config.sources {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
},
|
||||
}
|
6
.config/nvim/lua/plugins/configs/conform.lua
Normal file
6
.config/nvim/lua/plugins/configs/conform.lua
Normal file
@ -0,0 +1,6 @@
|
||||
require("conform").setup {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { { "prettier" } },
|
||||
},
|
||||
}
|
36
.config/nvim/lua/plugins/configs/lazy.lua
Normal file
36
.config/nvim/lua/plugins/configs/lazy.lua
Normal file
@ -0,0 +1,36 @@
|
||||
return {
|
||||
install = { colorscheme = { "nightfox" } },
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"2html_plugin",
|
||||
"tohtml",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"gzip",
|
||||
"logipat",
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"matchit",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tutor",
|
||||
"rplugin",
|
||||
"syntax",
|
||||
"synmenu",
|
||||
"optwin",
|
||||
"compiler",
|
||||
"bugreport",
|
||||
"ftplugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
73
.config/nvim/lua/plugins/configs/lspconfig.lua
Normal file
73
.config/nvim/lua/plugins/configs/lspconfig.lua
Normal file
@ -0,0 +1,73 @@
|
||||
-- Global mappings.
|
||||
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)
|
||||
|
||||
-- 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", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, 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)
|
||||
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||
-- vim.keymap.set("n", "<space>f", function()
|
||||
-- vim.lsp.buf.format { async = true }
|
||||
-- end, 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",
|
||||
},
|
||||
},
|
||||
}
|
||||
-- Setup language servers.
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- setup multiple servers with same default options
|
||||
local servers = { "tsserver", "html", "cssls" }
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
8
.config/nvim/lua/plugins/configs/telescope.lua
Normal file
8
.config/nvim/lua/plugins/configs/telescope.lua
Normal file
@ -0,0 +1,8 @@
|
||||
require("telescope").setup {
|
||||
defaults = {
|
||||
sorting_strategy = "ascending",
|
||||
layout_config = {
|
||||
horizontal = { prompt_position = "top" },
|
||||
},
|
||||
},
|
||||
}
|
9
.config/nvim/lua/plugins/configs/treesitter.lua
Normal file
9
.config/nvim/lua/plugins/configs/treesitter.lua
Normal file
@ -0,0 +1,9 @@
|
||||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = { "lua", "vim", "vimdoc", "tsx", "html", "css", "typescript", "javascript" },
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
indent = { enable = true },
|
||||
}
|
158
.config/nvim/lua/plugins/init.lua
Normal file
158
.config/nvim/lua/plugins/init.lua
Normal file
@ -0,0 +1,158 @@
|
||||
local plugins = {
|
||||
{ lazy = true, "nvim-lua/plenary.nvim" },
|
||||
|
||||
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
|
||||
|
||||
-- file tree
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||
config = function()
|
||||
require("nvim-tree").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- icons, for UI related plugins
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
require("nvim-web-devicons").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- syntax highlighting
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require "plugins.configs.treesitter"
|
||||
end,
|
||||
},
|
||||
|
||||
-- buffer + tab line
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
event = "BufReadPre",
|
||||
config = function()
|
||||
require "plugins.configs.bufferline"
|
||||
end,
|
||||
},
|
||||
|
||||
-- statusline
|
||||
|
||||
{
|
||||
"echasnovski/mini.statusline",
|
||||
config = function()
|
||||
require("mini.statusline").setup { set_vim_settings = false }
|
||||
end,
|
||||
},
|
||||
|
||||
-- we use cmp plugin only when in insert mode
|
||||
-- so lets lazyload it at InsertEnter event, to know all the events check h-events
|
||||
-- completion , now all of these plugins are dependent on cmp, we load them after cmp
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
-- cmp sources
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
|
||||
-- snippets
|
||||
--list of default snippets
|
||||
"rafamadriz/friendly-snippets",
|
||||
|
||||
-- snippets engine
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
|
||||
-- autopairs , autocompletes ()[] etc
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
|
||||
-- cmp integration
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
local cmp = require "cmp"
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require "plugins.configs.cmp"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
build = ":MasonUpdate",
|
||||
cmd = { "Mason", "MasonInstall" },
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- lsp
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
end,
|
||||
},
|
||||
|
||||
-- formatting , linting
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
lazy = true,
|
||||
config = function()
|
||||
require "plugins.configs.conform"
|
||||
end,
|
||||
},
|
||||
|
||||
-- indent lines
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("ibl").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- files finder etc
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
config = function()
|
||||
require "plugins.configs.telescope"
|
||||
end,
|
||||
},
|
||||
|
||||
-- git status on signcolumn etc
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- comment plugin
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
lazy = true,
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
require("lazy").setup(plugins, require "plugins.configs.lazy")
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -38,7 +38,7 @@
|
||||
!.config/alacritty/*
|
||||
|
||||
!.config/nvim
|
||||
!.config/nvim/*
|
||||
!.config/nvim/**
|
||||
|
||||
!.config/dunst
|
||||
!.config/dunst/*
|
||||
|
Loading…
Reference in New Issue
Block a user