diff --git a/init.lua b/init.lua index 1c27a43..ff3cfba 100644 --- a/init.lua +++ b/init.lua @@ -39,7 +39,6 @@ o.title = true -- Set title of terminal window o.updatetime = 300 -- Write swap file every 300 ms (supposedly reduces delays) o.foldlevel = 99 -- Keep all folds open o.foldlevelstart = 99 -o.foldenable = true -- Don't disable folds o.conceallevel = 2 -- Hide concealed text, use replacement if defined opt.listchars = { -- Symbols for whitespace chars when 'list' is enabled tab = '🭰 ', @@ -49,9 +48,6 @@ opt.listchars = { -- Symbols for whitespace chars when 'list' is ena opt.fillchars = { -- Characters to fill certain types of empty space with diff = ' ', fold = ' ', - foldopen= '', - foldsep=' ', - foldclose='' } opt.diffopt:append({'indent-heuristic', 'algorithm:histogram'}) @@ -115,24 +111,14 @@ do -- which-key might not be available yet local ok, which_key = pcall(require, 'which-key') if ok then - which_key.register { - ['!'] = {'copen', 'Quickfix window'}, - [''] = {'set number! relativenumber!', 'Toggle relative numbers'}, - [''] = {'set number!', 'Toggle line numbers'}, - [''] = {'h', 'Go to the left window'}, - [''] = {'l', 'Go to the right window'}, - [''] = {'j', 'Go to the up window'}, - [''] = {'k', 'Go to the down window'}, - ['+'] = {zoom_in, "Zoom in"}, - ['-'] = {zoom_out, "Zoom out"}, - ['q'] = { - name = 'Quickfix', - q = {'copen', 'Quickfix list'}, - c = {'cclose', 'Close quickfix'}, - n = {'cnext', 'Next quickfix'}, - p = {'cprev', 'Previous quickfix'}, - } - } + which_key.register { ['!'] = {'copen', 'Quickfix window'} } + which_key.register { [''] = {'set number! relativenumber!', 'Toggle relative numbers'} } + which_key.register { [''] = {'set number!', 'Toggle line numbers'} } + + which_key.register { [''] = {'h', 'Go to the left window'} } + which_key.register { [''] = {'l', 'Go to the right window'} } + which_key.register { [''] = {'n', 'Go to the up window'} } + which_key.register { [''] = {'e', 'Go to the down window'} } which_key.register { [''] = {function () local ok, notify = pcall(require, 'notify') @@ -180,8 +166,7 @@ au('User', { vim.keymap.set('', 'n', 'gj', {silent = true, buffer = true}) vim.keymap.set('', 'e', 'gk', {silent = true, buffer = true}) end - end, - desc = 'Override Startify mappings', + end }) au('BufWritePost', { pattern = '*/.config/nvim/init.lua', @@ -266,7 +251,6 @@ require'packer'.startup(function(use) use 'mboughaba/i3config.vim' use 'plasticboy/vim-markdown' use 'mracos/mermaid.vim' - use 'lifepillar/pgsql.vim' use 'ajouellette/sway-vim-syntax' use 'cespare/vim-toml' use 'rust-lang/rust.vim' @@ -301,13 +285,6 @@ require'packer'.startup(function(use) use {'julian/vim-textobj-variable-segment', requires = {'kana/vim-textobj-user'}, branch = 'main'} use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} use 'windwp/nvim-ts-autotag' - use {'kevinhwang91/nvim-ufo', requires = 'kevinhwang91/promise-async', config = function() - local ok, ufo = pcall(require, 'ufo') - if not ok then return end - vim.keymap.set('n', 'zR', ufo.openAllFolds) - vim.keymap.set('n', 'zR', ufo.closeAllFolds) - ufo.setup {} - end} use 'hrsh7th/vim-vsnip' -- LSP -- @@ -323,7 +300,7 @@ require'packer'.startup(function(use) use 'mfussenegger/nvim-jdtls' use 'simrat39/rust-tools.nvim' use 'pmizio/typescript-tools.nvim' - use {'nvimtools/none-ls.nvim', requires = {'nvim-lua/plenary.nvim'}, config = function () + use {'jose-elias-alvarez/null-ls.nvim', requires = {'nvim-lua/plenary.nvim'}, config = function () local null_ls = require'null-ls' null_ls.setup { sources = { @@ -435,9 +412,7 @@ require'packer'.startup(function(use) } end} use {'theHamsta/nvim-dap-virtual-text', config = function() - require'nvim-dap-virtual-text'.setup { - clear_on_continue = true, - } + require'nvim-dap-virtual-text'.setup{} end} use {'mxsdev/nvim-dap-vscode-js', requires = {'mfussenegger/nvim-dap'}, config = function() require'dap-vscode-js'.setup { @@ -544,10 +519,6 @@ require'packer'.startup(function(use) integrations = { diffview = true, }, - signs = { - item = {"", ""}, - section = {"", ""}, - }, } end} use {'rcarriga/nvim-notify', after = 'telescope.nvim', config = function () @@ -562,11 +533,7 @@ require'packer'.startup(function(use) end} use 'mhinz/vim-startify' use {'nvim-telescope/telescope.nvim', after = 'which-key.nvim', config = function() - local ok, telescope = pcall(require, 'telescope') - if not ok then return end - telescope.builtin = require'telescope.builtin' - telescope.themes = require'telescope.themes' - telescope.setup { + require'telescope'.setup { defaults = { sorting_strategy = 'ascending', mappings = { @@ -592,10 +559,8 @@ require'packer'.startup(function(use) -- TODO; check if this is right full_path = true, }, - ['ui-select'] = telescope.themes.get_cursor { - layout_config = { - height = 15, - }, + ['ui-select'] = { + require'telescope.themes'.get_cursor() }, }, } @@ -605,19 +570,9 @@ require'packer'.startup(function(use) [""] = {'Telescope', 'List pickers'}, f = {'Telescope find_files', 'Files'}, F = {'Telescope file_browser', 'File browser'}, - [''] = {function () - vim.ui.input({ completion = 'dir' }, function (input) - telescope.builtin.find_files { search_dirs = {input} } - end) - end, 'Files in subdirectory'}, d = {'Telescope find_files find_command=fd,--type,d,-I', 'Directories'}, r = {'Telescope oldfiles', 'Recent files'}, g = {'Telescope live_grep', 'Grep'}, - G = {function () - vim.ui.input({ completion = 'dir' }, function(input) - telescope.builtin.live_grep { search_dirs = {input} } - end) - end, 'Grep in subdirectory'}, b = {'Telescope buffers', 'Buffers'}, e = {'Telescope diagnostics', 'Diagnostics'}, h = {'Telescope help_tags', 'Help page'}, @@ -743,8 +698,8 @@ vim.keymap.set('n', 'G', 'tab Git', {desc = 'Git status (new ta require'gitsigns'.setup { on_attach = function () local gitsigns = require'gitsigns' - vim.keymap.set('n', ']c', gitsigns.next_hunk, {desc = 'Next hunk'}) - vim.keymap.set('n', '[c', gitsigns.prev_hunk, {desc = 'Previous hunk'}) + vim.keymap.set('n', ']h', gitsigns.next_hunk, {desc = 'Next hunk'}) + vim.keymap.set('n', '[h', gitsigns.prev_hunk, {desc = 'Previous hunk'}) --- Prompt interactively for global comparison base local function change_base() @@ -770,7 +725,7 @@ require'gitsigns'.setup { d = {gitsigns.toggle_deleted, 'Toggle deleted lines'}, w = {gitsigns.toggle_word_diff, 'Toggle word diffs'}, l = {gitsigns.blame_line, 'Blame current line'}, - L = {gitsigns.toggle_current_line_blame, 'Toggle line blame'}, + L = {gitsigns.toggle_line_blame, 'Toggle line blame'}, b = {':Gitsigns change_base ', 'Change diff base'}, B = {gitsigns.reset_base, 'Reset diff base'}, } @@ -842,7 +797,7 @@ cmp.setup { {'i', 's'} ), -- Scroll documentation up - [''] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}), + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}), -- Complete common substring @@ -889,13 +844,7 @@ cmp.setup.filetype({'dap-repl', 'dapui_watches', 'dapui_hover'}, { { name = 'dap' }, }, }) --- Which client functionality to tell LSP servers we support local capabilities = require'cmp_nvim_lsp'.default_capabilities() --- nvim-ufo folding capabilities -capabilities.textDocument.foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true, -} ---- lsp: language servers ---- --- Performs keymaps and other setup specific to buffers with LSP enabled @@ -906,14 +855,12 @@ local function on_attach(client, bufnr) require'which-key'.register({ ['l'] = { D = {vim.lsp.buf.declaration, 'Declaration'}, - d = {'Telescope lsp_definitions', 'Definition'}, - i = {'Telescope lsp_implementations', 'Implementation'}, + d = {vim.lsp.buf.definition, 'Definition'}, + i = {vim.lsp.buf.implementation, 'Implementation'}, a = {vim.lsp.buf.code_action, 'Code action'}, r = {vim.lsp.buf.rename, 'Rename'}, - l = {vim.lsp.codelens.refresh, 'Show codelenses'}, - L = {vim.lsp.codelens.run, 'Run codelens'}, - t = {'Telescope lsp_type_definitions', 'Type definition'}, - u = {'Telescope lsp_references', 'Usages/references'} + t = {vim.lsp.buf.type_definition, 'Type definition'}, + u = {vim.lsp.buf.references, 'Usages/references'} }, g = { d = {vim.lsp.buf.definition, 'Goto definition'}, @@ -941,7 +888,7 @@ local function on_attach(client, bufnr) [''] = {vim.lsp.buf.signature_help, 'Function signature'}, }, {buffer = bufnr}) require'which-key'.register({ - [''] = {vim.lsp.buf.signature_help, 'Function signature'} + ['t', 'NvimTreeFindFile', {desc = 'Nvim Tree'})