173 lines
5.5 KiB
Lua
173 lines
5.5 KiB
Lua
-- general
|
|
lvim.log.level = "warn"
|
|
lvim.colorscheme = "tokyonight"
|
|
lvim.transparent_window = true
|
|
vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo"
|
|
vim.opt.undofile = true
|
|
vim.opt.titlestring = "%<%F%=%l/%L - nvim"
|
|
|
|
-- Lualine
|
|
lvim.builtin.lualine.style = "none"
|
|
local components = require "lvim.core.lualine.components"
|
|
local colors = require "lvim.core.lualine.colors"
|
|
components.scrollbar = {
|
|
function()
|
|
local current_line = vim.fn.line "."
|
|
local total_lines = vim.fn.line "$"
|
|
local chars = { "", "", "", "", "", "", "", "", "", "", "", "", "" }
|
|
-- local chars = { "⠁", "⠉", "⠋", "⠛", "⠟", "⠿" }
|
|
-- local chars = { "▒░░░░", "█▒░░░", "▒█▒░░", "░▒█▒░",
|
|
-- "░░▒█▒", "░░░▒█", "░░░░▒" }
|
|
local line_ratio = current_line / total_lines
|
|
local index = math.ceil(line_ratio * #chars)
|
|
return chars[index]
|
|
end,
|
|
color = { fg = colors.yellow },
|
|
cond = nil,
|
|
}
|
|
lvim.builtin.lualine.options = {
|
|
component_separators = { left = '', right = '' },
|
|
section_separators = { left = '', right = '' },
|
|
}
|
|
lvim.builtin.lualine.sections = {
|
|
lualine_a = { components.filename },
|
|
lualine_b = { components.scrollbar, components.location },
|
|
lualine_c = { components.branch, components.diff },
|
|
lualine_x = { components.python_env, components.spaces },
|
|
lualine_y = { components.treesitter, components.diagnostics, components.lsp },
|
|
lualine_z = { components.encoding, components.filetype },
|
|
}
|
|
|
|
|
|
-- keymappings [view all the defaults by pressing <leader>Lk]
|
|
lvim.leader = "space"
|
|
-- add your own keymapping
|
|
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
|
|
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
|
|
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
|
|
local _, actions = pcall(require, "telescope.actions")
|
|
lvim.builtin.telescope.defaults.mappings = {
|
|
-- for input mode
|
|
i = {
|
|
["<C-j>"] = actions.move_selection_next,
|
|
["<C-k>"] = actions.move_selection_previous,
|
|
["<C-n>"] = actions.cycle_history_next,
|
|
["<C-p>"] = actions.cycle_history_prev,
|
|
},
|
|
-- for normal mode
|
|
n = {
|
|
["<C-j>"] = actions.move_selection_next,
|
|
["<C-k>"] = actions.move_selection_previous,
|
|
},
|
|
}
|
|
|
|
lvim.builtin.which_key.mappings["e"] = { "<cmd>LfNewTab<CR>", "Explorer" }
|
|
|
|
-- Use which-key to add extra bindings with the leader-key prefix
|
|
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
|
|
-- lvim.builtin.which_key.mappings["t"] = {
|
|
-- name = "+Trouble",
|
|
-- r = { "<cmd>Trouble lsp_references<cr>", "References" },
|
|
-- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
|
|
-- d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
|
|
-- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
|
|
-- l = { "<cmd>Trouble loclist<cr>", "LocationList" },
|
|
-- w = { "<cmd>Trouble workspace_diagnostics<cr>", "Wordspace Diagnostics" },
|
|
-- }
|
|
|
|
lvim.builtin.alpha.active = true
|
|
lvim.builtin.alpha.mode = "dashboard"
|
|
lvim.builtin.notify.active = true
|
|
lvim.builtin.terminal.active = true
|
|
lvim.builtin.nvimtree.setup.view.side = "left"
|
|
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
|
|
|
|
-- if you don't want all the parsers change this to a table of the ones you want
|
|
lvim.builtin.treesitter.ensure_installed = {
|
|
"bash",
|
|
"c",
|
|
"json",
|
|
"lua",
|
|
"python",
|
|
"yaml",
|
|
}
|
|
|
|
lvim.builtin.treesitter.highlight.enabled = true
|
|
|
|
-- generic LSP settings
|
|
lvim.lsp.automatic_servers_installation = false
|
|
|
|
-- set a formatter, this will override the language server formatting capabilities (if it exists)
|
|
local formatters = require "lvim.lsp.null-ls.formatters"
|
|
formatters.setup {
|
|
{ command = "black", filetypes = { "python" } },
|
|
}
|
|
|
|
-- -- set additional linters
|
|
-- local linters = require "lvim.lsp.null-ls.linters"
|
|
-- linters.setup {
|
|
-- { command = "flake8", filetypes = { "python" } },
|
|
-- }
|
|
|
|
-- Additional Plugins
|
|
lvim.plugins = {
|
|
{ "folke/tokyonight.nvim" },
|
|
{ "nacro90/numb.nvim",
|
|
event = "BufRead",
|
|
config = function()
|
|
require("numb").setup {
|
|
show_numbers = true,
|
|
show_cursorline = true,
|
|
}
|
|
end,
|
|
},
|
|
{ "sindrets/diffview.nvim",
|
|
event = "BufRead",
|
|
},
|
|
{ "metakirby5/codi.vim",
|
|
cmd = "Codi",
|
|
},
|
|
{ "folke/todo-comments.nvim",
|
|
event = "BufRead",
|
|
config = function()
|
|
require("todo-comments").setup()
|
|
end,
|
|
},
|
|
{ "tpope/vim-repeat" },
|
|
{
|
|
"felipec/vim-sanegx",
|
|
event = "BufRead",
|
|
},
|
|
-- { "tpope/vim-surround",
|
|
-- keys = { "c", "d", "y" },
|
|
-- -- make sure to change the value of `timeoutlen` if it's not triggering correctly, see https://github.com/tpope/vim-surround/issues/117
|
|
-- setup = function()
|
|
-- vim.opt.timeoutlen = 500
|
|
-- end
|
|
-- },
|
|
{ "ptzz/lf.vim",
|
|
config = function()
|
|
vim.api.nvim_set_var("NERDTreeHijackNetrw", 0)
|
|
vim.api.nvim_set_var("lf_replace_netrw", 1)
|
|
vim.api.nvim_set_var("lf_command_override", 'lf -command "set nopreview" -command "set hidden"')
|
|
end,
|
|
},
|
|
{ "voldikss/vim-floaterm" },
|
|
{ "oberblastmeister/neuron.nvim" },
|
|
}
|
|
|
|
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = "zsh",
|
|
callback = function()
|
|
-- let treesitter use bash highlight for zsh files as well
|
|
require("nvim-treesitter.highlight").attach(0, "bash")
|
|
end
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
|
pattern = "*",
|
|
callback = function()
|
|
vim.cmd("hi FloatermBorder guibg=none")
|
|
end
|
|
})
|