Format neovim config with stylua using new stylua.toml config
This commit is contained in:
@@ -4,94 +4,94 @@ local fn = vim.fn
|
|||||||
-- Install packer automagically
|
-- Install packer automagically
|
||||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||||
if fn.empty(fn.glob(install_path)) > 0 then
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
PACKER_BOOTSTRAP = fn.system({
|
PACKER_BOOTSTRAP = fn.system({
|
||||||
"git",
|
"git",
|
||||||
"clone",
|
"clone",
|
||||||
"--depth",
|
"--depth",
|
||||||
"1",
|
"1",
|
||||||
"https://github.com/wbthomason/packer.nvim",
|
"https://github.com/wbthomason/packer.nvim",
|
||||||
install_path,
|
install_path,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
require("packer").startup(function(use)
|
require("packer").startup(function(use)
|
||||||
use({ "wbthomason/packer.nvim" })
|
use({ "wbthomason/packer.nvim" })
|
||||||
|
|
||||||
use({ "nvim-lua/popup.nvim" })
|
use({ "nvim-lua/popup.nvim" })
|
||||||
use({ "nvim-lua/plenary.nvim" })
|
use({ "nvim-lua/plenary.nvim" })
|
||||||
|
|
||||||
-- Colorschemes go here
|
-- Colorschemes go here
|
||||||
use({ "folke/tokyonight.nvim" })
|
use({ "folke/tokyonight.nvim" })
|
||||||
|
|
||||||
-- Make commenting code great
|
-- Make commenting code great
|
||||||
use({ "tpope/vim-commentary" })
|
use({ "tpope/vim-commentary" })
|
||||||
|
|
||||||
-- Icons used by many plugins
|
-- Icons used by many plugins
|
||||||
use({ "kyazdani42/nvim-web-devicons" })
|
use({ "kyazdani42/nvim-web-devicons" })
|
||||||
|
|
||||||
-- Auto pairs plugin that automatically closes brackets and quotes
|
-- Auto pairs plugin that automatically closes brackets and quotes
|
||||||
use({ "windwp/nvim-autopairs" })
|
use({ "windwp/nvim-autopairs" })
|
||||||
|
|
||||||
-- File tree
|
-- File tree
|
||||||
use({ "kyazdani42/nvim-tree.lua" })
|
use({ "kyazdani42/nvim-tree.lua" })
|
||||||
|
|
||||||
-- Treesitter for better syntax highlighting
|
-- Treesitter for better syntax highlighting
|
||||||
use({
|
use({
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
run = ":TSUpdate",
|
run = ":TSUpdate",
|
||||||
{
|
{
|
||||||
{ "JoosepAlviste/nvim-ts-context-commentstring" },
|
{ "JoosepAlviste/nvim-ts-context-commentstring" },
|
||||||
{ "nvim-treesitter/playground" },
|
{ "nvim-treesitter/playground" },
|
||||||
{ "windwp/nvim-ts-autotag" },
|
{ "windwp/nvim-ts-autotag" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Git things
|
-- Git things
|
||||||
use({ "lewis6991/gitsigns.nvim" })
|
use({ "lewis6991/gitsigns.nvim" })
|
||||||
use({ "tpope/vim-fugitive" })
|
use({ "tpope/vim-fugitive" })
|
||||||
|
|
||||||
-- LSP stuff
|
-- LSP stuff
|
||||||
use({ "neovim/nvim-lspconfig" })
|
use({ "neovim/nvim-lspconfig" })
|
||||||
use({ "williamboman/nvim-lsp-installer" })
|
use({ "williamboman/nvim-lsp-installer" })
|
||||||
use({ "jose-elias-alvarez/null-ls.nvim" })
|
use({ "jose-elias-alvarez/null-ls.nvim" })
|
||||||
|
|
||||||
-- Completion, snippets, etc
|
-- Completion, snippets, etc
|
||||||
use({
|
use({
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
{
|
{
|
||||||
{ "hrsh7th/cmp-nvim-lsp" },
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
{ "hrsh7th/cmp-buffer" },
|
{ "hrsh7th/cmp-buffer" },
|
||||||
{ "hrsh7th/cmp-path" },
|
{ "hrsh7th/cmp-path" },
|
||||||
{ "hrsh7th/cmp-cmdline" },
|
{ "hrsh7th/cmp-cmdline" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
use({ "L3MON4D3/LuaSnip", {
|
use({ "L3MON4D3/LuaSnip", {
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
} })
|
} })
|
||||||
|
|
||||||
use({ "nvim-telescope/telescope.nvim" })
|
use({ "nvim-telescope/telescope.nvim" })
|
||||||
|
|
||||||
-- Statusline
|
-- Statusline
|
||||||
use({ "nvim-lualine/lualine.nvim" })
|
use({ "nvim-lualine/lualine.nvim" })
|
||||||
|
|
||||||
-- Highlight todo comments
|
-- Highlight todo comments
|
||||||
use({
|
use({
|
||||||
"folke/todo-comments.nvim",
|
"folke/todo-comments.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
require("todo-comments").setup({})
|
require("todo-comments").setup({})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
use({
|
use({
|
||||||
"folke/trouble.nvim",
|
"folke/trouble.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
require("trouble").setup({})
|
require("trouble").setup({})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
if PACKER_BOOTSTRAP then
|
if PACKER_BOOTSTRAP then
|
||||||
require("packer").sync()
|
require("packer").sync()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
function open_terminal(vertically)
|
function open_terminal(vertically)
|
||||||
vertically = vertically or false
|
vertically = vertically or false
|
||||||
|
|
||||||
if vertically then
|
if vertically then
|
||||||
vim.cmd(":vs term://bash")
|
vim.cmd(":vs term://bash")
|
||||||
else
|
else
|
||||||
vim.cmd(":split term://bash")
|
vim.cmd(":split term://bash")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,40 +1,57 @@
|
|||||||
local tree_cb = require("nvim-tree.config").nvim_tree_callback
|
local tree_cb = require("nvim-tree.config").nvim_tree_callback
|
||||||
local nmap = require("user.utils").nmap
|
local nmap = require("user.utils").nmap
|
||||||
|
|
||||||
require("nvim-tree").setup({
|
vim.g.nvim_tree_show_icons = {
|
||||||
disable_netrw = true,
|
git = 1,
|
||||||
hijack_netrw = true,
|
files = 1,
|
||||||
open_on_setup = true,
|
folders = 1,
|
||||||
hijack_cursor = true,
|
}
|
||||||
open_on_tab = true,
|
vim.g.nvim_tree_icons = {
|
||||||
update_cwd = true,
|
default = "",
|
||||||
auto_close = true,
|
symlink = "",
|
||||||
update_focused_file = {
|
git = {
|
||||||
enable = true,
|
unstaged = "U",
|
||||||
},
|
staged = "S",
|
||||||
view = {
|
unmerged = "M",
|
||||||
width = 30,
|
renamed = "R",
|
||||||
side = "left",
|
untracked = "N",
|
||||||
auto_resize = true,
|
deleted = "D",
|
||||||
mappings = {
|
},
|
||||||
list = {
|
}
|
||||||
{
|
vim.g.nvim_tree_git_hl = 1
|
||||||
key = "<C-t>",
|
|
||||||
cb = tree_cb("tabnew"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filters = {
|
|
||||||
custom = { ".git" },
|
|
||||||
},
|
|
||||||
git = {
|
|
||||||
ignore = false,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.g.nvim_tree_add_trailing = 1
|
vim.g.nvim_tree_add_trailing = 1
|
||||||
vim.g.nvim_tree_indent_markers = 1
|
vim.g.nvim_tree_indent_markers = 1
|
||||||
-- TODO: Change git icons to something similar to vscode
|
|
||||||
|
require("nvim-tree").setup({
|
||||||
|
disable_netrw = true,
|
||||||
|
hijack_netrw = true,
|
||||||
|
open_on_setup = true,
|
||||||
|
hijack_cursor = true,
|
||||||
|
open_on_tab = true,
|
||||||
|
update_cwd = true,
|
||||||
|
auto_close = true,
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
width = 30,
|
||||||
|
side = "left",
|
||||||
|
auto_resize = true,
|
||||||
|
mappings = {
|
||||||
|
list = {
|
||||||
|
{
|
||||||
|
key = "<C-t>",
|
||||||
|
cb = tree_cb("tabnew"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
custom = { ".git" },
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
ignore = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
nmap("<leader>b", ":NvimTreeToggle<CR>")
|
nmap("<leader>b", ":NvimTreeToggle<CR>")
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
require("gitsigns").setup({
|
require("gitsigns").setup({
|
||||||
signcolumn = true,
|
signcolumn = true,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
noremap = true,
|
noremap = true,
|
||||||
|
|
||||||
["n <leader>gs"] = ":Gitsigns stage_hunk<CR>",
|
["n <leader>gs"] = ":Gitsigns stage_hunk<CR>",
|
||||||
["n <leader>gu"] = ":Gitsigns undo_stage_hunk<CR>",
|
["n <leader>gu"] = ":Gitsigns undo_stage_hunk<CR>",
|
||||||
["n <leader>gr"] = ":Gitsigns reset_hunk<CR>",
|
["n <leader>gr"] = ":Gitsigns reset_hunk<CR>",
|
||||||
},
|
},
|
||||||
current_line_blame = true,
|
current_line_blame = true,
|
||||||
current_line_blame_opts = {
|
current_line_blame_opts = {
|
||||||
delay = 1000,
|
delay = 1000,
|
||||||
},
|
},
|
||||||
current_line_blame_formatter_opts = {
|
current_line_blame_formatter_opts = {
|
||||||
relative_time = true,
|
relative_time = true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,129 +4,129 @@ local null_ls = require("null-ls")
|
|||||||
local list_includes_item = require("user.utils").list_includes_item
|
local list_includes_item = require("user.utils").list_includes_item
|
||||||
|
|
||||||
local kind_icons = {
|
local kind_icons = {
|
||||||
Text = "",
|
Text = "",
|
||||||
Method = "",
|
Method = "",
|
||||||
Function = "",
|
Function = "",
|
||||||
Constructor = "",
|
Constructor = "",
|
||||||
Field = "",
|
Field = "",
|
||||||
Variable = "",
|
Variable = "",
|
||||||
Class = "ﴯ",
|
Class = "ﴯ",
|
||||||
Interface = "",
|
Interface = "",
|
||||||
Module = "",
|
Module = "",
|
||||||
Property = "ﰠ",
|
Property = "ﰠ",
|
||||||
Unit = "",
|
Unit = "",
|
||||||
Value = "",
|
Value = "",
|
||||||
Enum = "",
|
Enum = "",
|
||||||
Keyword = "",
|
Keyword = "",
|
||||||
Snippet = "",
|
Snippet = "",
|
||||||
Color = "",
|
Color = "",
|
||||||
File = "",
|
File = "",
|
||||||
Reference = "",
|
Reference = "",
|
||||||
Folder = "",
|
Folder = "",
|
||||||
EnumMember = "",
|
EnumMember = "",
|
||||||
Constant = "",
|
Constant = "",
|
||||||
Struct = "",
|
Struct = "",
|
||||||
Event = "",
|
Event = "",
|
||||||
Operator = "",
|
Operator = "",
|
||||||
TypeParameter = "",
|
TypeParameter = "",
|
||||||
}
|
}
|
||||||
|
|
||||||
local formatting = null_ls.builtins.formatting
|
local formatting = null_ls.builtins.formatting
|
||||||
local diagnostics = null_ls.builtins.diagnostics
|
local diagnostics = null_ls.builtins.diagnostics
|
||||||
|
|
||||||
null_ls.setup({
|
null_ls.setup({
|
||||||
sources = {
|
sources = {
|
||||||
formatting.prettierd,
|
formatting.prettierd,
|
||||||
formatting.stylua,
|
formatting.stylua,
|
||||||
formatting.black,
|
formatting.black,
|
||||||
formatting.gofmt,
|
formatting.gofmt,
|
||||||
formatting.goimports,
|
formatting.goimports,
|
||||||
formatting.shfmt,
|
formatting.shfmt,
|
||||||
},
|
},
|
||||||
on_attach = function()
|
on_attach = function()
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
augroup LspFormatting
|
augroup LspFormatting
|
||||||
autocmd! * <buffer>
|
autocmd! * <buffer>
|
||||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
|
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
|
||||||
augroup END
|
augroup END
|
||||||
]])
|
]])
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Other formats that work weird with null_ls
|
-- Other formats that work weird with null_ls
|
||||||
vim.cmd([[autocmd BufWritePre *.svelte lua vim.lsp.buf.formatting_sync(nil, 1000)]])
|
vim.cmd([[autocmd BufWritePre *.svelte lua vim.lsp.buf.formatting_sync(nil, 1000)]])
|
||||||
|
|
||||||
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-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||||
["<C-space>"] = cmp.mapping(function(fallback)
|
["<C-space>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.close()
|
cmp.close()
|
||||||
else
|
else
|
||||||
cmp.complete()
|
cmp.complete()
|
||||||
end
|
end
|
||||||
end),
|
end),
|
||||||
["<TAB>"] = cmp.mapping.confirm({
|
["<TAB>"] = cmp.mapping.confirm({
|
||||||
select = true,
|
select = true,
|
||||||
behavior = cmp.SelectBehavior.Insert,
|
behavior = cmp.SelectBehavior.Insert,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip" },
|
||||||
}, {
|
}, {
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
}),
|
}),
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = "menu,menuone,noselect,noinsert,preview",
|
completeopt = "menu,menuone,noselect,noinsert,preview",
|
||||||
},
|
},
|
||||||
experimental = {
|
experimental = {
|
||||||
ghost_text = true,
|
ghost_text = true,
|
||||||
},
|
},
|
||||||
sorting = {
|
sorting = {
|
||||||
comparators = {
|
comparators = {
|
||||||
cmp.config.compare.score,
|
cmp.config.compare.score,
|
||||||
cmp.config.compare.sort_text,
|
cmp.config.compare.sort_text,
|
||||||
cmp.config.compare.kind,
|
cmp.config.compare.kind,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
documentation = {
|
documentation = {
|
||||||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||||
zindex = 999,
|
zindex = 999,
|
||||||
format = { "markdown" },
|
format = { "markdown" },
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind)
|
vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind)
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
buffer = "[Buffer]",
|
buffer = "[Buffer]",
|
||||||
luasnip = "[Snippet]",
|
luasnip = "[Snippet]",
|
||||||
nvim_lua = "[Lua]",
|
nvim_lua = "[Lua]",
|
||||||
path = "[File]",
|
path = "[File]",
|
||||||
})[entry.source.name]
|
})[entry.source.name]
|
||||||
|
|
||||||
return vim_item
|
return vim_item
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
cmp.setup.cmdline("/", {
|
cmp.setup.cmdline("/", {
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "cmdline" },
|
{ name = "cmdline" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
cmp.setup.cmdline(":", {
|
cmp.setup.cmdline(":", {
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "cmdline" },
|
{ name = "cmdline" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
@@ -134,47 +134,47 @@ local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protoco
|
|||||||
local lsps_with_disabled_formatting = { "tsserver", "gopls" }
|
local lsps_with_disabled_formatting = { "tsserver", "gopls" }
|
||||||
|
|
||||||
local on_attach = function(client)
|
local on_attach = function(client)
|
||||||
if list_includes_item(lsps_with_disabled_formatting, client.name) then
|
if list_includes_item(lsps_with_disabled_formatting, client.name) then
|
||||||
client.resolved_capabilities.document_formatting = false
|
client.resolved_capabilities.document_formatting = false
|
||||||
client.resolved_capabilities.document_range_formatting = false
|
client.resolved_capabilities.document_range_formatting = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
lsp_installer.on_server_ready(function(server)
|
lsp_installer.on_server_ready(function(server)
|
||||||
local opts = {
|
local opts = {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
}
|
}
|
||||||
|
|
||||||
if server.name == "sumneko_lua" then
|
if server.name == "sumneko_lua" then
|
||||||
local runtime_path = vim.split(package.path, ";")
|
local runtime_path = vim.split(package.path, ";")
|
||||||
table.insert(runtime_path, "lua/?.lua")
|
table.insert(runtime_path, "lua/?.lua")
|
||||||
table.insert(runtime_path, "lua/?/init/lua")
|
table.insert(runtime_path, "lua/?/init/lua")
|
||||||
|
|
||||||
opts.settings = {
|
opts.settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
version = "LuaJIT",
|
version = "LuaJIT",
|
||||||
path = runtime_path,
|
path = runtime_path,
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
},
|
},
|
||||||
telemetry = {
|
telemetry = {
|
||||||
enable = false,
|
enable = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
server:setup(opts)
|
server:setup(opts)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Don't show diagnostics as virtual text
|
-- Don't show diagnostics as virtual text
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
update_in_insert = true,
|
update_in_insert = true,
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
signs = false,
|
signs = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").load()
|
require("luasnip.loaders.from_vscode").load()
|
||||||
|
|||||||
@@ -1,46 +1,46 @@
|
|||||||
local lualine = require("lualine")
|
local lualine = require("lualine")
|
||||||
|
|
||||||
local branch = {
|
local branch = {
|
||||||
"branch",
|
"branch",
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
icon = "",
|
icon = "",
|
||||||
}
|
}
|
||||||
|
|
||||||
local diagnostics = {
|
local diagnostics = {
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
sections = { "error", "warn" },
|
sections = { "error", "warn" },
|
||||||
symbols = { error = " ", warn = " " },
|
symbols = { error = " ", warn = " " },
|
||||||
colored = false,
|
colored = false,
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
always_visible = true,
|
always_visible = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
local mode = {
|
local mode = {
|
||||||
"mode",
|
"mode",
|
||||||
}
|
}
|
||||||
|
|
||||||
local filetype = {
|
local filetype = {
|
||||||
"filetype",
|
"filetype",
|
||||||
}
|
}
|
||||||
|
|
||||||
local location = function()
|
local location = function()
|
||||||
local line, column = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, column = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
|
||||||
return "Ln " .. line .. ", Col " .. column
|
return "Ln " .. line .. ", Col " .. column
|
||||||
end
|
end
|
||||||
|
|
||||||
lualine.setup({
|
lualine.setup({
|
||||||
options = {
|
options = {
|
||||||
disabled_filetypes = { "NvimTree" },
|
disabled_filetypes = { "NvimTree" },
|
||||||
component_separators = { left = "", right = "" },
|
component_separators = { left = "", right = "" },
|
||||||
section_separators = { left = "", right = "" },
|
section_separators = { left = "", right = "" },
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
lualine_a = { branch, diagnostics },
|
lualine_a = { branch, diagnostics },
|
||||||
lualine_b = { mode },
|
lualine_b = { mode },
|
||||||
lualine_c = {},
|
lualine_c = {},
|
||||||
lualine_x = { location },
|
lualine_x = { location },
|
||||||
lualine_y = { "encoding", filetype },
|
lualine_y = { "encoding", filetype },
|
||||||
lualine_z = {},
|
lualine_z = {},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
require("telescope").setup({
|
require("telescope").setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
sorting_strategy = "ascending",
|
sorting_strategy = "ascending",
|
||||||
file_ignore_patterns = { ".git/", "node_modules/" },
|
file_ignore_patterns = { ".git/", "node_modules/" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,13 +2,3 @@ local cmd = vim.cmd
|
|||||||
|
|
||||||
vim.g.tokyonight_style = "night"
|
vim.g.tokyonight_style = "night"
|
||||||
cmd([[colorscheme tokyonight]])
|
cmd([[colorscheme tokyonight]])
|
||||||
|
|
||||||
cmd([[
|
|
||||||
hi NvimTreeGitNew guifg=green
|
|
||||||
hi NvimTreeGitStaged guifg=lightgreen
|
|
||||||
hi NvimTreeGitDeleted guifg=red
|
|
||||||
hi NvimTreeGitDirty guifg=lightblue
|
|
||||||
hi NvimTreeGitMerge guifg=yellow
|
|
||||||
hi NvimTreeGitIgnored guifg=gray
|
|
||||||
hi NvimTreeOpenedFolderName gui=italic,bold
|
|
||||||
]])
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
ensure_installed = "maintained",
|
ensure_installed = "maintained",
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
context_commentstring = {
|
context_commentstring = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local function map(mode, shortcut, command, additional_opts)
|
local function map(mode, shortcut, command, additional_opts)
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
if opts then
|
if opts then
|
||||||
opts = vim.tbl_extend("force", opts, additional_opts)
|
opts = vim.tbl_extend("force", opts, additional_opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_set_keymap(mode, shortcut, command, opts)
|
vim.api.nvim_set_keymap(mode, shortcut, command, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.nmap = function(shortcut, command, opts)
|
M.nmap = function(shortcut, command, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
|
|
||||||
map("n", shortcut, command, opts)
|
map("n", shortcut, command, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.vmap = function(shortcut, command, opts)
|
M.vmap = function(shortcut, command, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
|
|
||||||
map("v", shortcut, command, opts)
|
map("v", shortcut, command, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.tmap = function(shortcut, command, opts)
|
M.tmap = function(shortcut, command, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
|
|
||||||
map("t", shortcut, command, opts)
|
map("t", shortcut, command, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.list_includes_item = function(list, item)
|
M.list_includes_item = function(list, item)
|
||||||
for _, value in pairs(list) do
|
for _, value in pairs(list) do
|
||||||
if value == item then
|
if value == item then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Reference in New Issue
Block a user