diff --git a/lua/core/init.lua b/lua/core/init.lua index 43d4211..e02514d 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -44,6 +44,8 @@ opt.timeoutlen = 400 opt.undofile = true opt.scrolloff = 15 +opt.wildignore:append "tags,Session.vim" + -- interval for writing swap file to disk, also used by gitsigns opt.updatetime = 250 diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index e9036cc..9101a7d 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -129,8 +129,8 @@ M.customstuffs = { -- Mappings: TODO -- "trim(system('git branch --show-current 2>/dev/null'))" - -- ["ct"] = { ":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO-' . trim(system('git branch --show-current 2>/dev/null')) . ': ' . input('Comment >'))", "Add TODO comment + add to quickfix list" }, - ["ct"] = { ":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO: ' . input('Comment >'))", "Add TODO comment + add to quickfix list" }, + -- ["ct"] = { ":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO-' . trim(system('git branch --show-current 2>/dev/null')) . ': ' . input('Comment >'))", "Add TODO comment + add to qflist" }, + ["ct"] = { ":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO: ' . input('Comment >'))", "Add TODO comment + add to qflist" }, ["ww"] = { ":lua require('nvim-window').pick()", "Pick window to goto" }, ["wm"] = { ":WinShift", "Enter move window mode" }, @@ -353,24 +353,47 @@ M.telescope = { [""] = { " Telescope live_grep ", "Live grep" }, [""] = { " Telescope buffers ", "Find buffers" }, - ["fg"] = { " lua require('telescope.builtin').live_grep({default_text=vim.fn.getreg('/')}) ", "Live grep with actual search value as prefix" }, - ["gf"] = { " lua require('telescope.builtin').find_files({default_text=vim.fn.getreg('/')}) ", "Live grep with actual search value as prefix" }, - ["ac"] = { ":execute 'vimgrep' input('Pattern >', getreg('/')) '**/*' ", "add search term files in quickfix list" }, - -- ["qr"] = { ":execute 'cdo' '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', getreg('')) . '/g | update' ", "Replace pattern in all quickfix list" }, - ["qr"] = { ":cdo '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', '') . '/g | update' ", "Replace pattern in all quickfix list" }, - ["br"] = { ":execute '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', '') . '/g | update' ", "Replace pattern in current buffer" }, + ["fg/"] = { " lua require('telescope.builtin').live_grep({default_text=vim.fn.getreg('/')}) ", "Live grep with search term" }, + ["fgw"] = { " lua require('telescope.builtin').live_grep({default_text=vim.fn.expand('')}) ", "Live grep with current word" }, - ["ql"] = { " Telescope quickfix ", "Show quickfix list" }, - ["qn"] = { ":cnext", "Jump to next in quickfix list" }, - ["qp"] = { ":cprevious", "Jump to previous in quickfix list" }, + ["gf/"] = { " lua require('telescope.builtin').find_files({default_text=vim.fn.getreg('/')}) ", "Find files with search term" }, + ["gfw"] = { " lua require('telescope.builtin').find_files({default_text=vim.fn.expand('')}) ", "Find files with current word" }, - ["ll"] = { " Telescope loclist ", "Show loclist list" }, + ["br"] = { ":execute '%s/' . input('Search term >') . '/' . input('Replace by >', '') . '/g | update' ", "Replace pattern in current buffer" }, + ["br/"] = { ":execute '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', '') . '/g | update' ", "Replace search term pattern in current buffer" }, + ["brw"] = { ":execute '%s/' . input('Search term >', expand('')) . '/' . input('Replace by >', '') . '/g | update' ", "Replace current word pattern in current buffer" }, + + -- Quickfix list + ["ql"] = { " Telescope quickfix ", "Show qflist" }, + ["qn"] = { ":cnext", "Jump to next in qflist" }, + ["]q"] = { ":cnext", "Jump to next in qflist" }, + ["qp"] = { ":cprevious", "Jump to previous in qflist" }, + ["[q"] = { ":cprevious", "Jump to previous in qflist" }, + ["qc"] = { ":call setqflist([]) | cclose", "Clear qflist" }, + + -- Quickfix replace all + ["qr"] = { ":execute 'cfdo' '%s/' . input('Search term >') . '/' . input('Replace by >') . '/gI | update' ", "Replace pattern in all qflist" }, + ["qr/"] = { ":execute 'cfdo' '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >') . '/gI | update' ", "Replace search term in all qflist" }, + ["qrw"] = { ":execute 'cfdo' '%s/' . input('Search term >', expand('')) . '/' . input('Replace by >') . '/gI | update' ", "Replace current word in all qflist" }, + + -- Quickfix "search" + ["qs"] = { ":execute 'vimgrep' '/' . input('Pattern >') . '\\C/' '**/*' ", "Add <> files in qflist" }, + ["qs/"] = { ":execute 'vimgrep' '/' . input('Pattern >', getreg('/')) . '\\C/' '**/*' ", "Add search term files in qflist" }, + ["qsw"] = { ":execute 'vimgrep' '/' . input('Pattern >', expand('')) . '\\C/' '**/*' ", "Add current word files in qflist" }, + + -- Loclist list + ["ll"] = { " Telescope loclist ", "Show loclist" }, ["ln"] = { ":lnext", "Jump to next in loclist" }, + ["]l"] = { ":lnext", "Jump to next in loclist" }, ["lp"] = { ":lprevious", "Jump to previous in loclist" }, + ["[l"] = { ":lprevious", "Jump to previous in loclist" }, + ["lc"] = { ":call setloclist([]) | lclose", "Clear loclist" }, ["fh"] = { " Telescope help_tags ", "Help page" }, ["fo"] = { " Telescope oldfiles ", "Find oldfiles" }, - ["fz"] = { " Telescope current_buffer_fuzzy_find ", "Find in current buffer" }, + ["fx"] = { " Telescope current_buffer_fuzzy_find ", "Find in current buffer" }, + ["fx/"] = { " lua require('telescope.builtin').current_buffer_fuzzy_find({default_text=vim.fn.getreg('/')}) ", "Fuzzy find in current buffer with actual search" }, + ["fxw"] = { " lua require('telescope.builtin').current_buffer_fuzzy_find({default_text=vim.fn.expand('')}) ", "Fuzzy find in current buffer with current word" }, ["wl"] = { " Telescope workspaces ", "Find workspaces" }, @@ -398,8 +421,8 @@ M.telescope = { ["/"] = { " Telescope search_history ", "telescope search history" }, -- Diaglist: LSP diagnostics in quick/loc list - ["dw"] = { "lua require('diaglist').open_all_diagnostics()", "Open all open buffers diagnostics in quickfix list" }, - ["d0"] = { "lua require('diaglist').open_buffer_diagnostics()", "Open current buffer diagnostics in loclist list" }, + ["dw"] = { "lua require('diaglist').open_all_diagnostics()", "Open all open buffers diagnostics in qflist" }, + ["d0"] = { "lua require('diaglist').open_buffer_diagnostics()", "Open current buffer diagnostics in loclist" }, [";"] = { " Telescope ", "Open Telescope" }, },