diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-05-01 13:01:26 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-05-01 13:01:26 -0500 |
commit | 37842f72d87e1ca809e12a9da4674c4c7e5cad5e (patch) | |
tree | 5d1c4a76c379099de4aeea8c23f8b53cb490faeb | |
parent | a0493b46f9e8b893423b216393342dfce23245f2 (diff) |
style: fix formatting
28 files changed, 935 insertions, 994 deletions
diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 4671808..ae1baaf 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,7 +1,7 @@ -- https://github.com/mikebarkmin/.dotfiles/tree/main/nvim/.config/nvim -- https://github.com/ThePrimeagen/.dotfiles/tree/master/nvim -- https://github.com/ChristianChiarulli/nvim -require('plugins') -require('options') -require('autocommands') -require('mappings') +require("plugins") +require("options") +require("autocommands") +require("mappings") diff --git a/nvim/.config/nvim/lua/autocommands.lua b/nvim/.config/nvim/lua/autocommands.lua index 83203ff..2be9023 100644 --- a/nvim/.config/nvim/lua/autocommands.lua +++ b/nvim/.config/nvim/lua/autocommands.lua @@ -1,61 +1,61 @@ -- to Show whitespace, MUST be inserted BEFORE the colorscheme command -vim.cmd [[ - augroup general_settings - autocmd! - autocmd FileType qf,help,man,lspinfo,spectre_panel nnoremap <silent> <buffer> q :close<CR> - autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200}) - autocmd BufWritePre * :%s/\s\+$//e - autocmd BufWinEnter * :set formatoptions-=cro - autocmd BufEnter * set fo-=c fo-=r fo-=o - autocmd FileType qf set nobuflisted - autocmd CmdWinEnter * quit - autocmd FileType xml,html,xhtml,css,scss,javascript,lua,dart setlocal shiftwidth=2 tabstop=2 - autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif - augroup end - - augroup format_on_save - autocmd! - autocmd BufWritePre * lua vim.lsp.buf.formatting() - augroup end - - augroup auto_search_highlighting - autocmd! - autocmd CmdlineEnter /,\? set hlsearch - autocmd CmdlineLeave /,\? set nohlsearch - augroup END - - augroup _git - autocmd! - autocmd FileType gitcommit setlocal wrap - autocmd FileType gitcommit setlocal spell - augroup end - - augroup _markdown - autocmd! - autocmd FileType markdown setlocal wrap - autocmd FileType markdown setlocal spell - autocmd BufNewFile,BufRead *.mdx set filetype=markdown - augroup end - - augroup _latex - autocmd! - autocmd FileType latex,tex,plaintex setlocal wrap - autocmd FileType latex,tex,plaintex setlocal spell - autocmd FileType latex,tex,plaintex setlocal linebreak - augroup end - - augroup _json - autocmd! - autocmd BufEnter *.json set ai expandtab shiftwidth=2 tabstop=2 sta fo=croql - augroup end - - augroup _auto_resize - autocmd! - autocmd VimResized * tabdo wincmd = - augroup end - - augroup _alpha - autocmd! - autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2 - augroup end -]] +vim.cmd([[ + augroup general_settings + autocmd! + autocmd FileType qf,help,man,lspinfo,spectre_panel nnoremap <silent> <buffer> q :close<CR> + autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200}) + autocmd BufWritePre * :%s/\s\+$//e + autocmd BufWinEnter * :set formatoptions-=cro + autocmd BufEnter * set fo-=c fo-=r fo-=o + autocmd FileType qf set nobuflisted + autocmd CmdWinEnter * quit + autocmd FileType xml,html,xhtml,css,scss,javascript,lua,dart setlocal shiftwidth=2 tabstop=2 + autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + augroup end + + augroup format_on_save + autocmd! + autocmd BufWritePre * lua vim.lsp.buf.formatting() + augroup end + + augroup auto_search_highlighting + autocmd! + autocmd CmdlineEnter /,\? set hlsearch + autocmd CmdlineLeave /,\? set nohlsearch + augroup END + + augroup _git + autocmd! + autocmd FileType gitcommit setlocal wrap + autocmd FileType gitcommit setlocal spell + augroup end + + augroup _markdown + autocmd! + autocmd FileType markdown setlocal wrap + autocmd FileType markdown setlocal spell + autocmd BufNewFile,BufRead *.mdx set filetype=markdown + augroup end + + augroup _latex + autocmd! + autocmd FileType latex,tex,plaintex setlocal wrap + autocmd FileType latex,tex,plaintex setlocal spell + autocmd FileType latex,tex,plaintex setlocal linebreak + augroup end + + augroup _json + autocmd! + autocmd BufEnter *.json set ai expandtab shiftwidth=2 tabstop=2 sta fo=croql + augroup end + + augroup _auto_resize + autocmd! + autocmd VimResized * tabdo wincmd = + augroup end + + augroup _alpha + autocmd! + autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2 + augroup end +]]) diff --git a/nvim/.config/nvim/lua/icons.lua b/nvim/.config/nvim/lua/icons.lua index be868a0..723d24d 100644 --- a/nvim/.config/nvim/lua/icons.lua +++ b/nvim/.config/nvim/lua/icons.lua @@ -4,103 +4,103 @@ -- find more here: https://www.nerdfonts.com/cheat-sheet -- פּ ﯟ 蘒練 some other good icons return { - kind = { - Text = "", - -- Method = "m", - -- Function = "", - -- Constructor = "", - Method = "", - Function = "", - Constructor = "", - Field = "", - -- Variable = "", - Variable = "", - Class = "", - Interface = "", - -- Module = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - -- Keyword = "", - Keyword = "", - -- Snippet = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", - }, - type = { - Array = "", - Number = "", - String = "", - Boolean = "蘒", - Object = "", - }, - documents = { - File = "", - Files = "", - Folder = "", - OpenFolder = "", - }, - git = { - Add = "", - Mod = "", - Remove = "", - Ignore = "", - Rename = "", - Diff = "", - Repo = "", - }, - ui = { - Lock = "", - Circle = "", - BigCircle = "", - BigUnfilledCircle = "", - Close = "", - NewFile = "", - Search = "", - Lightbulb = "", - Project = "", - Dashboard = "", - History = "", - Comment = "", - Bug = "", - Code = "", - Telescope = "", - Gear = "", - Package = "", - List = "", - SignIn = "", - Check = "", - Fire = "", - Note = "", - BookMark = "", - Pencil = "", - -- ChevronRight = "", - ChevronRight = ">", - Table = "", - Calendar = "", - }, - diagnostics = { - Error = "", - Warning = "", - Information = "", - Question = "", - Hint = "", - }, - misc = { - Robot = "ﮧ", - Squirrel = "", - Tag = "", - Watch = "", - }, -}
\ No newline at end of file + kind = { + Text = "", + -- Method = "m", + -- Function = "", + -- Constructor = "", + Method = "", + Function = "", + Constructor = "", + Field = "", + -- Variable = "", + Variable = "", + Class = "", + Interface = "", + -- Module = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + -- Keyword = "", + Keyword = "", + -- Snippet = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", + }, + type = { + Array = "", + Number = "", + String = "", + Boolean = "蘒", + Object = "", + }, + documents = { + File = "", + Files = "", + Folder = "", + OpenFolder = "", + }, + git = { + Add = "", + Mod = "", + Remove = "", + Ignore = "", + Rename = "", + Diff = "", + Repo = "", + }, + ui = { + Lock = "", + Circle = "", + BigCircle = "", + BigUnfilledCircle = "", + Close = "", + NewFile = "", + Search = "", + Lightbulb = "", + Project = "", + Dashboard = "", + History = "", + Comment = "", + Bug = "", + Code = "", + Telescope = "", + Gear = "", + Package = "", + List = "", + SignIn = "", + Check = "", + Fire = "", + Note = "", + BookMark = "", + Pencil = "", + -- ChevronRight = "", + ChevronRight = ">", + Table = "", + Calendar = "", + }, + diagnostics = { + Error = "", + Warning = "", + Information = "", + Question = "", + Hint = "", + }, + misc = { + Robot = "ﮧ", + Squirrel = "", + Tag = "", + Watch = "", + }, +} diff --git a/nvim/.config/nvim/lua/mappings.lua b/nvim/.config/nvim/lua/mappings.lua index b44c9e6..16cd958 100644 --- a/nvim/.config/nvim/lua/mappings.lua +++ b/nvim/.config/nvim/lua/mappings.lua @@ -185,7 +185,6 @@ local vmappings = { -- Prefix "<leader>" ["<leader>"] = { - ["/"] = { "<ESC><CMD>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>", "Comment" }, }, } diff --git a/nvim/.config/nvim/lua/plugins/alpha.lua b/nvim/.config/nvim/lua/plugins/alpha.lua index ea7237e..38f147a 100644 --- a/nvim/.config/nvim/lua/plugins/alpha.lua +++ b/nvim/.config/nvim/lua/plugins/alpha.lua @@ -1,43 +1,42 @@ local status_ok, alpha = pcall(require, "alpha") if not status_ok then - return + return end local status_ok, dashboard = pcall(require, "alpha.themes.dashboard") if not status_ok then - return + return end - -- alpha.setup(dashboard.config) -local icons = require "icons" +local icons = require("icons") -local dashboard = require "alpha.themes.dashboard" +local dashboard = require("alpha.themes.dashboard") dashboard.section.header.val = { - [[ __ ]], - [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], - [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], - [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], - [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], - [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], + [[ __ ]], + [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], + [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], + [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], + [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], + [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], } dashboard.section.buttons.val = { - dashboard.button("f", icons.documents.Files .. " Find file", ":Telescope find_files <CR>"), - dashboard.button("e", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert <CR>"), - dashboard.button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"), - dashboard.button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"), - dashboard.button("s", icons.ui.SignIn .. " Find Session", ":Telescope sessions save_current=false <CR>"), - dashboard.button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"), - dashboard.button("q", icons.diagnostics.Error .. " Quit", ":qa<CR>"), + dashboard.button("f", icons.documents.Files .. " Find file", ":Telescope find_files <CR>"), + dashboard.button("e", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert <CR>"), + dashboard.button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"), + dashboard.button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"), + dashboard.button("s", icons.ui.SignIn .. " Find Session", ":Telescope sessions save_current=false <CR>"), + dashboard.button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"), + dashboard.button("q", icons.diagnostics.Error .. " Quit", ":qa<CR>"), } local function footer() - -- NOTE: requires the fortune-mod package to work - -- local handle = io.popen("fortune") - -- local fortune = handle:read("*a") - -- handle:close() - -- return fortune - return "tobyvin.com" + -- NOTE: requires the fortune-mod package to work + -- local handle = io.popen("fortune") + -- local fortune = handle:read("*a") + -- handle:close() + -- return fortune + return "tobyvin.com" end dashboard.section.footer.val = footer() @@ -48,4 +47,4 @@ dashboard.section.buttons.opts.hl = "Keyword" dashboard.opts.opts.noautocmd = true -- vim.cmd([[autocmd User AlphaReady echo 'ready']]) -alpha.setup(dashboard.opts)
\ No newline at end of file +alpha.setup(dashboard.opts) diff --git a/nvim/.config/nvim/lua/plugins/blankline.lua b/nvim/.config/nvim/lua/plugins/blankline.lua index 44f90c8..a506e82 100644 --- a/nvim/.config/nvim/lua/plugins/blankline.lua +++ b/nvim/.config/nvim/lua/plugins/blankline.lua @@ -3,9 +3,9 @@ if not status_ok then return end -indent_blankline.setup { - -- for example, context is off by default, use this to turn it on - show_current_context = true, - show_current_context_start = true, - show_end_of_line = true -} +indent_blankline.setup({ + -- for example, context is off by default, use this to turn it on + show_current_context = true, + show_current_context_start = true, + show_end_of_line = true, +}) diff --git a/nvim/.config/nvim/lua/plugins/bufferline.lua b/nvim/.config/nvim/lua/plugins/bufferline.lua index 105df66..1ec906b 100644 --- a/nvim/.config/nvim/lua/plugins/bufferline.lua +++ b/nvim/.config/nvim/lua/plugins/bufferline.lua @@ -3,80 +3,31 @@ if not status_ok then return end --- https://github.com/Mofiqul/vscode.nvim#-usage - local diagnostics_signs = { - ['error'] = '', - warning = '', - default = '', + ["error"] = "", + warning = "", + default = "", } -require('bufferline').setup{ - options = { - indicator_icon = ' ', - buffer_close_icon = '', - modified_icon = '●', - close_icon = '', +require("bufferline").setup({ + options = { + indicator_icon = " ", + buffer_close_icon = "", + modified_icon = "●", + close_icon = "", close_command = "Bdelete! %d", right_mouse_command = "Bdelete! %d", - always_show_bufferline = false, - diagnostics = 'nvim_lsp', - diagnostics_indicator = function(count, level, diagnostics_dict, context) - local s = ' ' - for e, n in pairs(diagnostics_dict) do - local sym = diagnostics_signs[e] or diagnostics_signs.default - s = s .. (#s > 1 and ' ' or '') .. sym .. ' ' .. n - end - return s - end, - -- separator_style = 'slant', - offsets = {{filetype = "NvimTree", text = "EXPLORER", text_align = "center"}}, + always_show_bufferline = false, + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local s = " " + for e, n in pairs(diagnostics_dict) do + local sym = diagnostics_signs[e] or diagnostics_signs.default + s = s .. (#s > 1 and " " or "") .. sym .. " " .. n + end + return s + end, show_tab_indicators = true, - show_close_icon = false - }, - highlights = { - fill = { - guifg = {attribute = "fg", highlight = "Normal"}, - guibg = {attribute = "bg", highlight = "StatusLineNC"}, - }, - background = { - guifg = {attribute = "fg", highlight = "Normal"}, - guibg = {attribute = "bg", highlight = "StatusLine"} - }, - buffer_visible = { - gui = "", - guifg = {attribute = "fg", highlight="Normal"}, - guibg = {attribute = "bg", highlight = "Normal"} - }, - buffer_selected = { - gui = "", - guifg = {attribute = "fg", highlight="Normal"}, - guibg = {attribute = "bg", highlight = "Normal"} - }, - separator = { - guifg = {attribute = "bg", highlight = "Normal"}, - guibg = {attribute = "bg", highlight = "StatusLine"}, - }, - separator_selected = { - guifg = {attribute = "fg", highlight="Special"}, - guibg = {attribute = "bg", highlight = "Normal"} - }, - separator_visible = { - guifg = {attribute = "fg", highlight = "Normal"}, - guibg = {attribute = "bg", highlight = "StatusLineNC"}, - }, - close_button = { - guifg = {attribute = "fg", highlight = "Normal"}, - guibg = {attribute = "bg", highlight = "StatusLine"} - }, - close_button_selected = { - guifg = {attribute = "fg", highlight="normal"}, - guibg = {attribute = "bg", highlight = "normal"} - }, - close_button_visible = { - guifg = {attribute = "fg", highlight="normal"}, - guibg = {attribute = "bg", highlight = "normal"} - }, - - } -} + show_close_icon = false, + }, +}) diff --git a/nvim/.config/nvim/lua/plugins/cmp.lua b/nvim/.config/nvim/lua/plugins/cmp.lua index 1a13863..a5ea7b8 100644 --- a/nvim/.config/nvim/lua/plugins/cmp.lua +++ b/nvim/.config/nvim/lua/plugins/cmp.lua @@ -1,69 +1,66 @@ local status_ok, cmp = pcall(require, "cmp") if not status_ok then - return + return end -- Require function for tab to work with LUA-SNIP local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and - vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col) - :match("%s") == nil + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end cmp.setup({ - completion = { - completeopt = 'menu,menuone,noinsert', - }, - snippet = { - expand = function(args) require('luasnip').lsp_expand(args.body) end - }, - mapping = { - ['<C-p>'] = cmp.mapping.select_prev_item(), - ['<C-n>'] = cmp.mapping.select_next_item(), - -- Add tab support - ['<S-Tab>'] = cmp.mapping.select_prev_item(), - ['<Tab>'] = cmp.mapping.select_next_item(), - ['<C-d>'] = cmp.mapping.scroll_docs(-4), - ['<C-u>'] = cmp.mapping.scroll_docs(4), - ['<C-Space>'] = cmp.mapping.complete(), - ['<C-e>'] = cmp.mapping.close(), - ['<CR>'] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }) - }, - formatting = { - format = function(entry, vim_item) - -- fancy icons and a name of kind - vim_item.kind = require("lspkind").presets.default[vim_item.kind] - -- set a name for each source - vim_item.menu = ({ - buffer = "[Buff]", - nvim_lsp = "[LSP]", - luasnip = "[LuaSnip]", - nvim_lua = "[Lua]", - latex_symbols = "[Latex]" - })[entry.source.name] - return vim_item - end - }, - sources = { - {name = 'nvim_lsp'}, - {name = 'nvim_lua'}, - {name = 'path'}, - {name = 'luasnip'}, - {name = 'buffer', keyword_length = 1}, - {name = 'calc' } - }, - experimental = { - -- ghost_text = true, - } - + completion = { + completeopt = "menu,menuone,noinsert", + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = { + ["<C-p>"] = cmp.mapping.select_prev_item(), + ["<C-n>"] = cmp.mapping.select_next_item(), + -- Add tab support + ["<S-Tab>"] = cmp.mapping.select_prev_item(), + ["<Tab>"] = cmp.mapping.select_next_item(), + ["<C-d>"] = cmp.mapping.scroll_docs(-4), + ["<C-u>"] = cmp.mapping.scroll_docs(4), + ["<C-Space>"] = cmp.mapping.complete(), + ["<C-e>"] = cmp.mapping.close(), + ["<CR>"] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + }, + formatting = { + format = function(entry, vim_item) + -- fancy icons and a name of kind + vim_item.kind = require("lspkind").presets.default[vim_item.kind] + -- set a name for each source + vim_item.menu = ({ + buffer = "[Buff]", + nvim_lsp = "[LSP]", + luasnip = "[LuaSnip]", + nvim_lua = "[Lua]", + latex_symbols = "[Latex]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "path" }, + { name = "luasnip" }, + { name = "buffer", keyword_length = 1 }, + { name = "calc" }, + }, + experimental = { + -- ghost_text = true, + }, }) - - -- local luasnip = require("luasnip") -- local source_mapping = { diff --git a/nvim/.config/nvim/lua/plugins/dap.lua b/nvim/.config/nvim/lua/plugins/dap.lua index f49590e..2b4bfcc 100644 --- a/nvim/.config/nvim/lua/plugins/dap.lua +++ b/nvim/.config/nvim/lua/plugins/dap.lua @@ -5,85 +5,85 @@ end -- Debugpy dap.adapters.python = { - type = 'executable', - command = 'python', - args = { '-m', 'debugpy.adapter' }, + type = "executable", + command = "python", + args = { "-m", "debugpy.adapter" }, } dap.configurations.python = { - { - type = 'python', - request = 'launch', - name = 'Launch file', - program = '${file}', - pythonPath = function() - local venv_path = vim.fn.getenv 'VIRTUAL_ENVIRONMENT' - if venv_path ~= vim.NIL and venv_path ~= '' then - return venv_path .. '/bin/python' - else - return '/usr/bin/python' - end - end, - }, + { + type = "python", + request = "launch", + name = "Launch file", + program = "${file}", + pythonPath = function() + local venv_path = vim.fn.getenv("VIRTUAL_ENVIRONMENT") + if venv_path ~= vim.NIL and venv_path ~= "" then + return venv_path .. "/bin/python" + else + return "/usr/bin/python" + end + end, + }, } -- Neovim Lua dap.adapters.nlua = function(callback, config) - callback { type = 'server', host = config.host, port = config.port } + callback({ type = "server", host = config.host, port = config.port }) end dap.configurations.lua = { - { - type = 'nlua', - request = 'attach', - name = 'Attach to running Neovim instance', - host = function() - local value = vim.fn.input 'Host [127.0.0.1]: ' - if value ~= '' then - return value - end - return '127.0.0.1' - end, - port = function() - local val = tonumber(vim.fn.input 'Port: ') - assert(val, 'Please provide a port number') - return val - end, - }, + { + type = "nlua", + request = "attach", + name = "Attach to running Neovim instance", + host = function() + local value = vim.fn.input("Host [127.0.0.1]: ") + if value ~= "" then + return value + end + return "127.0.0.1" + end, + port = function() + local val = tonumber(vim.fn.input("Port: ")) + assert(val, "Please provide a port number") + return val + end, + }, } -- lldb dap.adapters.lldb = { - type = 'executable', - command = '/usr/bin/lldb-vscode', - name = 'lldb', + type = "executable", + command = "/usr/bin/lldb-vscode", + name = "lldb", } dap.configurations.cpp = { - { - name = 'Launch', - type = 'lldb', - request = 'launch', - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - cwd = '${workspaceFolder}', - stopOnEntry = false, - args = {}, - runInTerminal = false, - }, + { + name = "Launch", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = {}, + runInTerminal = false, + }, } dap.configurations.c = dap.configurations.cpp dap.configurations.rust = dap.configurations.cpp -vim.cmd [[command! BreakpointToggle lua require('dap').toggle_breakpoint()]] -vim.cmd [[command! Debug lua require('dap').continue()]] -vim.cmd [[command! DapREPL lua require('dap').repl.open()]] +vim.cmd([[command! BreakpointToggle lua require('dap').toggle_breakpoint()]]) +vim.cmd([[command! Debug lua require('dap').continue()]]) +vim.cmd([[command! DapREPL lua require('dap').repl.open()]]) local tele_status_ok, telescope = pcall(require, "telescope") if not tele_status_ok then return end -telescope.load_extension('dap')
\ No newline at end of file +telescope.load_extension("dap") diff --git a/nvim/.config/nvim/lua/plugins/git-blame.lua b/nvim/.config/nvim/lua/plugins/git-blame.lua index f0bb678..0e3a7ea 100644 --- a/nvim/.config/nvim/lua/plugins/git-blame.lua +++ b/nvim/.config/nvim/lua/plugins/git-blame.lua @@ -1,3 +1,3 @@ vim.g.gitblame_enabled = 0 vim.g.gitblame_message_template = "<summary> • <date> • <author>" -vim.g.gitblame_highlight_group = "LineNr"
\ No newline at end of file +vim.g.gitblame_highlight_group = "LineNr" diff --git a/nvim/.config/nvim/lua/plugins/git-worktree.lua b/nvim/.config/nvim/lua/plugins/git-worktree.lua index 2bc8892..5064289 100644 --- a/nvim/.config/nvim/lua/plugins/git-worktree.lua +++ b/nvim/.config/nvim/lua/plugins/git-worktree.lua @@ -3,12 +3,11 @@ if not status_ok then return end -git_worktree.setup({ -}) +git_worktree.setup({}) local status_ok, telescope = pcall(require, "telescope") if not status_ok then return end -require("telescope").load_extension("git_worktree")
\ No newline at end of file +require("telescope").load_extension("git_worktree") diff --git a/nvim/.config/nvim/lua/plugins/gitsigns.lua b/nvim/.config/nvim/lua/plugins/gitsigns.lua index b3c944a..49de31e 100644 --- a/nvim/.config/nvim/lua/plugins/gitsigns.lua +++ b/nvim/.config/nvim/lua/plugins/gitsigns.lua @@ -1,48 +1,48 @@ local status_ok, gitsigns = pcall(require, "gitsigns") if not status_ok then - return + return end -gitsigns.setup { - signs = { - add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - attach_to_untracked = true, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - }, - current_line_blame_formatter_opts = { - relative_time = false, - }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = "rounded", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, - yadm = { - enable = false, - }, -}
\ No newline at end of file +gitsigns.setup({ + signs = { + add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, + change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter_opts = { + relative_time = false, + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = "rounded", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { + enable = false, + }, +}) diff --git a/nvim/.config/nvim/lua/plugins/lsp-installer.lua b/nvim/.config/nvim/lua/plugins/lsp-installer.lua index ea452b4..9ebe40a 100644 --- a/nvim/.config/nvim/lua/plugins/lsp-installer.lua +++ b/nvim/.config/nvim/lua/plugins/lsp-installer.lua @@ -1,130 +1,129 @@ local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer") if not status_ok then - print("Failed to require nvim-lsp-installer") + print("Failed to require nvim-lsp-installer") end -- Provide settings first! -lsp_installer.settings { - ui = { - icons = { - server_installed = "✓", - server_pending = "➜", - server_uninstalled = "✗" - } - }, +lsp_installer.settings({ + ui = { + icons = { + server_installed = "✓", + server_pending = "➜", + server_uninstalled = "✗", + }, + }, - -- Limit for the maximum amount of servers to be installed at the same time. Once this limit is reached, any further - -- servers that are requested to be installed will be put in a queue. - max_concurrent_installers = 4 -} + -- Limit for the maximum amount of servers to be installed at the same time. Once this limit is reached, any further + -- servers that are requested to be installed will be put in a queue. + max_concurrent_installers = 4, +}) --------------------------------------------------- local enhance_server_opts = { - ["sumneko_lua"] = function(opts) - opts.on_attach = function(client) - client.resolved_capabilities.document_formatting = false - client.resolved_capabilities.document_range_formatting = false - end - end, - ["eslintls"] = function(opts) - opts.settings = { - format = { - enable = true, - }, - } - end, - ["gopls"] = function(opts) - opts.cmd = { - "gopls", - "serve", - } - opts.settings = { - gopls = { - staticcheck = true, - analyses = { - unusedparams = true, - }, - }, - } - end + ["sumneko_lua"] = function(opts) + opts.on_attach = function(client) + client.resolved_capabilities.document_formatting = false + client.resolved_capabilities.document_range_formatting = false + end + end, + ["eslintls"] = function(opts) + opts.settings = { + format = { + enable = true, + }, + } + end, + ["gopls"] = function(opts) + opts.cmd = { + "gopls", + "serve", + } + opts.settings = { + gopls = { + staticcheck = true, + analyses = { + unusedparams = true, + }, + }, + } + end, } - local function make_server_ready(attach) - lsp_installer.on_server_ready(function(server) - -- Specify the default options which we'll use to setup all servers - local opts = { - on_attach = on_attach, - } - if server.name == "rust_analyzer" then - local rustopts = { - tools = { - autoSetHints = true, - hover_with_actions = false, - inlay_hints = { - show_parameter_hints = true, - parameter_hints_prefix = "", - other_hints_prefix = "", - }, - }, - server = vim.tbl_deep_extend("force", server:get_default_options(), opts, { - settings = { - ["rust-analyzer"] = { - completion = { - postfix = { - enable = false - } - }, - checkOnSave = { - command = "clippy" - }, - } - } - }), - } - require("rust-tools").setup(rustopts) - server:attach_buffers() - else - if enhance_server_opts[server.name] then - -- Enhance the default opts with the server-specific ones - enhance_server_opts[server.name](opts) - end - -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart) - server:setup(opts) - end + lsp_installer.on_server_ready(function(server) + -- Specify the default options which we'll use to setup all servers + local opts = { + on_attach = on_attach, + } + if server.name == "rust_analyzer" then + local rustopts = { + tools = { + autoSetHints = true, + hover_with_actions = false, + inlay_hints = { + show_parameter_hints = true, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + server = vim.tbl_deep_extend("force", server:get_default_options(), opts, { + settings = { + ["rust-analyzer"] = { + completion = { + postfix = { + enable = false, + }, + }, + checkOnSave = { + command = "clippy", + }, + }, + }, + }), + } + require("rust-tools").setup(rustopts) + server:attach_buffers() + else + if enhance_server_opts[server.name] then + -- Enhance the default opts with the server-specific ones + enhance_server_opts[server.name](opts) + end + -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart) + server:setup(opts) + end - vim.cmd [[ do User LspAttachBuffers ]] - end) + vim.cmd([[ do User LspAttachBuffers ]]) + end) end --------------------------------------------------- --------------------------------------------------- local servers = { - "rust_analyzer", - "tsserver", -- for javascript - "jsonls", -- for json - "texlab", -- for latex - "ltex", - "sqlls", -- for sql - "pylsp", -- for python - "sumneko_lua", -- for lua - "gopls", -- for go - "yamlls", - "bashls", - "dockerls" + "rust_analyzer", + "tsserver", -- for javascript + "jsonls", -- for json + "texlab", -- for latex + "ltex", + "sqlls", -- for sql + "pylsp", -- for python + "sumneko_lua", -- for lua + "gopls", -- for go + "yamlls", + "bashls", + "dockerls", } -- setup the LS -require "plugins.lspconfig" +require("plugins.lspconfig") make_server_ready(On_attach) -- LSP mappings -- install the LS for _, name in pairs(servers) do - local server_is_found, server = lsp_installer.get_server(name) - if server_is_found then - if not server:is_installed() then - print("Installing " .. name) - server:install() - end - end + local server_is_found, server = lsp_installer.get_server(name) + if server_is_found then + if not server:is_installed() then + print("Installing " .. name) + server:install() + end + end end diff --git a/nvim/.config/nvim/lua/plugins/lsp-signature.lua b/nvim/.config/nvim/lua/plugins/lsp-signature.lua index 084913c..78162a1 100644 --- a/nvim/.config/nvim/lua/plugins/lsp-signature.lua +++ b/nvim/.config/nvim/lua/plugins/lsp-signature.lua @@ -1,53 +1,53 @@ local status_ok, signature = pcall(require, "lsp_signature") if not status_ok then - return + return end -local icons = require "icons" +local icons = require("icons") local cfg = { - debug = false, -- set to true to enable debug logging - log_path = "debug_log_file_path", -- debug log path - verbose = false, -- show debug line number - - bind = true, -- This is mandatory, otherwise border config won't get registered. - -- If you want to hook lspsaga or other signature handler, pls set to false - doc_lines = 0, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); - -- set to 0 if you DO NOT want any API comments be shown - -- This setting only take effect in insert mode, it does not affect signature help in normal - -- mode, 10 by default - - floating_window = false, -- show hint in a floating window, set to false for virtual text only mode - - floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note: - -- will set to true when fully tested, set to false will use whichever side has more space - -- this setting will be helpful if you do not want the PUM and floating win overlap - fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters - hint_enable = true, -- virtual hint enable - hint_prefix = icons.misc.Squirrel .. " ", -- Panda for parameter - hint_scheme = "Comment", - use_lspsaga = false, -- set to true if you want to use lspsaga popup - hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight - max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down - -- to view the hiding contents - max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width - handler_opts = { - border = "rounded", -- double, rounded, single, shadow, none - }, - - always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 - - auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. - extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} - zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom - - padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc - - transparency = nil, -- disabled by default, allow floating win transparent value 1~100 - shadow_blend = 36, -- if you using shadow as border use this set the opacity - shadow_guibg = "Black", -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' - timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency - toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>' + debug = false, -- set to true to enable debug logging + log_path = "debug_log_file_path", -- debug log path + verbose = false, -- show debug line number + + bind = true, -- This is mandatory, otherwise border config won't get registered. + -- If you want to hook lspsaga or other signature handler, pls set to false + doc_lines = 0, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); + -- set to 0 if you DO NOT want any API comments be shown + -- This setting only take effect in insert mode, it does not affect signature help in normal + -- mode, 10 by default + + floating_window = false, -- show hint in a floating window, set to false for virtual text only mode + + floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note: + -- will set to true when fully tested, set to false will use whichever side has more space + -- this setting will be helpful if you do not want the PUM and floating win overlap + fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters + hint_enable = true, -- virtual hint enable + hint_prefix = icons.misc.Squirrel .. " ", -- Panda for parameter + hint_scheme = "Comment", + use_lspsaga = false, -- set to true if you want to use lspsaga popup + hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight + max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down + -- to view the hiding contents + max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width + handler_opts = { + border = "rounded", -- double, rounded, single, shadow, none + }, + + always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 + + auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. + extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} + zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom + + padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc + + transparency = nil, -- disabled by default, allow floating win transparent value 1~100 + shadow_blend = 36, -- if you using shadow as border use this set the opacity + shadow_guibg = "Black", -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' + timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency + toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>' } -- recommanded: @@ -56,4 +56,4 @@ signature.setup(cfg) -- no need to specify bufnr if you don't use toggle_key -- You can also do this inside lsp on_attach -- note: on_attach deprecated -- require("lsp_signature").on_attach(cfg, bufnr) -- no need to specify bufnr if you don't use toggle_key -signature.on_attach(cfg) -- no need to specify bufnr if you don't use toggle_key
\ No newline at end of file +signature.on_attach(cfg) -- no need to specify bufnr if you don't use toggle_key diff --git a/nvim/.config/nvim/lua/plugins/lspconfig.lua b/nvim/.config/nvim/lua/plugins/lspconfig.lua index 0635ee8..136cf43 100644 --- a/nvim/.config/nvim/lua/plugins/lspconfig.lua +++ b/nvim/.config/nvim/lua/plugins/lspconfig.lua @@ -6,18 +6,16 @@ end local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true -vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - underline = true, - signs = true, - update_in_insert = true, - virtual_text = { - true, - spacing = 6, - severity_limit='Error' -- Only show virtual text on error - }, - } -) +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + underline = true, + signs = true, + update_in_insert = true, + virtual_text = { + true, + spacing = 6, + severity_limit = "Error", -- Only show virtual text on error + }, +}) local function config(_config) return vim.tbl_deep_extend("force", { @@ -54,30 +52,30 @@ lspconfig.gopls.setup(config({ })) local rustopts = { - tools = { - autoSetHints = true, - hover_with_actions = true, - runnables = { - use_telescope = true - }, - inlay_hints = { - show_parameter_hints = false, - parameter_hints_prefix = "", - other_hints_prefix = "", - }, - }, - server = { - settings = { - ["rust-analyzer"] = { - cargo = { - allFeatures = "true", - }, - checkOnSave = { - command = "clippy", - }, - } - } - }, + tools = { + autoSetHints = true, + hover_with_actions = true, + runnables = { + use_telescope = true, + }, + inlay_hints = { + show_parameter_hints = false, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + server = { + settings = { + ["rust-analyzer"] = { + cargo = { + allFeatures = "true", + }, + checkOnSave = { + command = "clippy", + }, + }, + }, + }, } require("rust-tools").setup(rustopts) diff --git a/nvim/.config/nvim/lua/plugins/lspkind.lua b/nvim/.config/nvim/lua/plugins/lspkind.lua index b33a24a..d357d68 100644 --- a/nvim/.config/nvim/lua/plugins/lspkind.lua +++ b/nvim/.config/nvim/lua/plugins/lspkind.lua @@ -4,31 +4,31 @@ if not status_ok then end lspkind.init({ - -- enables text annotations (default: 'default') - -- default symbol map can be either 'default' or 'codicons' for codicon preset (requires vscode-codicons font installed) - preset = 'codicons', + -- enables text annotations (default: 'default') + -- default symbol map can be either 'default' or 'codicons' for codicon preset (requires vscode-codicons font installed) + preset = "codicons", - -- override preset symbols (default: {}) - symbol_map = { - Text = '', - Method = 'ƒ', - Function = '', - Constructor = '', - Variable = '', - Class = '', - Interface = 'ﰮ', - Module = '', - Property = '', - Unit = '', - Value = '', - Enum = '了', - Keyword = '', - Snippet = '', - Color = '', - File = '', - Folder = '', - EnumMember = '', - Constant = '', - Struct = '' - }, -})
\ No newline at end of file + -- override preset symbols (default: {}) + symbol_map = { + Text = "", + Method = "ƒ", + Function = "", + Constructor = "", + Variable = "", + Class = "", + Interface = "ﰮ", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "了", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + }, +}) diff --git a/nvim/.config/nvim/lua/plugins/lspstatus.lua b/nvim/.config/nvim/lua/plugins/lspstatus.lua index 923209b..0afd134 100644 --- a/nvim/.config/nvim/lua/plugins/lspstatus.lua +++ b/nvim/.config/nvim/lua/plugins/lspstatus.lua @@ -1,13 +1,13 @@ -local lsp_status = require 'lsp-status' +local lsp_status = require("lsp-status") lsp_status.status() lsp_status.register_progress() lsp_status.config({ - indicator_errors = "", - indicator_warnings = "", - indicator_info = "", - indicator_hint = "", - indicator_ok = "", - current_function = true, - update_interval = 100, - status_symbol = ' 🇻', -})
\ No newline at end of file + indicator_errors = "", + indicator_warnings = "", + indicator_info = "", + indicator_hint = "", + indicator_ok = "", + current_function = true, + update_interval = 100, + status_symbol = " 🇻", +}) diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/plugins/lualine.lua index bfa9996..23c9133 100644 --- a/nvim/.config/nvim/lua/plugins/lualine.lua +++ b/nvim/.config/nvim/lua/plugins/lualine.lua @@ -1,113 +1,110 @@ local status_ok, lualine = pcall(require, "lualine") if not status_ok then - return + return end local status_gps_ok, gps = pcall(require, "nvim-gps") if not status_gps_ok then - return + return end local hide_in_width = function() - return vim.fn.winwidth(0) > 80 + return vim.fn.winwidth(0) > 80 end -local icons = require 'icons' +local icons = require("icons") local diagnostics = { - "diagnostics", - sources = { "nvim_diagnostic" }, - sections = { "error", "warn" }, - symbols = { error = icons.diagnostics.Error .. " ", warn = icons.diagnostics.Warning .. " " }, - colored = false, - update_in_insert = false, - always_visible = true, + "diagnostics", + sources = { "nvim_diagnostic" }, + sections = { "error", "warn" }, + symbols = { error = icons.diagnostics.Error .. " ", warn = icons.diagnostics.Warning .. " " }, + colored = false, + update_in_insert = false, + always_visible = true, } local diff = { - "diff", - colored = false, - symbols = { added = icons.git.Add .. " ", modified = icons.git.Mod .. " ", removed = icons.git.Remove .. " " }, -- changes diff symbols - cond = hide_in_width, + "diff", + colored = false, + symbols = { added = icons.git.Add .. " ", modified = icons.git.Mod .. " ", removed = icons.git.Remove .. " " }, -- changes diff symbols + cond = hide_in_width, } local mode = { - "mode", - fmt = function(str) - return "-- " .. str .. " --" - end, + "mode", + fmt = function(str) + return "-- " .. str .. " --" + end, } local filetype = { - "filetype", - icons_enabled = false, - icon = nil, + "filetype", + icons_enabled = false, + icon = nil, } local branch = { - "branch", - icons_enabled = true, - icon = "", + "branch", + icons_enabled = true, + icon = "", } local location = { - "location", - padding = 0, + "location", + padding = 0, } -- cool function for progress local progress = 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] + 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 local spaces = function() - return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") + return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") end local nvim_gps = function() - local gps_location = gps.get_location() - if gps_location == "error" then - return "" - else - return gps.get_location() - end + local gps_location = gps.get_location() + if gps_location == "error" then + return "" + else + return gps.get_location() + end end -lualine.setup { - options = { - icons_enabled = true, +lualine.setup({ + options = { + icons_enabled = true, theme = "gruvbox-flat", - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - disabled_filetypes = { "alpha", "dashboard", "NvimTree", "Outline", "toggleterm" }, - always_divide_middle = true, - }, - sections = { - -- lualine_a = { branch, diagnostics }, - lualine_a = { branch }, - lualine_b = { diagnostics }, - -- lualine_c = { _gps }, - lualine_c = { - { nvim_gps, cond = hide_in_width }, - }, - -- lualine_x = { "encoding", "fileformat", "filetype" }, - lualine_x = { diff, spaces, "encoding", filetype }, - lualine_y = { location }, - lualine_z = { progress }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {}, - lualine_x = { "location" }, - lualine_y = {}, - lualine_z = {}, - }, - tabline = {}, - extensions = {}, -}
\ No newline at end of file + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { "alpha", "dashboard", "NvimTree", "Outline", "toggleterm" }, + always_divide_middle = true, + }, + sections = { + lualine_a = { branch }, + lualine_b = { diagnostics }, + lualine_c = { + { nvim_gps, cond = hide_in_width }, + }, + lualine_x = { diff, spaces, "encoding", filetype }, + lualine_y = { location }, + lualine_z = { progress }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {}, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = {}, +}) diff --git a/nvim/.config/nvim/lua/plugins/luasnip.lua b/nvim/.config/nvim/lua/plugins/luasnip.lua index 962dc24..4ea5725 100644 --- a/nvim/.config/nvim/lua/plugins/luasnip.lua +++ b/nvim/.config/nvim/lua/plugins/luasnip.lua @@ -4,15 +4,15 @@ if not status_ok then end luasnip.config.set_config({ - history = true, - updateevents = "TextChanged,TextChangedI" + history = true, + updateevents = "TextChanged,TextChangedI", }) -luasnip.snippets = {all = {}, html = {}} +luasnip.snippets = { all = {}, html = {} } luasnip.snippets.javascript = luasnip.snippets.html luasnip.snippets.javascriptreact = luasnip.snippets.html luasnip.snippets.typescriptreact = luasnip.snippets.html -require("luasnip.loaders.from_vscode").load({include = {"html"}}) +require("luasnip.loaders.from_vscode").load({ include = { "html" } }) -require('luasnip.loaders.from_vscode').lazy_load()
\ No newline at end of file +require("luasnip.loaders.from_vscode").lazy_load() diff --git a/nvim/.config/nvim/lua/plugins/neo-tree.lua b/nvim/.config/nvim/lua/plugins/neo-tree.lua index cea3880..37512d9 100644 --- a/nvim/.config/nvim/lua/plugins/neo-tree.lua +++ b/nvim/.config/nvim/lua/plugins/neo-tree.lua @@ -1,6 +1,6 @@ local status_ok, neo_tree = pcall(require, "neo-tree") if not status_ok then - return + return end vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) @@ -11,63 +11,63 @@ vim.fn.sign_define("DiagnosticSignInfo", { text = " ", texthl = "DiagnosticSi vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" }) neo_tree.setup({ - close_if_last_window = true, - window = { - mappings = { - ["<space>"] = "none", - ["<2-LeftMouse>"] = "none", - ["<cr>"] = "none", - ["S"] = "none", - ["s"] = "none", - ["t"] = "none", - ["C"] = "none", - ["a"] = "none", - ["A"] = "none", - ["d"] = "none", - ["r"] = "none", - ["y"] = "none", - ["x"] = "none", - ["p"] = "none", - ["c"] = "none", - ["m"] = "none", - ["q"] = "none", - ["R"] = "none", - }, - }, - filesystem = { - filtered_items = { - hide_dotfiles = false, - }, - use_libuv_file_watcher = true, - window = { - mappings = { - ["<bs>"] = "none", - ["."] = "none", - ["H"] = "none", - ["/"] = "none", - ["f"] = "none", - ["<c-x>"] = "none", - }, - }, - }, - buffers = { - mappings = { - ["bd"] = "none", - ["<bs>"] = "none", - ["."] = "none", - }, - }, - git_status = { - window = { - mappings = { - ["A"] = "none", - ["gu"] = "none", - ["ga"] = "none", - ["gr"] = "none", - ["gc"] = "none", - ["gp"] = "none", - ["gg"] = "none", - }, - }, - }, + close_if_last_window = true, + window = { + mappings = { + ["<space>"] = "none", + ["<2-LeftMouse>"] = "none", + ["<cr>"] = "none", + ["S"] = "none", + ["s"] = "none", + ["t"] = "none", + ["C"] = "none", + ["a"] = "none", + ["A"] = "none", + ["d"] = "none", + ["r"] = "none", + ["y"] = "none", + ["x"] = "none", + ["p"] = "none", + ["c"] = "none", + ["m"] = "none", + ["q"] = "none", + ["R"] = "none", + }, + }, + filesystem = { + filtered_items = { + hide_dotfiles = false, + }, + use_libuv_file_watcher = true, + window = { + mappings = { + ["<bs>"] = "none", + ["."] = "none", + ["H"] = "none", + ["/"] = "none", + ["f"] = "none", + ["<c-x>"] = "none", + }, + }, + }, + buffers = { + mappings = { + ["bd"] = "none", + ["<bs>"] = "none", + ["."] = "none", + }, + }, + git_status = { + window = { + mappings = { + ["A"] = "none", + ["gu"] = "none", + ["ga"] = "none", + ["gr"] = "none", + ["gc"] = "none", + ["gp"] = "none", + ["gg"] = "none", + }, + }, + }, }) diff --git a/nvim/.config/nvim/lua/plugins/neogit.lua b/nvim/.config/nvim/lua/plugins/neogit.lua index ad1f275..15fafde 100644 --- a/nvim/.config/nvim/lua/plugins/neogit.lua +++ b/nvim/.config/nvim/lua/plugins/neogit.lua @@ -3,4 +3,4 @@ if not status_ok then return end -neogit.setup {}
\ No newline at end of file +neogit.setup({}) diff --git a/nvim/.config/nvim/lua/plugins/null-ls.lua b/nvim/.config/nvim/lua/plugins/null-ls.lua index 568f041..f1c70e0 100644 --- a/nvim/.config/nvim/lua/plugins/null-ls.lua +++ b/nvim/.config/nvim/lua/plugins/null-ls.lua @@ -1,32 +1,32 @@ - local status_ok, null_ls = pcall(require, "null-ls") - if not status_ok then - return - end +local status_ok, null_ls = pcall(require, "null-ls") +if not status_ok then + return +end - local code_actions = null_ls.builtins.code_actions - local diagnostics = null_ls.builtins.diagnostics - local formatting = null_ls.builtins.formatting +local code_actions = null_ls.builtins.code_actions +local diagnostics = null_ls.builtins.diagnostics +local formatting = null_ls.builtins.formatting - null_ls.setup({ - sources = { +null_ls.setup({ + sources = { - require("null-ls").builtins.formatting.stylua, - -- Code Actions - code_actions.gitsigns, - code_actions.shellcheck, + require("null-ls").builtins.formatting.stylua, + -- Code Actions + code_actions.gitsigns, + code_actions.shellcheck, - -- Diagnostics - -- diagnostics.codespell, - -- diagnostics.luacheck, - -- diagnostics.markdownlint, - diagnostics.shellcheck, + -- Diagnostics + -- diagnostics.codespell, + -- diagnostics.luacheck, + -- diagnostics.markdownlint, + diagnostics.shellcheck, - -- Formatting - formatting.prettier, - formatting.black, - formatting.latexindent, - formatting.markdownlint, - formatting.stylua, - formatting.shfmt, - }, - }) + -- Formatting + formatting.prettier, + formatting.black, + formatting.latexindent, + formatting.markdownlint, + formatting.stylua, + formatting.shfmt, + }, +}) diff --git a/nvim/.config/nvim/lua/plugins/nvim-tree.lua b/nvim/.config/nvim/lua/plugins/nvim-tree.lua index 2bab234..8b4bf89 100644 --- a/nvim/.config/nvim/lua/plugins/nvim-tree.lua +++ b/nvim/.config/nvim/lua/plugins/nvim-tree.lua @@ -1,111 +1,111 @@ local status_ok, nvim_tree = pcall(require, "nvim-tree") if not status_ok then - return + return end local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") if not config_status_ok then - return + return end local tree_cb = nvim_tree_config.nvim_tree_callback vim.g.nvim_tree_respect_buf_cwd = 1 vim.g.nvim_tree_icons = { - default = "", - symlink = "", - git = { - unstaged = "", - staged = "S", - unmerged = "", - renamed = "➜", - deleted = "", - untracked = "U", - ignored = "◌", - }, - folder = { - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", - }, + default = "", + symlink = "", + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "U", + ignored = "◌", + }, + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + }, } -nvim_tree.setup { - disable_netrw = true, - hijack_netrw = true, - open_on_setup = false, - ignore_ft_on_setup = { - "startify", - "dashboard", - "alpha", - }, - auto_close = true, - open_on_tab = false, - hijack_cursor = false, - update_cwd = true, - update_to_buf_dir = { - enable = true, - auto_open = true, - }, - diagnostics = { - enable = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - update_focused_file = { - enable = true, - update_cwd = true, - ignore_list = {}, - }, - system_open = { - cmd = nil, - args = {}, - }, - filters = { - dotfiles = false, - custom = {}, - }, - git = { - enable = true, - ignore = true, - timeout = 500, - }, - view = { - width = 30, - height = 30, - hide_root_folder = false, - side = "left", - auto_resize = true, - mappings = { - custom_only = false, - list = { - { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, - { key = "h", cb = tree_cb "close_node" }, - { key = "v", cb = tree_cb "vsplit" }, - }, - }, - number = false, - relativenumber = false, - }, - trash = { - cmd = "trash", - require_confirm = true, - }, - quit_on_open = 0, - git_hl = 1, - disable_window_picker = 0, - root_folder_modifier = ":t", - show_icons = { - git = 1, - folders = 1, - files = 1, - folder_arrows = 1, - tree_width = 30, - }, -}
\ No newline at end of file +nvim_tree.setup({ + disable_netrw = true, + hijack_netrw = true, + open_on_setup = false, + ignore_ft_on_setup = { + "startify", + "dashboard", + "alpha", + }, + auto_close = true, + open_on_tab = false, + hijack_cursor = false, + update_cwd = true, + update_to_buf_dir = { + enable = true, + auto_open = true, + }, + diagnostics = { + enable = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + system_open = { + cmd = nil, + args = {}, + }, + filters = { + dotfiles = false, + custom = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 30, + height = 30, + hide_root_folder = false, + side = "left", + auto_resize = true, + mappings = { + custom_only = false, + list = { + { key = { "l", "<CR>", "o" }, cb = tree_cb("edit") }, + { key = "h", cb = tree_cb("close_node") }, + { key = "v", cb = tree_cb("vsplit") }, + }, + }, + number = false, + relativenumber = false, + }, + trash = { + cmd = "trash", + require_confirm = true, + }, + quit_on_open = 0, + git_hl = 1, + disable_window_picker = 0, + root_folder_modifier = ":t", + show_icons = { + git = 1, + folders = 1, + files = 1, + folder_arrows = 1, + tree_width = 30, + }, +}) diff --git a/nvim/.config/nvim/lua/plugins/renamer.lua b/nvim/.config/nvim/lua/plugins/renamer.lua index 2db1899..89d67d7 100644 --- a/nvim/.config/nvim/lua/plugins/renamer.lua +++ b/nvim/.config/nvim/lua/plugins/renamer.lua @@ -43,4 +43,4 @@ renamer.setup({ ["<c-u>"] = mappings_utils.undo, ["<c-r>"] = mappings_utils.redo, }, -})
\ No newline at end of file +}) diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index 4376f76..24c8289 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -3,53 +3,53 @@ if not status_ok then return end -telescope.setup { - defaults = { - file_ignore_patterns = {"node_modules", ".git", "dist"}, - vimgrep_arguments = { - "rg", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--hidden", - "--iglob", - "!yarn.lock", - "--smart-case", - "-u" - }, - layout_strategy = 'flex', - scroll_strategy = 'cycle', - }, - extensions = { - project = { - base_dirs = { - {path = "~/src", max_depth = 1} - }, - hidden_files = true - }, - fzf = { - fuzzy = true, - override_generic_sorter = true, - override_file_sorter = true, - case_mode = 'smart_case', - }, - }, - pickers = { - find_files = { - find_command = {"rg", "--files", "--hidden"} - }, - lsp_references = { theme = 'dropdown' }, - lsp_code_actions = { theme = 'dropdown' }, - lsp_definitions = { theme = 'dropdown' }, - lsp_implementations = { theme = 'dropdown' }, - buffers = { - sort_lastused = true, - }, - }, -} +telescope.setup({ + defaults = { + file_ignore_patterns = { "node_modules", ".git", "dist" }, + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--hidden", + "--iglob", + "!yarn.lock", + "--smart-case", + "-u", + }, + layout_strategy = "flex", + scroll_strategy = "cycle", + }, + extensions = { + project = { + base_dirs = { + { path = "~/src", max_depth = 1 }, + }, + hidden_files = true, + }, + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + }, + }, + pickers = { + find_files = { + find_command = { "rg", "--files", "--hidden" }, + }, + lsp_references = { theme = "dropdown" }, + lsp_code_actions = { theme = "dropdown" }, + lsp_definitions = { theme = "dropdown" }, + lsp_implementations = { theme = "dropdown" }, + buffers = { + sort_lastused = true, + }, + }, +}) -- Extensions -telescope.load_extension('frecency') -telescope.load_extension('fzf') +telescope.load_extension("frecency") +telescope.load_extension("fzf") diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 95c1aea..04dd3d1 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -3,12 +3,12 @@ if not status_ok then return end -treesitter.setup { - indent = { - enable = true - }, - highlight = { - enable = true, - additional_vim_regex_highlighting = false - } -}
\ No newline at end of file +treesitter.setup({ + indent = { + enable = true, + }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, +}) diff --git a/nvim/.config/nvim/lua/plugins/which-key.lua b/nvim/.config/nvim/lua/plugins/which-key.lua index 0886853..f45cb52 100644 --- a/nvim/.config/nvim/lua/plugins/which-key.lua +++ b/nvim/.config/nvim/lua/plugins/which-key.lua @@ -1,34 +1,34 @@ local status_ok, which_key = pcall(require, "which-key") if not status_ok then - return + return end local setup = { - plugins = { - spelling = { - enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions - suggestions = 20, -- how many suggestions should be shown in the list? - }, - }, - window = { - border = "rounded", -- none, single, double, shadow - position = "bottom", -- bottom, top - margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] - padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] - winblend = 0, - }, - 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 = "center", -- align columns left, center or right - }, + plugins = { + spelling = { + enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions + suggestions = 20, -- how many suggestions should be shown in the list? + }, + }, + window = { + border = "rounded", -- none, single, double, shadow + position = "bottom", -- bottom, top + margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] + padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] + winblend = 0, + }, + 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 = "center", -- align columns left, center or right + }, } local opts = { - buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings - silent = true, -- use `silent` when creating keymaps - noremap = true, -- use `noremap` when creating keymaps - nowait = true, -- use `nowait` when creating keymaps + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = true, -- use `nowait` when creating keymaps } which_key.setup(setup) diff --git a/nvim/.config/nvim/lua/utils.lua b/nvim/.config/nvim/lua/utils.lua index 14c6e62..bc733de 100644 --- a/nvim/.config/nvim/lua/utils.lua +++ b/nvim/.config/nvim/lua/utils.lua @@ -1,9 +1,11 @@ local M = {} function M.map(mode, lhs, rhs, opts) - local options = {noremap = true} - if opts then options = vim.tbl_extend("force", options, opts) end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) + local options = { noremap = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) end -return M
\ No newline at end of file +return M |