diff --git a/.gitignore b/.gitignore index 8b55343..ef02d0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -lazy-lock.json +/plugin/ diff --git a/after/ftplugin/norg.lua b/after/ftplugin/norg.lua deleted file mode 100644 index 806b55a..0000000 --- a/after/ftplugin/norg.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.opt.tabstop = 2 -vim.opt.softtabstop = 2 -vim.opt.shiftwidth = 2 - diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua index eccafd9..54c3930 100644 --- a/after/plugin/colors.lua +++ b/after/plugin/colors.lua @@ -1,110 +1,98 @@ +local palette = { + none = "NONE", + fg = "#E1E1E1", + bg = "#151515", + alt_bg = "#171717", + accent = "#202020", + white = "#E1E1E1", + gray = "#373737", + medium_gray = "#727272", + light_gray = "#AFAFAF", + blue = "#BAD7FF", + gray_blue = "#7E97AB", + medium_gray_blue = "#A2B5C1", + cyan = "#88afa2", + red = "#b46958", + green = "#90A959", + yellow = "#F4BF75", + orange = "#FFA557", + purple = "#AA749F", + magenta = "#AA759F", + cursor_fg = "#151515", + cursor_bg = "#D0D0D0", + sign_add = "#586935", + sign_change = "#51657B", + sign_delete = "#984936", + error = "#984936", + warning = "#ab8550", + info = "#ab8550", + hint = "#576f82", + neogit_light_green = "#2A2E19", + neogit_blue = "#1B1F27", + neogit_green = "#212513", + neogit_light_red = "#402020", + neogit_red = "#351D1D", +} + require("no-clown-fiesta").setup({ transparent = true, }) -require('rose-pine').setup({ - --- @usage 'auto'|'main'|'moon'|'dawn' - variant = 'auto', - --- @usage 'main'|'moon'|'dawn' - dark_variant = 'main', - bold_vert_split = false, - dim_nc_background = false, - disable_background = true, - disable_float_background = false, - disable_italics = true, +vim.cmd[[ +let s:base03 = [ '#151513', 233 ] +let s:base02 = [ '#202020', 236 ] +let s:base01 = [ '#373737', 239 ] +let s:base00 = [ '#727272', 242 ] +let s:base0 = [ '#808070', 244 ] +let s:base1 = [ '#949484', 246 ] +let s:base2 = [ '#a8a897', 248 ] +let s:base3 = [ '#E1E1E1', 253 ] +let s:yellow = [ '#F4BF75', 3 ] +let s:orange = [ '#FFA557', 216 ] +let s:red = [ '#B46958', 131 ] +let s:purple = [ '#AA749F', 181 ] +let s:blue = [ '#7E97AB', 109 ] +let s:cyan = [ '#BAD7FF', 23 ] +let s:green = [ '#90A959', 108 ] +let s:white = [ '#AFAFAF', 252 ] - --- @usage string hex value or named color from rosepinetheme.com/palette - groups = { - background = 'base', - background_nc = '_experimental_nc', - panel = 'surface', - panel_nc = 'base', - border = 'highlight_med', - comment = 'muted', - link = 'iris', - punctuation = 'subtle', +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ] +let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ] +let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base0, s:base02 ] ] +let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ] +let s:p.insert.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ] +let s:p.replace.left = [ [ s:base02, s:purple ], [ s:base3, s:base01 ] ] +let s:p.visual.left = [ [ s:base02, s:red ], [ s:base3, s:base01 ] ] +let s:p.normal.middle = [ [ s:base0, s:base02 ] ] +let s:p.inactive.middle = [ [ s:base00, s:base02 ] ] +let s:p.tabline.left = [ [ s:base3, s:base00 ] ] +let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ] +let s:p.tabline.middle = [ [ s:base01, s:base1 ] ] +let s:p.tabline.right = copy(s:p.normal.right) +let s:p.normal.error = [ [ s:red, s:base02 ] ] +let s:p.normal.warning = [ [ s:yellow, s:base01 ] ] - error = 'love', - hint = 'iris', - info = 'foam', - warn = 'gold', +let g:lightline#colorscheme#mycolors#palette = lightline#colorscheme#flatten(s:p) +let g:lightline = { + \ 'colorscheme': 'mycolors', + \ } - headings = { - h1 = 'iris', - h2 = 'foam', - h3 = 'rose', - h4 = 'gold', - h5 = 'pine', - h6 = 'foam', - } - -- or set all headings at once - -- headings = 'subtle' - }, - - -- Change specific vim highlight groups - -- https://github.com/rose-pine/neovim/wiki/Recipes - highlight_groups = { - ColorColumn = { bg = 'rose' }, - - -- Blend colours against the "base" background - CursorLine = { bg = 'foam', blend = 10 }, - StatusLine = { fg = 'love', bg = 'love', blend = 10 }, - - -- By default each group adds to the existing config. - -- If you only want to set what is written in this config exactly, - -- you can set the inherit option: - Search = { bg = 'gold', inherit = false }, - } -}) - -require("gruvbox").setup({ - undercurl = true, - underline = true, - bold = true, - italic = { - strings = true, - comments = true, - operators = false, - folds = true, - }, - strikethrough = true, - invert_selection = false, - invert_signs = false, - invert_tabline = false, - invert_intend_guides = false, - inverse = true, -- invert background for search, diffs, statuslines and errors - contrast = "", -- can be "hard", "soft" or empty string - palette_overrides = {}, - overrides = {}, - dim_inactive = false, - transparent_mode = true, -}) - -local c = require('vscode.colors').get_colors() -require('vscode').setup({ - -- Alternatively set style in setup - -- style = 'light' - - -- Enable transparent background - transparent = true, - - -- Enable italic comment - italic_comments = true, - - -- Disable nvim-tree background color - disable_nvimtree_bg = true, - - -- Override colors (see ./lua/vscode/colors.lua) - color_overrides = { - -- vscLineNumber = '#FFFFFF', - }, - - -- Override highlight groups (see ./lua/vscode/theme.lua) - group_overrides = { - -- this supports the same val table as vim.api.nvim_set_hl - -- use colors from this colorscheme by requiring vscode.colors! - Cursor = { fg=c.vscDarkBlue, bg=c.vscLightGreen, bold=true }, - } -}) +" Don't need to see mode if lightline is installed +set noshowmode +]] vim.cmd[[colorscheme no-clown-fiesta]] + +-- My own color overrides +local hl = vim.api.nvim_set_hl +hl(0, 'TSConstant', { fg = palette.yellow }) +hl(0, 'EndOfBuffer', { fg = palette.medium_gray }) +hl(0, 'ErrorMsg', { fg = palette.yellow }) +hl(0, 'LineNr', { fg = palette.medium_gray }) +hl(0, 'MasonNormal', { bg = palette.gray }) +hl(0, 'NvimTreeCursorLine', { fg = palette.yellow }) +hl(0, 'NvimTreeEndOfBuffer', { fg = palette.medium_gray }) +hl(0, 'NvimTreeIndentMarker', { fg = palette.medium_gray }) +hl(0, 'NvimTreeFolderIcon', { fg = palette.yellow }) + diff --git a/after/plugin/compile-mode.lua b/after/plugin/compile-mode.lua deleted file mode 100644 index 7eea44a..0000000 --- a/after/plugin/compile-mode.lua +++ /dev/null @@ -1,10 +0,0 @@ -require("compile-mode") - -vim.g.compile_mode = { - beleia_setup = true -} - -vim.keymap.set("n", "cC", vim.cmd.Compile, {desc = "Compile"}) -vim.keymap.set("n", "cc", vim.cmd.Recompile, {desc = "Recompile"}) - - diff --git a/after/plugin/dashboard.lua b/after/plugin/dashboard.lua deleted file mode 100644 index dcf4114..0000000 --- a/after/plugin/dashboard.lua +++ /dev/null @@ -1,50 +0,0 @@ -local alpha = require("alpha") -local dashboard = require("alpha.themes.dashboard") - -local function footer() - local total_plugins = #require("lazy").plugins() - local version = vim.version() - local nvim_version_info = " NVIM v" .. version.major .. "." .. version.minor .. "." .. version.patch - return nvim_version_info .. " 󰏖 " .. total_plugins .. " plugins" -end - --- Set header -dashboard.section.header.val = { - " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ", - " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", - " ⠈ ⠈⢿⣿⣟⠦⠄⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ", - " ⣸⣿⣿⢧⠄⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", - " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", - " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿ ", - " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷⠄ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", - "⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", - "⠙⠃ ⣼⣿⡟⠌ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿⠐⣿⣿⡇ ⠛⠻⢷⣄", - " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ⠁", - " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣀⣤⣾⡿⠃ ", - "⢀⣀⠀⣠⣀⣠⣾⣿⣿⡿⠛⠋⠉⠉⠉ ⠉⠉⠉⠉⠛⠻⣿⣿⣷⣄⣀⢿⡽⢻⣦", - "⠻⠶⠾⠿⠿⠿⠋⠉ N E O V I M ⠉⠻⠿⠿⠿⠿⠿⠋", -} - --- Set menu -dashboard.section.buttons.val = { - dashboard.button( "e", " New file" , ":ene startinsert "), - dashboard.button( "q", "󰩈 Quit NVIM", ":qa"), -} - -vim.api.nvim_create_autocmd("VimEnter", { - once = true, - callback = function() - math.randomseed(os.time()) - local fg_color = tostring(math.random(0, 12)) - local hi_setter = "hi AlphaHeader ctermfg=" - vim.cmd(hi_setter .. fg_color) - end -}) - -dashboard.section.footer.val = footer() - -dashboard.section.header.opts.hl = "Include" -dashboard.section.footer.opts.hl = "String" - -alpha.setup(dashboard.opts) - diff --git a/after/plugin/firenvim.lua b/after/plugin/firenvim.lua index fb14f4b..d937c09 100644 --- a/after/plugin/firenvim.lua +++ b/after/plugin/firenvim.lua @@ -7,7 +7,7 @@ vim.g.firenvim_config = { priority = 0, selector = "textarea", takeover = "never" - }, + } } } @@ -16,8 +16,3 @@ if vim.g.started_by_firenvim == true then vim.opt.scrolloff = 0 end -vim.api.nvim_create_autocmd({'BufEnter'}, { - pattern = "localhost_*.txt", - command = "set filetype=python" -}) - diff --git a/after/plugin/fugative.lua b/after/plugin/fugative.lua index 9aa8d81..435d82a 100644 --- a/after/plugin/fugative.lua +++ b/after/plugin/fugative.lua @@ -1,4 +1,2 @@ -local wk = require("which-key") +vim.keymap.set("n", "gs", vim.cmd.Git) --- wk.add({g = { name = "git" }, prefix = ""}) -vim.keymap.set("n", "gs", vim.cmd.Git, { desc = "Git status" }) diff --git a/after/plugin/lf.lua b/after/plugin/lf.lua deleted file mode 100644 index 58a2922..0000000 --- a/after/plugin/lf.lua +++ /dev/null @@ -1,4 +0,0 @@ --- vim.keymap.set("n", "e", function () --- vim.cmd("Lf") --- end) - diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 3f81649..9ec1ef8 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -1,108 +1,64 @@ --- LANGUAGE SERVERS -local lsp_zero = require('lsp-zero') -local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities() +local lsp = require('lsp-zero') +lsp.preset('recommended') -lsp_zero.on_attach(function(client, bufnr) - -- see :help lsp-zero-keybindings - -- to learn the available actions - lsp_zero.default_keymaps({buffer = bufnr}) -end) +lsp.ensure_installed({ + "lua_ls", -- Lua + "rust_analyzer", -- Rust + "pyright", -- Python + "texlab", -- Latex + "clangd", -- C + "jdtls", -- Java + "html", -- Html + "bashls", -- Bash +}) --- LUA -vim.lsp.config('lua_ls', { - settings = { - Lua = { - diagnostics = { - -- Making sure that lua recognizes the global variable 'vim' - globals = { 'vim', 'xplr' }, - }, +local ensure_installed_extras = { +} + +local cmp = require("cmp") +local cmp_select = {behavior = cmp.SelectBehavior.Select} +local cmp_mappings = lsp.defaults.cmp_mappings({ + [""] = cmp.mapping.select_prev_item(cmp_select), + [""] = cmp.mapping.select_next_item(cmp_select), + [""] = cmp.mapping.confirm({ select = true }), +}) + +lsp.set_preferences({ + sign_icons = { } +}) + +lsp.setup_nvim_cmp({ + mapping = cmp_mappings +}) + +lsp.configure('lua_ls', { + settings = { + Lua = { + diagnostics = { + -- Making sure that lua recognizes the global variable 'vim' + globals = { 'vim' }, + }, + }, }, - }, }) -vim.lsp.enable('lua_ls') -vim.g.zig_fmt_autosave = 0 - --- RUST --- Must run `rustup default stable` and then `rustup component add rust-analyzer` --- upon first install -vim.lsp.config('rust_analyzer', {}) -vim.lsp.enable('rust_analyzer') - -vim.lsp.config('clangd', { - capabilities = lsp_capabilities, -}) -vim.lsp.enable('clangd') - -vim.lsp.config('gopls', { - settings = { - gopls = { - analyses = { - unusedparams = true, - }, - staticcheck = true, - gofumpt = true, +lsp.configure('pyright', { + settings = { + python = { + analysis = { + typeCheckingMode = "off", + }, + }, }, - }, -}) -vim.lsp.enable('gopls') - -vim.lsp.config('pylsp', { - settings = { - pylsp = { - pylint = { enabled = true, executable = "pylint" }, - }, - }, -}) -vim.lsp.enable('pylsp') - -vim.keymap.set("n", "gf", ":GoFmt", - { noremap = true, silent = true, desc = "Go Format" } -) - --- AUTOCOMPLETION - -local cmp = require('cmp') -local cmp_action = require('lsp-zero').cmp_action() - -cmp.setup({ - sources = { - { name = "luasnip", option = { show_autosnippets = true } }, - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "path" }, -- Auto complete paths - }, - mapping = { - -- Navigate between completion item - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - - -- toggle completion - [''] = cmp_action.toggle_completion(), - - -- navigate between snippet placeholder - [''] = cmp_action.luasnip_jump_backward(), - [''] = cmp_action.luasnip_jump_forward(), - - -- Confirm item - [''] = cmp.mapping.confirm({select = true}), - } }) --- Show all diagnostics on current line in floating window -vim.keymap.set("n", "gl", ":lua vim.diagnostic.open_float()", - { noremap = true, silent = true }) +lsp.setup() -vim.keymap.set("n", "le", ":LspStop", - { desc = "LSP Stop" }) - -vim.keymap.set("n", "ls", ":LspStart", - { desc = "LSP Start" }) - -vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, - { desc = "Jump to definition" }) -vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, - { desc = "Jump to declaration" }) -vim.keymap.set("n", "gt", function() vim.lsp.buf.type_definition() end, - { desc = "Jump to type definition" }) +-- Install extra packages (linters, formatters, et c) +local registry = require("mason-registry") +for _, extra in ipairs(ensure_installed_extras) do + if not registry.is_installed(extra) then + vim.cmd(string.format("MasonInstall %s", extra)) + end +end diff --git a/after/plugin/lualine.lua b/after/plugin/lualine.lua deleted file mode 100644 index 7c57699..0000000 --- a/after/plugin/lualine.lua +++ /dev/null @@ -1,14 +0,0 @@ -require("lualine").setup({ - sections = { - lualine_a = {'mode'}, - lualine_b = {'tabs', 'filename'}, - lualine_c = {'branch', 'diff', 'diagnostics'}, - lualine_x = {'encoding', 'filetype'}, - lualine_y = {'progress'}, - lualine_z = {'location'} - }, -}) - -vim.cmd[[set showtabline=0]] -vim.cmd[[set noshowmode]] - diff --git a/after/plugin/markdownpreview.lua b/after/plugin/markdownpreview.lua index 4b25bcb..26edc76 100644 --- a/after/plugin/markdownpreview.lua +++ b/after/plugin/markdownpreview.lua @@ -1,8 +1,7 @@ -vim.keymap.set("n", "mp", "MarkdownPreview", - { desc = "Markdown prewview" }) - vim.cmd([[ +nmap mp MarkdownPreview + " set to 1, nvim will open the preview window after entering the markdown buffer " default: 0 let g:mkdp_auto_start = 0 @@ -39,7 +38,7 @@ let g:mkdp_open_ip = '' " valid: `/path/with\ space/xxx` " invalid: `/path/with\\ space/xxx` " default: '' -let g:mkdp_browser = 'zen' +let g:mkdp_browser = 'thorium-browser' " set to 1, echo preview page url in command line when open preview page " default is 0 diff --git a/after/plugin/nvimtree.lua b/after/plugin/nvimtree.lua index c7fb634..c015d85 100644 --- a/after/plugin/nvimtree.lua +++ b/after/plugin/nvimtree.lua @@ -1,10 +1,10 @@ --- -- set termguicolors to enable highlight groups --- vim.opt.termguicolors = true --- --- require("nvim-tree").setup() --- --- vim.keymap.set("n", "pt", vim.cmd.NvimTreeToggle) --- --- -- sets transparent background --- vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]] --- +-- set termguicolors to enable highlight groups +vim.opt.termguicolors = true + +require("nvim-tree").setup() + +vim.keymap.set("n", "pt", ":NvimTreeToggle") + +-- sets transparent background +vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]] + diff --git a/after/plugin/possession.lua b/after/plugin/possession.lua deleted file mode 100644 index 073d642..0000000 --- a/after/plugin/possession.lua +++ /dev/null @@ -1,9 +0,0 @@ -require("possession").setup({}) - -require('telescope').load_extension('possession') -vim.keymap.set("n", "pp", ":Telescope possession list", - { desc = "List neovim sessions" }) - -vim.keymap.set("n", "ss", ":PossessionSave", - { desc = "Save session" }) - diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 62cdf66..2616dc6 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,4 +1,8 @@ local builtin = require("telescope.builtin") +vim.keymap.set("n", "pf", builtin.find_files, {}) +vim.keymap.set("n", "ps", function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end) require("telescope").setup{ defaults = { @@ -6,24 +10,3 @@ require("telescope").setup{ } } -vim.keymap.set("n", "p", "", {desc = "Project"}) -vim.keymap.set("n", "pf", ":Telescope find_files no_ignore=true ", {desc = "Project find"}) -vim.keymap.set("n", ".", builtin.find_files, {desc = "Project find (.gitignore)"}) -vim.keymap.set("n", "ps", - function () - builtin.grep_string({ search = vim.fn.input("Grep > "), no_ignore = true }) - end, - { desc = "Project search" }) - --- f --- wk.add({f = { name = "find" }, prefix = ""}) -vim.keymap.set("n", "fr", builtin.oldfiles, { desc = "Find recent" }) - --- h --- wk.add({h = { name = "help" }, prefix = ""}) -vim.keymap.set("n", "ht", builtin.colorscheme, { desc = "Load theme" }) -vim.keymap.set("n", "hf", builtin.commands , { desc = "Describe function" }) -vim.keymap.set("n", "hk", builtin.keymaps , { desc = "Describe key" }) -vim.keymap.set("n", "hv", builtin.vim_options, { desc = "Describe variable" }) -vim.keymap.set("n", "hh", builtin.help_tags , { desc = "Search local wiki" }) - diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index 2dbaa74..a4881fb 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -1,22 +1,5 @@ require'nvim-treesitter.configs'.setup { - ensure_installed = { - "c", - "css", - "glsl", - "go", - "html", - "java", - "javascript", - "json", - "lua", - "perl", - "php", - "python", - "rust", - "typst", - "vim", - "vimdoc", - }, + ensure_installed = { "rust", "vim", "javascript", "html", "css", "python", "java", "lua", "perl", "php", "c", "json" }, ignore_install = { "latex", "markdown", "htmldjango" }, @@ -31,10 +14,3 @@ require'nvim-treesitter.configs'.setup { }, } -vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { - pattern = {"*.vert", "*.frag"}, - callback = function() - vim.bo.filetype = "glsl" - end, -}) - diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua deleted file mode 100644 index 48822a4..0000000 --- a/after/plugin/undotree.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.keymap.set("n", "ut", vim.cmd.UndotreeToggle) - diff --git a/after/plugin/whichkey.lua b/after/plugin/whichkey.lua deleted file mode 100644 index 07541e0..0000000 --- a/after/plugin/whichkey.lua +++ /dev/null @@ -1,17 +0,0 @@ -require("which-key").setup({ - win = { - border = "single", -- none, single, double, shadow - padding = { 0, 0, 0, 0 }, -- extra window padding [top, right, bottom, left] - zindex = 1000, -- positive value to position WhichKey above other floating windows. - wo = { - winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent - }, - }, - layout = { - height = { min = 4, max = 25 }, -- min and max height of the columns - width = { min = 20, max = 50 }, -- min and max width of the columns - spacing = 3, -- spacing between columns - align = "left", -- align columns left, center or right - }, -}) - diff --git a/after/plugin/yazi.lua b/after/plugin/yazi.lua deleted file mode 100644 index 2fdf5ca..0000000 --- a/after/plugin/yazi.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.keymap.set("n", "e", function () - vim.cmd("Yazi") -end) - diff --git a/after/plugin/zenmode.lua b/after/plugin/zenmode.lua deleted file mode 100644 index 5459116..0000000 --- a/after/plugin/zenmode.lua +++ /dev/null @@ -1,62 +0,0 @@ -require('zen-mode').setup { - window = { - backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal - -- height and width can be: - -- * an absolute number of cells when > 1 - -- * a percentage of the width / height of the editor when <= 1 - -- * a function that returns the width or the height - width = 120, -- width of the Zen window - height = 1, -- height of the Zen window - -- by default, no options are changed for the Zen window - -- uncomment any of the options below, or add other vim.wo options you want to apply - options = { - signcolumn = "no", -- disable signcolumn - number = false, -- disable number column - relativenumber = false, -- disable relative numbers - cursorline = false, -- disable cursorline - cursorcolumn = false, -- disable cursor column - foldcolumn = "0", -- disable fold column - -- list = false, -- disable whitespace characters - }, - }, - plugins = { - -- disable some global vim options (vim.o...) - -- comment the lines to not apply the options - options = { - enabled = true, - ruler = false, -- disables the ruler text in the cmd line area - showcmd = false, -- disables the command in the last line of the screen - }, - twilight = { enabled = true }, -- enable to start Twilight when zen mode opens - gitsigns = { enabled = false }, -- disables git signs - tmux = { enabled = false }, -- disables the tmux statusline - -- this will change the font size on kitty when in zen mode - -- to make this work, you need to set the following kitty options: - -- - allow_remote_control socket-only - -- - listen_on unix:/tmp/kitty - kitty = { - enabled = false, - font = "+4", -- font size increment - }, - -- this will change the font size on alacritty when in zen mode - -- requires Alacritty Version 0.10.0 or higher - -- uses `alacritty msg` subcommand to change font size - alacritty = { - enabled = false, - font = "14", -- font size - }, - -- this will change the font size on wezterm when in zen mode - -- See alse also the Plugins/Wezterm section in this projects README - wezterm = { - enabled = false, - -- can be either an absolute font size or the number of incremental steps - font = "+4", -- (10% increase per step) - }, - }, - -- callback where you can add custom code when the Zen window opens - on_open = function(win) - end, - -- callback where you can add custom code when the Zen window closes - on_close = function() - end, -} diff --git a/init.lua b/init.lua old mode 100644 new mode 100755 diff --git a/lua/andrew/init.lua b/lua/andrew/init.lua index 375ca3c..180a9a4 100644 --- a/lua/andrew/init.lua +++ b/lua/andrew/init.lua @@ -1,4 +1,4 @@ require("andrew.remap") -require("andrew.lazy") +require("andrew.packer") require("andrew.set") diff --git a/lua/andrew/lazy.lua b/lua/andrew/lazy.lua deleted file mode 100644 index 520a1b3..0000000 --- a/lua/andrew/lazy.lua +++ /dev/null @@ -1,156 +0,0 @@ --- Bootstrap lazy.nvim -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - --- Make sure to setup `mapleader` and `maplocalleader` before --- loading lazy.nvim so that mappings are correct. --- This is also a good place to setup other settings (vim.opt) -vim.g.mapleader = " " -vim.g.maplocalleader = "\\" - --- Setup lazy.nvim -require("lazy").setup({ - -- Terminal file manager support - -- "DreamMaoMao/yazi.nvim", - { - "mikavilpas/yazi.nvim", - event = "VeryLazy", - }, - - -- Markdown preview - { - "iamcco/markdown-preview.nvim", - cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' }, - ft = { 'markdown' }, - build = function() - vim.cmd [[Lazy load markdown-preview.nvim]] - vim.fn['mkdp#util#install']() - end, - }, - - -- Dashboard buffer - { - "goolord/alpha-nvim", - -- dependencies = { 'echasnovski/mini.icons' }, - dependencies = { 'nvim-tree/nvim-web-devicons' }, - }, - - -- Compile mode - { - "ej-shafran/compile-mode.nvim", - -- tag = "v5.*", - -- you can just use the latest version: - branch = "latest", - -- or the most up-to-date updates: - -- branch = "nightly", - dependencies = { - "nvim-lua/plenary.nvim", - { "m00qek/baleia.nvim", tag = "v1.3.0" }, - }, - config = function() - vim.g.compile_mode = { - baleia_setup = true, - } - end - }; - - -- Zen mode - "folke/zen-mode.nvim", - - -- Show valid keys mid key chord - "folke/which-key.nvim", - -- config = function() - -- vim.o.timeout = true - -- vim.o.timeoutlen = 300 - -- end - - -- Find files and strings - { - 'nvim-telescope/telescope.nvim', tag = '0.1.8', - dependencies = { 'nvim-lua/plenary.nvim' }, - }, - - { - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate" - }, - - -- Themes - "aktersnurra/no-clown-fiesta.nvim", - "ellisonleao/gruvbox.nvim", - { 'rose-pine/neovim', as = 'rose-pine' }, - 'Mofiqul/vscode.nvim', - - -- Referencing a hex code highlights it in that color - "norcalli/nvim-colorizer.lua", - - -- Relative line numbers disappear when not actively in buffer - "jeffkreeftmeijer/vim-numbertoggle", - - -- History visualizer - "mbbill/undotree", - - -- See function signatures when typing them - { - -- "ray-x/lsp_signature.nvim", - -- event = "VeryLazy", - -- opts = {}, - -- config = function(_, opts) require'lsp_signature'.setup(opts) end - }, - - -- Left-side file tree dispaly - { - "nvim-tree/nvim-tree.lua", - requires = { - "nvim-tree/nvim-web-devicons", -- for file icons - }, - }, - - { - 'nvim-lualine/lualine.nvim', - dependencies = { 'nvim-tree/nvim-web-devicons' }, - }, - - { - 'jedrzejboczar/possession.nvim', - requires = { 'nvim-lua/plenary.nvim' }, - }, - - -- LSP - {'VonHeikemen/lsp-zero.nvim', branch = 'v4.x'}, - {'neovim/nvim-lspconfig'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/nvim-cmp'}, - - -- Better diagnostics - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - }, - - -- Linting - "jose-elias-alvarez/null-ls.nvim", - - -- Git wrapper - "tpope/vim-fugitive", - - -- Latex editing in vim - "lervag/vimtex", - - -- Auto comment - "numToStr/Comment.nvim", -}) - diff --git a/lua/andrew/packer.lua b/lua/andrew/packer.lua new file mode 100644 index 0000000..57ec3f1 --- /dev/null +++ b/lua/andrew/packer.lua @@ -0,0 +1,94 @@ +vim.cmd.packadd("packer.nvim") + +return require("packer").startup(function(use) + use "wbthomason/packer.nvim" + + -- Org mode + use { + "nvim-neorg/neorg", + run = ":Neorg sync-parsers", + } + + -- Find files and strings + use { + "nvim-telescope/telescope.nvim", tag = "0.1.0", + requires = { {"nvim-lua/plenary.nvim"} } + } + + -- Treesitter + use({"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}) + + -- Themes + use "aktersnurra/no-clown-fiesta.nvim" + + -- Referencing a hex code highlights it in that color + use "lilydjwg/colorizer" + + -- Relative line numbers disappear when not actively in buffer + use "jeffkreeftmeijer/vim-numbertoggle" + + -- See function signatures when typing them + use "ray-x/lsp_signature.nvim" + require "lsp_signature".setup({}) + + -- Left-side file tree dispaly + use { + "nvim-tree/nvim-tree.lua", + requires = { + "nvim-tree/nvim-web-devicons", -- for file icons + }, + tag = "nightly" -- optional, updated every week + } + + -- Shows current mode on bottom of screen + use "itchyny/lightline.vim" + + -- LSP + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v1.x', + requires = { + -- LSP Support + {'neovim/nvim-lspconfig'}, -- Required + {'williamboman/mason.nvim'}, -- Optional + {'williamboman/mason-lspconfig.nvim'}, -- Optional + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'hrsh7th/cmp-buffer'}, -- Optional + {'hrsh7th/cmp-path'}, -- Optional + {'saadparwaiz1/cmp_luasnip'}, -- Optional + {'hrsh7th/cmp-nvim-lua'}, -- Optional + + -- Snippets + {'L3MON4D3/LuaSnip'}, -- Required + {'rafamadriz/friendly-snippets'}, -- Optional + } + } + + -- Linting + use "jose-elias-alvarez/null-ls.nvim" + + -- Git wrapper + use("tpope/vim-fugitive") + + -- Latex editing in vim + use "lervag/vimtex" + + -- Auto comment + use "numToStr/Comment.nvim" + + -- Markdown + use({ + "agryphus/markdown-preview.nvim", + run = function() vim.fn["mkdp#util#install"]() end, + }) + + -- Jupyter notebook integration + use { + "glacambre/firenvim", + run = function() vim.fn["firenvim#install"](0) end + } +end) + diff --git a/lua/andrew/remap.lua b/lua/andrew/remap.lua index 2d9445f..fc482d8 100644 --- a/lua/andrew/remap.lua +++ b/lua/andrew/remap.lua @@ -10,23 +10,14 @@ vim.keymap.set("n", "J", "mzJ`z") vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") --- step through visual lines by default -vim.keymap.set("n", "j", "gj") -vim.keymap.set("n", "gj", "j") -vim.keymap.set("n", "k", "gk") -vim.keymap.set("n", "gk", "k") -vim.keymap.set("v", "j", "gj") -vim.keymap.set("v", "gj", "j") -vim.keymap.set("v", "k", "gk") -vim.keymap.set("v", "gk", "k") - -- easier escape back to normal mode vim.keymap.set("i", "", "") +-- lol vim.keymap.set("n", "Q", "") -- universal find and replace -vim.keymap.set("n", "r", [[:%s/\<\>//gI]]) +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) -- moving highlighted text vim.keymap.set("v", "J", ":m '>+1gv=gv") @@ -44,87 +35,3 @@ vim.keymap.set("n", "y", "\"+y") vim.keymap.set("n", "d", "\"_d") vim.keymap.set("v", "d", "\"_d") -vim.keymap.set("n", "tc", - function () - local col = "78" - print(vim.o.cc) - if vim.o.cc == col then - vim.o.cc = "" - else - vim.o.cc = col - end - end, - {desc = "Toggle color column"}) - -vim.keymap.set("n", "t", "", {desc = "Toggle"}) -vim.keymap.set("n", "tl", - function () - if vim.wo.number == false and vim.wo.relativenumber == false then - vim.wo.number = true - print("absolute numbers") - elseif vim.wo.number == true and vim.wo.relativenumber == false then - vim.wo.relativenumber = true - print("relative line numbers") - else - vim.wo.number = false - vim.wo.relativenumber = false - print("no line numbers") - end - end, - {desc = "Toggle line numbers"}) - -vim.keymap.set("n", "tw", - function () - if vim.wo.wrap then - vim.wo.wrap = false - print("nowrap") - else - vim.wo.wrap = true - print("wrap") - end - end, - {desc = "Toggle line wrapping"}) - --- case insensitive search -vim.keymap.set("n", "/", "/\\c") -vim.keymap.set("n", "?", "?\\c") - -vim.keymap.set("n", "hF", - function() - local result = vim.treesitter.get_captures_at_cursor(0) - print(vim.inspect(result)) - end, - { noremap = true, silent = false, desc = "Describe face" } -) - -local str = string.format - -for i = 1, 9 do - vim.keymap.set("n", str("", i), str("%sgt", i), { desc = str("Goto tab %s", i) }) - vim.keymap.set("t", str("", i), str("%sgt", i), { desc = str("Goto tab %s", i) }) -end - -vim.keymap.set("n", "", "tabnew", { desc = "Create a new tab" }) -vim.keymap.set("n", "", "tabnewtermi", { desc = "Create a new tab with a terminal" }) -vim.keymap.set("n", "", "tabclose", { desc = "Close current tab" }) -vim.keymap.set("n", "", "tablast", { desc = "Goto last tab" }) -vim.keymap.set("n", "", "tabnext", { desc = "Goto next tab" }) -vim.keymap.set("n", "", "tabprevious", { desc = "Goto prev tab" }) -vim.keymap.set("n", "", "tabm-", { desc = "Move tab to the left" }) -vim.keymap.set("n", "", "tabm+", { desc = "Move tab to the right" }) -vim.keymap.set("n", "", "tab split", { desc = "Clone window in new tab" }) - -vim.keymap.set("n", "", "termi", { desc = "Terminal" }) - -vim.api.nvim_create_autocmd("TabEnter", { - callback = function() - local bufnr = vim.api.nvim_get_current_buf() - local buftype = vim.api.nvim_buf_get_option(bufnr, "buftype") - - if buftype == "terminal" then - -- Enter Terminal-Job mode - vim.api.nvim_feedkeys("i", "n", false) - end - end, -}) - diff --git a/lua/andrew/set.lua b/lua/andrew/set.lua index 4923e9f..75ca996 100644 --- a/lua/andrew/set.lua +++ b/lua/andrew/set.lua @@ -1,3 +1,5 @@ +vim.opt.guicursor = "" + vim.opt.nu = true vim.opt.relativenumber = true @@ -7,49 +9,13 @@ vim.opt.shiftwidth = 4 vim.opt.expandtab = true vim.opt.smartindent = true -vim.opt.linebreak = true -local autocmd = vim.api.nvim_create_autocmd -autocmd("bufenter", { - pattern = "*", - callback = function() - if vim.bo.ft ~= "terminal" then - vim.opt.laststatus = 2 - else - vim.opt.laststatus = 0 - end - end, -}) - --- You can then map it to a key or create a command: -vim.api.nvim_create_user_command('GoFmt', function() - local filename = vim.fn.expand('%') - vim.fn.system('gofmt -e -w ' .. filename) - vim.cmd('edit!') -end, {}) - -vim.filetype.add({ - extension = { - typ = 'typst' - } -}) - --- Only search with case if capital letter is typed -vim.opt.ignorecase = true -vim.opt.smartcase = true vim.opt.wrap = true -vim.opt.splitbelow = true - vim.opt.scrolloff = 8 vim.opt.signcolumn = "auto" -vim.o.shell = "zsh" - -vim.o.title = true - --- Do not map q to :q in man mode -vim.g.no_man_maps = true; +vim.o.shell = "/usr/bin/zsh" -- Local settings for when in :terminal mode -- I don't believe this functionality has been ported to lua.