Update back to base config
This commit is contained in:
19
init.lua
19
init.lua
@@ -4,14 +4,17 @@ require "core"
|
|||||||
-- Bootstrap lazy.nvim
|
-- Bootstrap lazy.nvim
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
"git",
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
"clone",
|
if vim.v.shell_error ~= 0 then
|
||||||
"--filter=blob:none",
|
vim.api.nvim_echo({
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
"--branch=stable",
|
{ out, "WarningMsg" },
|
||||||
lazypath,
|
{ "\nPress any key to exit..." },
|
||||||
})
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
local api = vim.api
|
local api = vim.api
|
||||||
|
|
||||||
-- Set cargo for .rs files
|
|
||||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
pattern = { "*.rs" },
|
pattern = { "*.rs" },
|
||||||
command = "compiler cargo"
|
command = "compiler cargo"
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Indentation for .go files
|
|
||||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
pattern = { "*.go" },
|
pattern = { "*.go" },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd [[Tabs 4]]
|
vim.cmd [[Tabs 4]]
|
||||||
|
command = "compiler go"
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Set tsc for .ts files
|
|
||||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
pattern = { "*.ts", "*.tsx" },
|
pattern = { "*.ts", "*.tsx" },
|
||||||
command = "compiler tsc"
|
command = "compiler tsc"
|
||||||
|
|||||||
@@ -21,12 +21,3 @@ map("n", "<leader>h", ":noh<CR>")
|
|||||||
|
|
||||||
-- Replace (visual)
|
-- Replace (visual)
|
||||||
map("v", "<leader>r", "\"hy:%s/<C-r>h//g<left><left>")
|
map("v", "<leader>r", "\"hy:%s/<C-r>h//g<left><left>")
|
||||||
|
|
||||||
-- Buffer manager
|
|
||||||
map("n", "<leader>b", ":lua require(\"buffer_manager.ui\").toggle_quick_menu()<CR>")
|
|
||||||
|
|
||||||
-- LSP
|
|
||||||
map("n", "<leader>lf", "<cmd>lua vim.lsp.buf.format { async = true }<CR>")
|
|
||||||
map("n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
|
||||||
map("n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<CR>")
|
|
||||||
map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>")
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local g, opt = vim.g, vim.opt
|
local g, opt, cmd = vim.g, vim.opt, vim.cmd
|
||||||
|
|
||||||
-- Settings
|
-- Settings
|
||||||
g.mapleader = " "
|
g.mapleader = " "
|
||||||
@@ -22,11 +22,8 @@ opt.showmode = false
|
|||||||
opt.grepprg = "rg --vimgrep --smart-case"
|
opt.grepprg = "rg --vimgrep --smart-case"
|
||||||
|
|
||||||
opt.path = ".,**"
|
opt.path = ".,**"
|
||||||
vim.cmd "set path-=node_modules/**"
|
cmd "set path-=node_modules/**"
|
||||||
vim.cmd "set wildignore-=*/node_modules/*"
|
cmd "set wildignore-=*/node_modules/*"
|
||||||
|
|
||||||
-- Netrw
|
|
||||||
g.netrw_banner = 0
|
|
||||||
|
|
||||||
-- Indentation
|
-- Indentation
|
||||||
opt.expandtab = true
|
opt.expandtab = true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local fn, api = vim.fn, vim.api
|
local fn, api, o, bo = vim.fn, vim.api, vim.o, vim.bo
|
||||||
|
|
||||||
local modes = {
|
local modes = {
|
||||||
["n"] = "NORMAL",
|
["n"] = "NORMAL",
|
||||||
@@ -19,8 +19,8 @@ end
|
|||||||
|
|
||||||
function StatusLine()
|
function StatusLine()
|
||||||
local filename = fn.expand("%:t")
|
local filename = fn.expand("%:t")
|
||||||
local filetype = vim.bo.filetype
|
local filetype = bo.filetype
|
||||||
local lineinfo = fn.line(".") .. ":" .. vim.fn.col(".")
|
local lineinfo = fn.line(".") .. ":" .. fn.col(".")
|
||||||
local percent = fn.line(".") / fn.line("$") * 100
|
local percent = fn.line(".") / fn.line("$") * 100
|
||||||
|
|
||||||
return table.concat {
|
return table.concat {
|
||||||
@@ -35,4 +35,4 @@ function StatusLine()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.o.statusline = "%!luaeval('StatusLine()')"
|
o.statusline = "%!luaeval('StatusLine()')"
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
return {
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
event = "InsertEnter",
|
|
||||||
dependencies = {
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
"hrsh7th/cmp-buffer",
|
|
||||||
"L3MON4D3/LuaSnip",
|
|
||||||
"saadparwaiz1/cmp_luasnip"
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require("luasnip").lsp_expand(args.body)
|
|
||||||
end
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "luasnip" }
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
|
||||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
|
||||||
["<Tab>"] = cmp.mapping.select_next_item(),
|
|
||||||
["<S-Tab>"] = cmp.mapping.select_prev_item()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
return {
|
|
||||||
"ray-x/go.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"ray-x/guihua.lua",
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
"nvim-treesitter/nvim-treesitter"
|
|
||||||
},
|
|
||||||
config = true,
|
|
||||||
event = "CmdlineEnter",
|
|
||||||
ft = {"go", "gomod"},
|
|
||||||
build = ':lua require("go.install").update_all_sync()'
|
|
||||||
}
|
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
return {
|
return {
|
||||||
"wakatime/vim-wakatime",
|
"wakatime/vim-wakatime"
|
||||||
{
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
requires = "nvim-tree/nvim-web-devicons",
|
|
||||||
config = true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"j-morano/buffer_manager.nvim",
|
|
||||||
requires = "nvim-lua/plenary.nvim"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ray-x/lsp_signature.nvim",
|
|
||||||
event = "VeryLazy",
|
|
||||||
opts = {},
|
|
||||||
config = function(_, opts) require "lsp_signature".setup(opts) end
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
return {
|
|
||||||
"williamboman/mason-lspconfig.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
"hrsh7th/cmp-nvim-lsp"
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
||||||
|
|
||||||
local defaultSetup = function(server)
|
|
||||||
lspconfig[server].setup {
|
|
||||||
capabilities = lsp_capabilities
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
require("mason").setup()
|
|
||||||
require("mason-lspconfig").setup {
|
|
||||||
ensure_installed = {},
|
|
||||||
handlers = { defaultSetup }
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
local function map(mode, lhs, rhs)
|
||||||
|
vim.keymap.set(mode, lhs, rhs, {})
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
@@ -8,18 +12,23 @@ return {
|
|||||||
local telescope = require("telescope")
|
local telescope = require("telescope")
|
||||||
local builtin = require("telescope.builtin")
|
local builtin = require("telescope.builtin")
|
||||||
|
|
||||||
telescope.setup()
|
telescope.setup {
|
||||||
|
defaults = {
|
||||||
|
layout_config = { prompt_position = "top" },
|
||||||
|
sorting_strategy = "ascending"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
telescope.load_extension("fzf")
|
telescope.load_extension("fzf")
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>ff", builtin.fd, {})
|
map("n", "<leader>ff", builtin.fd)
|
||||||
vim.keymap.set("n", "<leader>fw", builtin.live_grep, {})
|
map("n", "<leader>fw", builtin.live_grep)
|
||||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
|
map("n", "<leader>fb", builtin.buffers)
|
||||||
vim.keymap.set("n", "<C-f>", builtin.current_buffer_fuzzy_find, {})
|
map("n", "<C-f>", builtin.current_buffer_fuzzy_find)
|
||||||
|
|
||||||
-- Visual word highlight
|
-- Visual word highlight
|
||||||
local default_opts = { noremap = true, silent = true }
|
map("v", "<C-f>", "y<ESC>:Telescope current_buffer_fuzzy_find default_text=<c-r>0<CR>")
|
||||||
vim.api.nvim_set_keymap("v", "<C-f>", "y<ESC>:Telescope current_buffer_fuzzy_find default_text=<c-r>0<CR>", {})
|
map("v", "<leader>fw", "y<ESC>:Telescope live_grep default_text=<c-r>0<CR>")
|
||||||
vim.api.nvim_set_keymap("v", "<leader>fw", "y<ESC>:Telescope live_grep default_text=<c-r>0<CR>", {})
|
map("v", "<leader>ff", "y<ESC>:Telescope fd default_text=<c-r>0<CR>")
|
||||||
vim.api.nvim_set_keymap("v", "<leader>ff", "y<ESC>:Telescope fd default_text=<c-r>0<CR>", {})
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ return {
|
|||||||
lazy = false,
|
lazy = false,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
opts = {
|
opts = {
|
||||||
style = "night",
|
style = "night"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
return {
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
build = ":TSUpdate",
|
|
||||||
config = function()
|
|
||||||
local configs = require("nvim-treesitter.configs")
|
|
||||||
|
|
||||||
configs.setup({
|
|
||||||
ensure_installed = { "c", "lua", "vimdoc", "go", "typescript" },
|
|
||||||
highlight = { enable = true },
|
|
||||||
indent = { enable = true }
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user