-- general lvim.log.level = "warn" lvim.colorscheme = "tokyonight" vim.g.tokyonight_style = "night" vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo" vim.opt.undofile = true vim.opt.titlestring = "%t - vim" lvim.builtin.alpha.active = true lvim.builtin.alpha.mode = "dashboard" lvim.builtin.terminal.active = true lvim.builtin.nvimtree.active = false lvim.builtin.treesitter.highlight.enabled = true lvim.lsp.automatic_servers_installation = false vim.g.NERDTreeHijackNetrw = 0 vim.g.lf_replace_netrw = 1 vim.opt.foldmethod = "expr" vim.opt.foldexpr = "nvim_treesitter#foldexpr()" lvim.format_on_save = false vim.g.vimwiki_ext2syntax = { ['.Rmd'] = 'markdown', ['.rmd'] = 'markdown', ['.md'] = 'markdown', ['.markdown'] = 'markdown', ['.mdown'] = 'markdown' } vim.g.vimwiki_list = { { ['path'] = '~/Documents/vimwiki', ['syntax'] = 'markdown', ['ext'] = '.md' } } local formatters = require "lvim.lsp.null-ls.formatters" formatters.setup { { command = "black", filetypes = { "python" } }, } -- Autocommands (https://neovim.io/doc/user/autocmd.html) vim.api.nvim_create_autocmd("FileType", { pattern = "zsh", callback = function() require("nvim-treesitter.highlight").attach(0, "bash") end }) vim.api.nvim_create_autocmd("ColorScheme", { pattern = "*", callback = function() vim.cmd("hi FloatermBorder guibg=none") end }) -- Lualine 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 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 }, } -- 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", }, { "folke/todo-comments.nvim", event = "BufRead", config = function() require("todo-comments").setup {} end, }, { "felipec/vim-sanegx", event = "BufRead", }, { "ptzz/lf.vim", requires = "voldikss/vim-floaterm", }, { "vimwiki/vimwiki" } } -- keymappings [view all the defaults by pressing Lk] lvim.leader = "space" lvim.keys.insert_mode = { [""] = ":wa", [""] = ":bd", [""] = "" } lvim.keys.normal_mode = { [""] = ":w", [""] = ":bd", [""] = ":bn", [""] = ":bp" } lvim.keys.term_mode = { [""] = ":bd", [""] = ":bn", [""] = ":bp" } lvim.keys.visual_mode = { [""] = ":w", [""] = ":bd", ["<"] = ""] = ">gv", } lvim.keys.visual_block_mode = { [""] = ":w", [""] = ":bd", ["K"] = ":move '<-2gv-gv", ["J"] = ":move '>+1gv-gv", } lvim.builtin.which_key.mappings = { [";"] = { "Alpha", "Dashboard" }, ["/"] = { "lua require('Comment.api').toggle_current_linewise()", "Comment" }, ["f"] = { require("lvim.core.telescope.custom-finders").find_project_files, "Find File" }, ["h"] = { "nohlsearch", "No Highlight" }, ["e"] = { "Lf", "List Files" }, b = { name = "Buffers", j = { "BufferLinePick", "Jump" }, f = { "Telescope buffers", "Find" }, b = { "BufferLineCyclePrev", "Previous" }, -- w = { "BufferWipeout", "Wipeout" }, -- TODO: implement this for bufferline e = { "BufferLinePickClose", "Pick which buffer to close", }, h = { "BufferLineCloseLeft", "Close all to the left" }, l = { "BufferLineCloseRight", "Close all to the right", }, D = { "BufferLineSortByDirectory", "Sort by directory", }, L = { "BufferLineSortByExtension", "Sort by language", }, }, p = { name = "Packer", c = { "PackerCompile", "Compile" }, i = { "PackerInstall", "Install" }, r = { "lua require('lvim.plugin-loader').recompile()", "Re-compile" }, s = { "PackerSync", "Sync" }, S = { "PackerStatus", "Status" }, u = { "PackerUpdate", "Update" }, }, -- " Available Debug Adapters: -- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/ -- " Adapter configuration and installation instructions: -- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation -- " Debug Adapter protocol: -- " https://microsoft.github.io/debug-adapter-protocol/ -- " Debugging g = { name = "Git", j = { "lua require 'gitsigns'.next_hunk()", "Next Hunk" }, k = { "lua require 'gitsigns'.prev_hunk()", "Prev Hunk" }, l = { "lua require 'gitsigns'.blame_line()", "Blame" }, p = { "lua require 'gitsigns'.preview_hunk()", "Preview Hunk" }, r = { "lua require 'gitsigns'.reset_hunk()", "Reset Hunk" }, R = { "lua require 'gitsigns'.reset_buffer()", "Reset Buffer" }, s = { "lua require 'gitsigns'.stage_hunk()", "Stage Hunk" }, u = { "lua require 'gitsigns'.undo_stage_hunk()", "Undo Stage Hunk", }, o = { "Telescope git_status", "Open changed file" }, b = { "Telescope git_branches", "Checkout branch" }, c = { "Telescope git_commits", "Checkout commit" }, C = { "Telescope git_bcommits", "Checkout commit(for current file)", }, d = { "Gitsigns diffthis HEAD", "Git Diff", }, }, l = { name = "LSP", a = { "lua vim.lsp.buf.code_action()", "Code Action" }, d = { "Telescope diagnostics bufnr=0 theme=get_ivy", "Buffer Diagnostics" }, w = { "Telescope diagnostics", "Diagnostics" }, f = { require("lvim.lsp.utils").format, "Format" }, i = { "LspInfo", "Info" }, I = { "LspInstallInfo", "Installer Info" }, j = { vim.diagnostic.goto_next, "Next Diagnostic", }, k = { vim.diagnostic.goto_prev, "Prev Diagnostic", }, l = { vim.lsp.codelens.run, "CodeLens Action" }, p = { name = "Peek", d = { "lua require('lvim.lsp.peek').Peek('definition')", "Definition" }, t = { "lua require('lvim.lsp.peek').Peek('typeDefinition')", "Type Definition" }, i = { "lua require('lvim.lsp.peek').Peek('implementation')", "Implementation" }, }, q = { vim.diagnostic.setloclist, "Quickfix" }, r = { vim.lsp.buf.rename, "Rename" }, s = { "Telescope lsp_document_symbols", "Document Symbols" }, S = { "Telescope lsp_dynamic_workspace_symbols", "Workspace Symbols", }, e = { "Telescope quickfix", "Telescope Quickfix" }, }, L = { name = "LunarVim", c = { "edit " .. get_config_dir() .. "/config.lua", "Edit config.lua", }, f = { "lua require('lvim.core.telescope.custom-finders').find_lunarvim_files()", "Find LunarVim files", }, g = { "lua require('lvim.core.telescope.custom-finders').grep_lunarvim_files()", "Grep LunarVim files", }, k = { "Telescope keymaps", "View LunarVim's keymappings" }, i = { "lua require('lvim.core.info').toggle_popup(vim.bo.filetype)", "Toggle LunarVim Info", }, I = { "lua require('lvim.core.telescope.custom-finders').view_lunarvim_changelog()", "View LunarVim's changelog", }, l = { name = "+logs", d = { "lua require('lvim.core.terminal').toggle_log_view(require('lvim.core.log').get_path())", "view default log", }, D = { "lua vim.fn.execute('edit ' .. require('lvim.core.log').get_path())", "Open the default logfile", }, l = { "lua require('lvim.core.terminal').toggle_log_view(vim.lsp.get_log_path())", "view lsp log", }, L = { "lua vim.fn.execute('edit ' .. vim.lsp.get_log_path())", "Open the LSP logfile" }, n = { "lua require('lvim.core.terminal').toggle_log_view(os.getenv('NVIM_LOG_FILE'))", "view neovim log", }, N = { "edit $NVIM_LOG_FILE", "Open the Neovim logfile" }, p = { "lua require('lvim.core.terminal').toggle_log_view(get_cache_dir() .. '/packer.nvim.log')", "view packer log", }, P = { "edit $LUNARVIM_CACHE_DIR/packer.nvim.log", "Open the Packer logfile" }, }, n = { "Telescope notify", "View Notifications" }, r = { "LvimReload", "Reload LunarVim's configuration" }, u = { "LvimUpdate", "Update LunarVim" }, }, s = { name = "Search", b = { "Telescope git_branches", "Checkout branch" }, c = { "Telescope colorscheme", "Colorscheme" }, f = { "Telescope find_files", "Find File" }, h = { "Telescope help_tags", "Find Help" }, H = { "Telescope highlights", "Find highlight groups" }, M = { "Telescope man_pages", "Man Pages" }, r = { "Telescope oldfiles", "Open Recent File" }, R = { "Telescope registers", "Registers" }, t = { "Telescope live_grep", "Text" }, k = { "Telescope keymaps", "Keymaps" }, C = { "Telescope commands", "Commands" }, p = { "lua require('telescope.builtin.internal').colorscheme({enable_preview = true})", "Colorscheme with Preview", }, }, T = { name = "Treesitter", i = { ":TSConfigInfo", "Info" }, }, w = { name = "VimWiki" }, z = { name = "Folding" } }