nix fmt to update lua files
This commit is contained in:
parent
330feb587f
commit
2fd7a24284
6 changed files with 219 additions and 219 deletions
|
@ -8,13 +8,13 @@ vim.g.loaded_netrwPlugin = 1
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
require("nvim-tree").setup()
|
require("nvim-tree").setup()
|
||||||
|
|
||||||
require("lualine").setup {
|
require("lualine").setup({
|
||||||
options = {
|
options = {
|
||||||
theme = "auto",
|
theme = "auto",
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
globalstatus = true,
|
globalstatus = true,
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
require("gitsigns").setup()
|
require("gitsigns").setup()
|
||||||
|
|
||||||
|
@ -34,24 +34,24 @@ opt.showmode = false
|
||||||
opt.mouse = ""
|
opt.mouse = ""
|
||||||
opt.wrap = false
|
opt.wrap = false
|
||||||
|
|
||||||
vim.cmd.colorscheme "iceberg"
|
vim.cmd.colorscheme("iceberg")
|
||||||
|
|
||||||
keymap.set("n", "<space>s", require("nvim-tree.api").tree.toggle, {
|
keymap.set("n", "<space>s", require("nvim-tree.api").tree.toggle, {
|
||||||
desc = "toggle nvim-tree",
|
desc = "toggle nvim-tree",
|
||||||
silent = true,
|
silent = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- shortcut to command mode
|
-- shortcut to command mode
|
||||||
keymap.set({ "n", "x" }, ";", ":", { silent = true })
|
keymap.set({ "n", "x" }, ";", ":", { silent = true })
|
||||||
|
|
||||||
keymap.set("n", "<space>o", "printf('m`%so<ESC>``', v:count1)", {
|
keymap.set("n", "<space>o", "printf('m`%so<ESC>``', v:count1)", {
|
||||||
expr = true,
|
expr = true,
|
||||||
desc = "insert line below without moving cursor",
|
desc = "insert line below without moving cursor",
|
||||||
})
|
})
|
||||||
|
|
||||||
keymap.set("n", "<space>O", "printf('m`%sO<ESC>``', v:count1)", {
|
keymap.set("n", "<space>O", "printf('m`%sO<ESC>``', v:count1)", {
|
||||||
expr = true,
|
expr = true,
|
||||||
desc = "insert line above without moving cursor",
|
desc = "insert line above without moving cursor",
|
||||||
})
|
})
|
||||||
|
|
||||||
keymap.set("n", "/", [[/\v]])
|
keymap.set("n", "/", [[/\v]])
|
||||||
|
@ -65,7 +65,7 @@ keymap.set("x", "p", '"_c<Esc>p')
|
||||||
-- Break inserted text into smaller undo units when we insert some punctuation chars.
|
-- Break inserted text into smaller undo units when we insert some punctuation chars.
|
||||||
local undo_ch = { ",", ".", "!", "?", ";", ":" }
|
local undo_ch = { ",", ".", "!", "?", ";", ":" }
|
||||||
for _, ch in ipairs(undo_ch) do
|
for _, ch in ipairs(undo_ch) do
|
||||||
keymap.set("i", ch, ch .. "<c-g>u")
|
keymap.set("i", ch, ch .. "<c-g>u")
|
||||||
end
|
end
|
||||||
|
|
||||||
keymap.set("i", "<C-A>", "<HOME>")
|
keymap.set("i", "<C-A>", "<HOME>")
|
||||||
|
|
|
@ -8,14 +8,14 @@ keymap.set("n", "<leader>fc", fzf.resume, { silent = true })
|
||||||
keymap.set("n", "<leader>fs", fzf.treesitter, { silent = true })
|
keymap.set("n", "<leader>fs", fzf.treesitter, { silent = true })
|
||||||
keymap.set("n", "<leader>fg", fzf.grep_project, { silent = true })
|
keymap.set("n", "<leader>fg", fzf.grep_project, { silent = true })
|
||||||
|
|
||||||
fzf.setup {
|
fzf.setup({
|
||||||
"fzf-native",
|
"fzf-native",
|
||||||
keymap = {
|
keymap = {
|
||||||
fzf = {
|
fzf = {
|
||||||
["ctrl-u"] = "half-page-up",
|
["ctrl-u"] = "half-page-up",
|
||||||
["ctrl-d"] = "half-page-down",
|
["ctrl-d"] = "half-page-down",
|
||||||
["ctrl-j"] = "preview-page-down",
|
["ctrl-j"] = "preview-page-down",
|
||||||
["ctrl-k"] = "preview-page-up",
|
["ctrl-k"] = "preview-page-up",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
local hop = require('hop')
|
local hop = require("hop")
|
||||||
local keymap = vim.keymap
|
local keymap = vim.keymap
|
||||||
|
|
||||||
hop.setup {
|
hop.setup({
|
||||||
case_insensitive = true;
|
case_insensitive = true,
|
||||||
char2_fallback_key = "<CR>",
|
char2_fallback_key = "<CR>",
|
||||||
quit_key = "<Esc",
|
quit_key = "<Esc",
|
||||||
}
|
})
|
||||||
|
|
||||||
keymap.set({ 'n', 'v', 'o' }, '<C-t>', "", {
|
keymap.set({ "n", "v", "o" }, "<C-t>", "", {
|
||||||
silent = true;
|
silent = true,
|
||||||
noremap = true;
|
noremap = true,
|
||||||
callback = function()
|
callback = function()
|
||||||
hop.hint_char1()
|
hop.hint_char1()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,69 +8,69 @@ keymap.set("n", "gr", lsp.buf.references)
|
||||||
keymap.set("n", "[d", diagnostic.goto_prev)
|
keymap.set("n", "[d", diagnostic.goto_prev)
|
||||||
keymap.set("n", "]d", diagnostic.goto_next)
|
keymap.set("n", "]d", diagnostic.goto_next)
|
||||||
|
|
||||||
diagnostic.config {
|
diagnostic.config({
|
||||||
signs = false,
|
signs = false,
|
||||||
}
|
})
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
lspconfig.pylsp.setup { capabilities = capabilities }
|
lspconfig.pylsp.setup({ capabilities = capabilities })
|
||||||
lspconfig.clangd.setup { capabilities = capabilities }
|
lspconfig.clangd.setup({ capabilities = capabilities })
|
||||||
lspconfig.vimls.setup { capabilities = capabilities }
|
lspconfig.vimls.setup({ capabilities = capabilities })
|
||||||
lspconfig.bashls.setup { capabilities = capabilities }
|
lspconfig.bashls.setup({ capabilities = capabilities })
|
||||||
lspconfig.rust_analyzer.setup {
|
lspconfig.rust_analyzer.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
})
|
||||||
|
|
||||||
lspconfig.gopls.setup {
|
lspconfig.gopls.setup({
|
||||||
settings = {
|
settings = {
|
||||||
gopls = {
|
gopls = {
|
||||||
analyses = {
|
analyses = {
|
||||||
unusedparams = true,
|
unusedparams = true,
|
||||||
},
|
},
|
||||||
staticcheck = true,
|
staticcheck = true,
|
||||||
gofumpt = true,
|
gofumpt = true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
})
|
||||||
|
|
||||||
lspconfig.lua_ls.setup {
|
lspconfig.lua_ls.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_init = function(client)
|
on_init = function(client)
|
||||||
if client.workspace_folders then
|
if client.workspace_folders then
|
||||||
local path = client.workspace_folders[1].name
|
local path = client.workspace_folders[1].name
|
||||||
if vim.uv.fs_stat(path..'/.luarc.json') or vim.uv.fs_stat(path..'/.luarc.jsonc') then
|
if vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- Tell the language server which version of Lua you're using
|
-- Tell the language server which version of Lua you're using
|
||||||
-- (most likely LuaJIT in the case of Neovim)
|
-- (most likely LuaJIT in the case of Neovim)
|
||||||
version = 'LuaJIT'
|
version = "LuaJIT",
|
||||||
},
|
},
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files
|
||||||
workspace = {
|
workspace = {
|
||||||
checkThirdParty = false,
|
checkThirdParty = false,
|
||||||
library = {
|
library = {
|
||||||
vim.env.VIMRUNTIME
|
vim.env.VIMRUNTIME,
|
||||||
-- Depending on the usage, you might want to add additional paths here.
|
-- Depending on the usage, you might want to add additional paths here.
|
||||||
-- "${3rd}/luv/library"
|
-- "${3rd}/luv/library"
|
||||||
-- "${3rd}/busted/library",
|
-- "${3rd}/busted/library",
|
||||||
}
|
},
|
||||||
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
||||||
-- library = vim.api.nvim_get_runtime_file("", true)
|
-- library = vim.api.nvim_get_runtime_file("", true)
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {}
|
Lua = {},
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
lspconfig.nixd.setup { capabilities = capabilities }
|
lspconfig.nixd.setup({ capabilities = capabilities })
|
||||||
lspconfig.sqls.setup { capabilities = capabilities }
|
lspconfig.sqls.setup({ capabilities = capabilities })
|
||||||
lspconfig.hls.setup { capabilities = capabilities }
|
lspconfig.hls.setup({ capabilities = capabilities })
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local luasnip = require("luasnip");
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
require('luasnip').lsp_expand(args.body)
|
require("luasnip").lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = {
|
||||||
["<C-h"] = cmp.mapping.abort(),
|
["<C-h"] = cmp.mapping.abort(),
|
||||||
|
|
||||||
["<C-k>"] = cmp.mapping(function(fallback)
|
["<C-k>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
if luasnip.expandable() then
|
if luasnip.expandable() then
|
||||||
luasnip.expand()
|
luasnip.expand()
|
||||||
else
|
else
|
||||||
cmp.confirm({
|
cmp.confirm({
|
||||||
select = true,
|
select = true,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end),
|
end),
|
||||||
|
|
||||||
["<C-n>"] = cmp.mapping(function(fallback)
|
["<C-n>"] = cmp.mapping(function(fallback)
|
||||||
if luasnip.locally_jumpable(1) then
|
if luasnip.locally_jumpable(1) then
|
||||||
luasnip.jump(1)
|
luasnip.jump(1)
|
||||||
elseif cmp.visible() then
|
elseif cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
|
|
||||||
["<C-p>"] = cmp.mapping(function(fallback)
|
["<C-p>"] = cmp.mapping(function(fallback)
|
||||||
if luasnip.locally_jumpable(-1) then
|
if luasnip.locally_jumpable(-1) then
|
||||||
luasnip.jump(-1)
|
luasnip.jump(-1)
|
||||||
elseif cmp.visible() then
|
elseif cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
},
|
},
|
||||||
sources = cmp.config.sources ({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip" },
|
||||||
}, {
|
}, {
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
})
|
}),
|
||||||
}
|
})
|
||||||
|
|
|
@ -1,99 +1,99 @@
|
||||||
-- 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
|
||||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
vim.api.nvim_echo({
|
vim.api.nvim_echo({
|
||||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
{ out, "WarningMsg" },
|
{ out, "WarningMsg" },
|
||||||
{ "\nPress any key to exit..." },
|
{ "\nPress any key to exit..." },
|
||||||
}, true, {})
|
}, true, {})
|
||||||
vim.fn.getchar()
|
vim.fn.getchar()
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
vim.g.mapleader = ","
|
vim.g.mapleader = ","
|
||||||
|
|
||||||
local plugin_specs = {
|
local plugin_specs = {
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
event = { "BufRead", "BufNewFile" },
|
event = { "BufRead", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
require("config.lsp")
|
require("config.lsp")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
event = 'VeryLazy',
|
event = "VeryLazy",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path",
|
||||||
"hrsh7th/cmp-buffer",
|
"hrsh7th/cmp-buffer",
|
||||||
"hrsh7th/cmp-omni",
|
"hrsh7th/cmp-omni",
|
||||||
"hrsh7th/cmp-cmdline",
|
"hrsh7th/cmp-cmdline",
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("config.nvim-cmp")
|
require("config.nvim-cmp")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
version = "v2.*",
|
version = "v2.*",
|
||||||
build = "make install_jsregexp",
|
build = "make install_jsregexp",
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "stevearc/dressing.nvim", event = "VeryLazy" },
|
{ "stevearc/dressing.nvim", event = "VeryLazy" },
|
||||||
|
|
||||||
{
|
{
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"ibhagwan/fzf-lua",
|
"ibhagwan/fzf-lua",
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
config = function()
|
config = function()
|
||||||
require("config.fzf")
|
require("config.fzf")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "windwp/nvim-autopairs", event = "InsertEnter", config = true },
|
{ "windwp/nvim-autopairs", event = "InsertEnter", config = true },
|
||||||
|
|
||||||
{ "tpope/vim-commentary", event = "VeryLazy" },
|
{ "tpope/vim-commentary", event = "VeryLazy" },
|
||||||
|
|
||||||
{ "folke/tokyonight.nvim", lazy = false, priority = 1000 },
|
{ "folke/tokyonight.nvim", lazy = false, priority = 1000 },
|
||||||
|
|
||||||
{ "lewis6991/gitsigns.nvim"},
|
{ "lewis6991/gitsigns.nvim" },
|
||||||
|
|
||||||
{ "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" } },
|
{ "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" } },
|
||||||
|
|
||||||
{
|
{
|
||||||
'smoka7/hop.nvim',
|
"smoka7/hop.nvim",
|
||||||
version = "*",
|
version = "*",
|
||||||
config = function()
|
config = function()
|
||||||
require("config.hop")
|
require("config.hop")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "cocopon/iceberg.vim" }
|
{ "cocopon/iceberg.vim" },
|
||||||
}
|
}
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
spec = plugin_specs,
|
spec = plugin_specs,
|
||||||
rocks = { enabled = true },
|
rocks = { enabled = true },
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue