From 6371e90cc598e52b1d057d4b6d9a7b75d60e2fd0 Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 16 Dec 2022 23:42:26 +0200 Subject: Removed config/nvim --- config/nvim/lua/user/keys.lua | 651 ----------------------------------------- config/nvim/lua/user/mods.lua | 138 --------- config/nvim/lua/user/opts.lua | 237 --------------- config/nvim/lua/user/pack.lua | 403 ------------------------- config/nvim/lua/user/utils.lua | 85 ------ 5 files changed, 1514 deletions(-) delete mode 100644 config/nvim/lua/user/keys.lua delete mode 100644 config/nvim/lua/user/mods.lua delete mode 100644 config/nvim/lua/user/opts.lua delete mode 100644 config/nvim/lua/user/pack.lua delete mode 100644 config/nvim/lua/user/utils.lua (limited to 'config/nvim/lua/user') diff --git a/config/nvim/lua/user/keys.lua b/config/nvim/lua/user/keys.lua deleted file mode 100644 index dd48b76..0000000 --- a/config/nvim/lua/user/keys.lua +++ /dev/null @@ -1,651 +0,0 @@ ---[[ key.lua ]] - --- Shorten function name ---local keymap = vim.api.nvim_set_keymap -local keymap = vim.keymap - ---local function new_desc(d) --- return { desc = d } ---end --- ---local d = new_desc - ---local opts = { noremap = true, silent = true } -local term_opts = { noremap = true, silent = false } - local map = function(mode, l, r, opts) - opts = opts or {} - opts.silent = true - opts.noremap = true - keymap.set(mode, l, r, opts) - end - - ---------------- Standard Operations --------------- --- Semi-colon as leader key -vim.g.mapleader = ";" ---vim.g.maplocalleader = ";" - --- "jj" to exit insert-mode -map("i", "jk", "") - -map("n", "m", ":messages") -map("n", "cd", ":cd %:p:h:pwd") --- Print last error message or use these commands | v:errmsgv | :statusmsg | :h execute() | ---nnoremap x :put =trim(execute(input(':', '', 'command'))) --- Press x, then enter your command, such as 5mess and press . The last five message lines will be added to the current buffer. --- useful to copy error message when vim start - --- save quickly ---map("n", ";w", ":w", d("Save buffer")) - ---map("n", "so", ":luafile %") - ---vim.cmd([[ ---let $my_vimrc = $localappdata.'/nvim/init.lua' ---nnoremap so :source $my_vimrc ---]]) - --- Toggle between folds ---utils.map("n", "", "&foldlevel ? 'zM' : 'zR'", { expr = true }) - --- Move to the next and previous item in the quickfixlist ---utils.map("n", "]c", "cnext") ---utils.map("n", "[c", "cprevious") - --- Use space to toggle fold ---utils.map("n", "", "za") - --- Hitting ESC when inside a terminal to get into normal mode ---utils.map("t", "", [[]]) - --- select last change ---nnoremap gV `[v`] - ---map("n", "", function() --- notify.dismiss() --- vim.cmd.noh() ---end) - ---"nnore fast [e]dit and [s]ourcing .[v]imrc ---nnoremap ev :edit $MYVIMRC ---"fast macro ---nnoremap @ set lazyredraw execute 'noautocmd norm! ' . v:count1 . '@' . getcharstr() set nolazyredraw ---xnoremap @ :set lazyredraw execute "noautocmd '<,'>norm! " . v:count1 . "@" . getcharstr() set nolazyredraw - ---map("n", "", ":runtime! /lua/plugins/*.lua | :runtime! /lua/user/*.lua | :luafile ~/.config/nvim/init.lua", print ("Nvim reloaded")) ---map("n", "", ":lua require('init').unload_lua_namespace()", print ("Nvim reloaded")) ---map("n", "", "luafile ~/.config/nvim/init.lua", vim.notify("Nvim configuration reloaded!", vim.log.levels.INFO)) ---map("n", "", "luafile ~/.config/nvim/init.lua | :lua require("notify")("completion off")") ---map("n", "", "luafile ~/.config/nvim/init.lua", vim.api.nvim_echo({{'first chunk and ', 'None'}, {'second chunk to echo', 'None'}}, false, {})) ---map("n", "", "luafile ~/.config/nvim/init.lua", print ("Nvim config loading...")) ---map("n", "", "luafile ~/.config/nvim/init.lua | :echo ('hello') | ") -map("n", "", "luafile ~/.config/nvim/init.lua | :echom ('Nvim config loading...') | :sl! | echo ('')") -map("n", "u", ":echo '' | redraw") --clear messages ---map("n", "", "luafile ~/.config/nvim/init.lua") ---vim.api.nvim_set_keymap("n", "", "lua ReloadConfig()", { noremap = true, silent = false }) - -map("n", "tc", ":lua require('user.utils').toggle_completion()") --- vim.notify("Nvim configuration reloaded!", vim.log.levels.INFO) - ---vim.api.nvim_set_keymap('n', 'qr', ':lua require("plugins.telescope").reload()', { noremap = true, silent = true }) - ---Easier split navigations, just ctrl-j instead of ctrl-w then j -map("n", "", "") -map("n", "", "") -map("n", "", "") -map("n", "", "") - --- Combine buffers list with buffer name -map("n", "b", ":buffers:buffer") ---map("n", "b", ":ls:b") - --- Map buffer next, prev and delete to -map("n", "n", ":bn") -map("n", "p", ":bp") -map("n", "d", ":bd") - --- Disable default completion. -map('i', '', '') -map('i', '', '') - --- Set alt + j/k to switch lines of texts or simply move them -map("n", "", ':let save_a=@a"add"ap:let @a=save_a') -map("n", "", ':let save_a=@a"add"ap:let @a=save_a') - -map("i", "", "") - -map("n", "", "!clear") - -map("n", "y", ":BufferPick") - -vim.cmd([[ - inoremap - inoremap - inoremap - inoremap -]]) - -vim.cmd([[ - cnoremap - cnoremap - cnoremap - cnoremap -]]) - ---vim.cmd([[ --- cnoremap --- cnoremap --- cnoremap --- cnoremap ---]]) - -vim.cmd([[ - snoremap - snoremap - snoremap - snoremap -]]) - --- move block easily -map("n", "<", "<<", term_opts) -map("n", ">", ">>", term_opts) -map("x", "<", "", ">gv", term_opts) - --- Resize Panes -map("n", "+", ":resize +5") -map("n", "-", ":resize -5") -map("n", "<", ":vertical resize +5") -map("n", ">", ":vertical resize -5") -map("n", "=", "=") - --- New tab -map("n", "e", ":tabedit") - --- create tab like window -map("n", "h", ":tabprevious") -map("n", "l", ":tabnext") -map("n", "n", ":tabnew") - --- Vim TABs -map("n", "1", "1gt") -map("n", "2", "2gt") -map("n", "3", "3gt") -map("n", "4", "4gt") -map("n", "5", "5gt") -map("n", "6", "6gt") -map("n", "7", "7gt") -map("n", "8", "8gt") -map("n", "9", "9gt") -map("n", "0", "10gt") - --- Split window -map("n", "h", ":split") -map("n", "v", ":vsplit") -map("n", "c", "c") - --- Toggle set number -map("n", "$", ":NumbersToggle") -map("n", "%", ":NumbersOnOff") - --- Change mode to executable -map("n", "x", ":!chmod +x %") - --- Paste without replace clipboard -map("v", "p", '"_dP') - --- Paste end of line ---map("n", ",", "$p") ---vim.cmd([[ --- nmap , $p ---]]) - --- Select entire buffer ---map("v", "", "ggG") - --- Delete without changing the registers ---map('n', 'x', '"_x') - --- Select all text in current buffer ---map('n', 'a', ':keepjumps normal! ggVG') - --- Swap two pieces of text, use x to cut in visual mode, then use Ctrl-x in --- visual mode to select text to swap with -map("v", "", "`.``gvP``P") - --- Keep Visual mode selection when indenting text ---utils.map("x", ">", ">gv") ---utils.map("x", "<", "/", ":/\\<\\>", { silent = false }) - --- EasyAlign keybindings --- 'vipga' starts interactive EasyAlign in visual mode --- 'gaip' starts interactive EasyAlign for text/motion object ---utils.map({ "n", "x" }, "ga", "(EasyAlign)") ---utils.map({ "n", "x" }, "ga", "(LiveEasyAlign)") - --- Set a mark when moving more than 5 lines upwards/downards --- this will populate the jumplist enabling us to jump back with Ctrl-O ---utils.map("n", "k", [[(v:count > 5 ? "m'" . v:count : "") . 'k']], { expr = true }) ---utils.map("n", "j", [[(v:count > 5 ? "m'" . v:count : "") . 'j']], { expr = true }) - --- Zoom toggle a buffer in a new tab ---utils.map("n", "z", function() --- require("tt.helper").zoomToggleNewTab() ---end, { desc = "Zoom toggle a buffer in a new tab" }) - --- Hitting ESC when inside a terminal to get into normal mode ---utils.map("t", "", [[]]) - --- markdown-preview -map("n", "md", "MarkdownPreviewToggle") - - --- Search and replace -map("v", "sr", 'y:%s/"//gc') ---vnoremap ; :call Get_visual_selection() --- ---function! Get_visual_selection() --- " Why is this not a built-in Vim script function?! --- let [lnum1, col1] = getpos("'<")[1:2] --- let [lnum2, col2] = getpos("'>")[1:2] --- let lines = getline(lnum1, lnum2) --- let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)] --- let lines[0] = lines[0][col1 - 1:] --- let selection = join(lines,'\n') --- let change = input('Change the selection with: ') --- execute ":%s/".selection."/".change."/g" ---endfunction -vim.cmd([[ -let s:hidden_all = 0 -function! ToggleHiddenAll() - if s:hidden_all == 0 - let s:hidden_all = 1 - set noshowmode - set noruler - set laststatus=0 - set noshowcmd - else - let s:hidden_all = 0 - set showmode - set ruler - set laststatus=2 - set showcmd - endif -endfunction -nnoremap :call ToggleHiddenAll() -]]) - -vim.cmd([[ - map s :up \| saveas! %:p:r-=strftime("%y.%m.%d-%H:%M")-bak.=expand("%:e") \| 3sleep \| e # -]]) - --- Execute this file ---map("n", "x", ":call scripts#save_and_exec()", print("save & exec")) -vim.cmd([[ - " Execute this file - nnoremap x :call scripts#save_and_exec()\|:echom "save & exec . . ." - -]]) - --------------- FZF -------------- -map("n", "fz", "lua require('fzf-lua').files()") - --------------- Telescope -------------- ---Telescope find_files cwd=.. -map("n", "fc", "lua require('telescope.builtin').commands()") -map("n", "cf", "Telescope changed_files") -map("n", "fk", "lua require('telescope.builtin').keymaps()") -map("n", "fh", "lua require('telescope.builtin').help_tags()") ---map( --- "n", --- "ft", --- "lua require('telescope.builtin').builtin(require('telescope.themes').get_dropdown({}))") - --- maps.n["fF"] = { --- function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end, --- desc = "Search all files", --- Telescope find_files hidden=true ---map("n", "fh", "lua require('telecsope.builtin').file_files hidden=true") -map("n", "fF", function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end) ---map("n", "fe", ":lua require('telescope.builtin').file_browser({cwd = '.'})") -map("n", "fg", "lua require('telescope.builtin').live_grep()") -map("n", "fb", "lua require('telescope.builtin').current_buffer_fuzzy_find()") -map("n", "fd", "lua require('telescope.builtin').diagnostics()") -map("n", "fp", "Telescope pickers") - --- find notes -map("n", "fn", [[lua require'plugins.telescope'.find_notes()]]) --- search notes -map("n", "fgn", [[lua require'plugins.telescope'.grep_notes()]]) --- Find files in config dirs -map("n", "f.", [[lua require'plugins.telescope'.find_configs()]]) ---map("n", "fz", ":FZF") ---map("t", [[]], [[]]) ---map("n", "ff", ":NvimTreeToggle", {}) -map("n", "f", ":NvimTreeToggle", {}) --- This avoids crashing fzf menu running in TERMINAL MODE (:q if you do) --- Find files in config dirs ---key_map("n", "e", ":lua require('plugins.telescope').find_configs()", opts) ---map("n", "f.", "lua require('plugins.telescope').find_configs({})") ---map("n", "ft", "lua require('plugins.telescope').file_explorer({})") ---map("n", "fd", "lua require('plugins.telescope').find_notes({})") -map("n", "fm", "lua require('telescope').extensions.media_files.media_files({})") --- registers picker -map("n", "r", "lua require('telescope.builtin').registers({})") --- find files including gitignored ---keymap( --- "n", --- "fg", --- "lua require('telescope.builtin').find_files({find_command={'fd','--no-ignore-vcs'}})") --- open available commands & run it ---map("n", "fc", "lua require('telescope.builtin').commands({results_title='Commands Results'})") - --------------- Autopairs -------------- -Toggle_autopairs = function() - local ok, autopairs = pcall(require, "nvim-autopairs") - if ok then - if autopairs.state.disabled then - autopairs.enable() - print("autopairs on") - else - autopairs.disable() - print("autopairs off") - end - else - print("autopairs not available") - end -end -map("n", "ww", ":lua Toggle_autopairs()", term_opts) - --------------- Functions -------------- --- Toggle transparency -vim.cmd([[ - let t:is_transparent = 0 - function! Toggle_transparent_background() - if t:is_transparent == 0 - hi Normal guibg=#111111 ctermbg=black - let t:is_transparent = 1 - else - hi Normal guibg=NONE ctermbg=NONE - let t:is_transparent = 0 - endif - endfunction - nnoremap tb :call Toggle_transparent_background() -]]) ---keymap('n', 'tb', ':Toggle_transparent_background') - --- Toggle zoom -vim.cmd([[ - function! s:ZoomToggle() abort - if exists('t:zoomed') && t:zoomed - execute t:zoom_winrestcmd - let t:zoomed = 0 - else - let t:zoom_winrestcmd = winrestcmd() - resize - vertical resize - let t:zoomed = 1 - endif - endfunction - command! ZoomToggle call s:ZoomToggle() - ]]) -map("n", "z", ":ZoomToggle") --- "Zoom" a split window into a tab and/or close it ---keymap('n', ',', ':tabnew %') ---keymap('n', '.', ':tabclose') - --- Open last closed buffer -vim.cmd([[ - function! OpenLastClosed() - let last_buf = bufname('#') - if empty(last_buf) - echo "No recently closed buffer found" - return - endif - let result = input("Open ". last_buf . " in (n)ormal (v)split, (t)ab or (s)plit ? (n/v/t/s) : ") - if empty(result) || (result !=# 'v' && result !=# 't' && result !=# 's' && result !=# 'n') - return - endif - if result ==# 't' - execute 'tabnew' - elseif result ==# 'v' - execute "vsplit" - elseif result ==# 's' - execute "split" - endif - execute 'b ' . last_buf - endfunction - ]]) -map("n", "", ":call OpenLastClosed() ") - --- Tabularize -vim.cmd([[ - vnoremap mm ':Tabularize /^\s*\S.*\zs' . split(&commentstring, '%s')[0] . "" - nnoremap mm ':Tabularize /^\s*\S.*\zs' . split(&commentstring, '%s')[0] . "" - "nnoremap i mc40A 080lDgelD`cP - "vnoremap ii mc0f-20i`cdt=j -]]) - -vim.cmd([[ - " Start interactive EasyAlign in visual mode (e.g. vipga) - xmap ga (EasyAlign) - " Start interactive EasyAlign for a motion/text object (e.g. gaip) - nmap ga (EasyAlign) - if !exists('g:easy_align_delimiters') - let g:easy_align_delimiters = {} - endif - let g:easy_align_delimiters['--'] = { 'pattern': '--', 'ignore_groups': ['String'] } - nnoremap 21A d21\| - imap a -]]) ---:'<,'>EasyAlign /--/ ---EasyAlign /--/ ---:'<,'>Tabularize /-- - ---map("n", ",", ":hide") ---map("n", ".", ":unhide") - ---" Clean trailing whitespace ---nnoremap ww mz:%s/\s\+$//:let @/=''`z - --- Save with root permission (not working for now) ---vim.api.nvim_create_user_command('W', 'w !sudo tee > /dev/null %', {}) - --- Copy and Paste with and ---keymap('n', ' p', (v:register =--= '"' && &clipboard =~ 'unnamed' ? '"*p' : '"' . v:register . 'p')'') --- Use command :Vb for Visual Block or since is used for Copy ---command! Vb normal! --- Map to save/edit a root permission/read-only file, only works in --- traditional vim and not neovim ---keymap('c', 'w!! %!sudo tee > /dev/null') ---" Copying text to the system clipboard. ---" ---" For some reason Vim no longer wants to talk to the OS X pasteboard through "*. ---" Computers are bullshit. ---function! g:FuckingCopyTheTextPlease() --- let old_z = @z --- normal! gv"zy --- call system('pbcopy', @z) --- let @z = old_z ---endfunction ---noremap p :silent! set paste"*p:set nopaste ---" noremap p mz:r!pbpaste`z ---vnoremap y :call g:FuckingCopyTheTextPlease() - ---" Indent/dedent/autoindent what you just pasted. ---nnoremap > V`]< ---nnoremap > V`]> ---nnoremap =- V`]= - ---" Keep the cursor in place while joining lines ---nnoremap J mzJ`z - ---" Toggle [i]nvisible characters ---nnoremap i :set list! --- ---" Unfuck my screen ---nnoremap U :syntax sync fromstart:redraw! - ---" Ranger ---nnoremap r :silent !ranger %:h:redraw! ---nnoremap R :silent !ranger:redraw! --- ---" Insert Mode Completion {{{ --- ---inoremap ---inoremap ---inoremap ----- Open the current file in the default program (on Mac this should just be just `open`) ---keymap('n', 'x', ':!xdg-open %') - -map("n", "ff", "lua require('telescope.builtin').find_files()") ---keymap("n", "ff", "lua require('telescope.builtin').find_files cwd=..()") ---keymap('n', 'k', ':nohlsearch') --- ---"This unsets the "last search pattern" register by hitting return -vim.cmd([[ - nnoremap :noh -]]) - ---keymap('n', 'Q', ':bufdo bdelete') --- ----- Allow gf to open non-existent files ---keymap('', 'gf', ':edit ') --- ----- Reselect visual selection after indenting ---keymap('v', '<', '', '>gv') --- ----- Maintain the cursor position when yanking a visual selection ----- http://ddrscott.github.io/blog/2016/yank-without-jank/ ---keymap('v', 'y', 'myy`y') ---keymap('v', 'Y', 'myY`y') ---keymap("n", "", ":q") ---keymap("n", "", ":qa!") - ---" Sort lines ---nnoremap s vip:!sort ---vnoremap s :!sort --- ---" Tabs ---nnoremap ( :tabprev ---nnoremap ) :tabnext --- ---" Wrap ---nnoremap W :set wrap! - ---set foldlevelstart=0 --- ---" Space to toggle folds. ---nnoremap za ---vnoremap za ---" Make zO recursively open whatever fold we're in, even if it's partially open. ---nnoremap zO zczO - --- Packer ---maps.n["pc"] = { "PackerCompile", desc = "Packer Compile" } ---maps.n["pi"] = { "PackerInstall", desc = "Packer Install" } ---maps.n["ps"] = { "PackerSync", desc = "Packer Sync" } ---maps.n["pS"] = { "PackerStatus", desc = "Packer Status" } ---maps.n["pu"] = { "PackerUpdate", desc = "Packer Update" } --- NeoTree ---if is_available "neo-tree.nvim" then --- keymaps.n["e"] = { "Neotree toggle", desc = "Toggle Explorer" } --- keymaps.n["o"] = { "Neotree focus", desc = "Focus Explorer" } ---end --- Alpha ---if is_available "alpha-nvim" then maps.n["d"] = { "Alpha", desc = "Alpha Dashboard" } end - --- Package Manager --- TODO: v2 rework these key bindings to be more general ---if is_available "mason.nvim" then maps.n["lI"] = { "Mason", desc = "LSP installer" } end --- Telescope ---if is_available "telescope.nvim" then --- maps.n["fw"] = { function() require("telescope.builtin").live_grep() end, desc = "Search words" } --- maps.n["fW"] = { --- function() --- require("telescope.builtin").live_grep { --- additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end, --- } --- end, --- desc = "Search words in all files", --- } --- maps.n["gt"] = { function() require("telescope.builtin").git_status() end, desc = "Git status" } --- maps.n["gb"] = { function() require("telescope.builtin").git_branches() end, desc = "Git branches" } --- maps.n["gc"] = { function() require("telescope.builtin").git_commits() end, desc = "Git commits" } --- maps.n["ff"] = { function() require("telescope.builtin").find_files() end, desc = "Search files" } --- maps.n["fF"] = { --- function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end, --- desc = "Search all files", --- } --- maps.n["fb"] = { function() require("telescope.builtin").buffers() end, desc = "Search buffers" } --- maps.n["fh"] = { function() require("telescope.builtin").help_tags() end, desc = "Search help" } --- maps.n["fm"] = { function() require("telescope.builtin").marks() end, desc = "Search marks" } --- maps.n["fo"] = { function() require("telescope.builtin").oldfiles() end, desc = "Search history" } --- maps.n["fc"] = --- { function() require("telescope.builtin").grep_string() end, desc = "Search for word under cursor" } --- maps.n["sb"] = { function() require("telescope.builtin").git_branches() end, desc = "Git branches" } --- maps.n["sh"] = { function() require("telescope.builtin").help_tags() end, desc = "Search help" } --- maps.n["sm"] = { function() require("telescope.builtin").man_pages() end, desc = "Search man" } --- maps.n["sn"] = --- { function() require("telescope").extensions.notify.notify() end, desc = "Search notifications" } --- maps.n["sr"] = { function() require("telescope.builtin").registers() end, desc = "Search registers" } --- maps.n["sk"] = { function() require("telescope.builtin").keymaps() end, desc = "Search keymaps" } --- maps.n["sc"] = { function() require("telescope.builtin").commands() end, desc = "Search commands" } --- maps.n["ls"] = { --- function() --- local aerial_avail, _ = pcall(require, "aerial") --- if aerial_avail then --- require("telescope").extensions.aerial.aerial() --- else --- require("telescope.builtin").lsp_document_symbols() --- end --- end, --- desc = "Search symbols", --- } --- maps.n["lR"] = { function() require("telescope.builtin").lsp_references() end, desc = "Search references" } ---end --- ----- Terminal ---if is_available "toggleterm.nvim" then --- local toggle_term_cmd = astronvim.toggle_term_cmd --- maps.n[""] = { "ToggleTerm", desc = "Toggle terminal" } --- maps.n["gg"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" } --- maps.n["tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" } --- maps.n["tu"] = { function() toggle_term_cmd "ncdu" end, desc = "ToggleTerm NCDU" } --- maps.n["tt"] = { function() toggle_term_cmd "htop" end, desc = "ToggleTerm htop" } --- maps.n["tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" } --- maps.n["tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" } --- maps.n["tf"] = { "ToggleTerm direction=float", desc = "ToggleTerm float" } --- maps.n["th"] = { "ToggleTerm size=10 direction=horizontal", desc = "ToggleTerm horizontal split" } --- maps.n["tv"] = { "ToggleTerm size=80 direction=vertical", desc = "ToggleTerm vertical split" } ---end --- ----- Stay in indent mode ---maps.v["<"] = { ""] = { ">gv", desc = "indent line" } --- ----- Improved Terminal Mappings ---maps.t[""] = { "", desc = "Terminal normal mode" } ---maps.t["jk"] = { "", desc = "Terminal normal mode" } ---maps.t[""] = { "h", desc = "Terminal left window navigation" } ---maps.t[""] = { "j", desc = "Terminal down window navigation" } ---maps.t[""] = { "k", desc = "Terminal up window navigation" } ---maps.t[""] = { "l", desc = "Terminal right window naviation" } --- LSP Installer ---if is_available "mason-lspconfig.nvim" then maps.n["li"] = { "LspInfo", desc = "LSP information" } end - --- ALE: toggle _ALE activity ---keymap('n', 'a',[[:ALEToggle]]) - ---keymap('n', 'cd', ':call fzf#run({'source': 'fd -t d -H . ~', 'sink': 'cd'})') --- ":lua require('neogen').generate()") ---keymap("n", "ww", ":set wrap!") --- diff --git a/config/nvim/lua/user/mods.lua b/config/nvim/lua/user/mods.lua deleted file mode 100644 index ec77173..0000000 --- a/config/nvim/lua/user/mods.lua +++ /dev/null @@ -1,138 +0,0 @@ ---vim.cmd([[ --- function RandomColorScheme() --- let mycolors = split(globpath(&rtp,"**/colors/*.vim"),"\n") --- exe 'so ' . mycolors[localtime() % len(mycolors)] --- unlet mycolors --- endfunction --- --- call RandomColorScheme() --- --- :command NewColor call RandomColorScheme() ---]]) - ---vim.cmd([[ --- function RandomColorSchemeMyPicks() --- let mypicks = ["pyte", "fokus", "github", "peachpuff", "morning", "simple256", "xcode", "gruvbox"] --- let mypick = mypicks[localtime() % len(mypicks)] --- echom mypick --- execute 'colo' mypick --- endfunction --- --- command NewColor call RandomColorSchemeMyPicks() --- --- let s:use_gui = exists('g:neovide') || has('gui_running') || (has('termguicolors') && &termguicolors) --- if (s:use_gui) --- call RandomColorSchemeMyPicks() --- endif ---]]) - -vim.cmd([[ - let g:fzf_history_dir = '~/.local/share/fzf-history' - map z :FZF - map a :Files - map l :Lines - map L :BLines - map B :Buffers - map h :History: - nnoremap g :Rg - "nnoremap t :Tags - nnoremap m :Marks - " This is the default extra key bindings - let g:fzf_action = { - \ 'ctrl-t': 'tab split', - \ 'ctrl-x': 'split', - \ 'ctrl-y': 'vsplit' } - let g:fzf_tags_command = 'ctags -R' - " Border color - let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } } - let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline' - let $FZF_DEFAULT_COMMAND="rg --files --hidden" - " Customize fzf colors to match your color scheme - let g:fzf_colors = - \ { 'fg': ['fg', 'Normal'], - \ 'bg': ['bg', 'Normal'], - \ 'hl': ['fg', 'Comment'], - \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], - \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], - \ 'hl+': ['fg', 'Statement'], - \ 'info': ['fg', 'PreProc'], - \ 'border': ['fg', 'Ignore'], - \ 'prompt': ['fg', 'Conditional'], - \ 'pointer': ['fg', 'Exception'], - \ 'marker': ['fg', 'Keyword'], - \ 'spinner': ['fg', 'Label'], - \ 'header': ['fg', 'Comment'] } - " Get Files - command! -bang -nargs=? -complete=dir Files - \ call fzf#vim#files(, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), 0) - " Get text in files with Rg - command! -bang -nargs=* Rg - \ call fzf#vim#grep( - \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(), 1, - \ fzf#vim#with_preview(), 0) - " Ripgrep advanced - function! RipgrepFzf(query, fullscreen) - let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' - let initial_command = printf(command_fmt, shellescape(a:query)) - let reload_command = printf(command_fmt, '{q}') - let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} - call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) - endfunction - command! -nargs=* -bang RG call RipgrepFzf(, 0) - " Git grep - command! -bang -nargs=* GGrep - \ call fzf#vim#grep( - \ 'git grep --line-number '.shellescape(), 0, - \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0) - command! -bang FM call fzf#run(fzf#wrap({'source': 'cat ~/.fzf-marks | sed "s/.*: \(.*\)$/\1/" | sed "s#~#${HOME}#"', 'sink': 'lcd'}, 0)) -]]) - -vim.cmd([[ - " Enable mouse scrollback - set mouse=a - tnoremap - tnoremap - function! ClearTerminal() - set scrollback=1 - let &g:scrollback=1 - echo &scrollback - call feedkeys("\i") - call feedkeys("clear\") - call feedkeys("\\") - call feedkeys("\i") - sleep 100m - let &scrollback=s:scroll_value - endfunction -]]) - -vim.cmd([[ - " :Rename {newname} - function! RenameFile() - let old_name = expand('%') - let new_name = input('New file name: ', expand('%'), 'file') - if new_name != '' && new_name != old_name - exec ':saveas ' . new_name - exec ':silent !rm ' . old_name - redraw! - endif - endfunction - map re :call RenameFile() -]]) - ---vim.cmd([[ --- " Markdown Settings --- autocmd BufNewFile,BufReadPost *.md set filetype=markdown --- let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'sql', 'pug'] --- let g:markdown_minlines = 100 --- let g:instant_markdown_autostart = 0 ---]]) --- ---vim.cmd([[ --- " On The Fly Table mode --- function! s:isAtStartOfLine(mapping) --- let text_before_cursor = getline('.')[0 : col('.')-1] --- let mapping_pattern = '\V' . escape(a:mapping, '\') --- let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') --- return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') --- endfunction ---]]) diff --git a/config/nvim/lua/user/opts.lua b/config/nvim/lua/user/opts.lua deleted file mode 100644 index 6da4234..0000000 --- a/config/nvim/lua/user/opts.lua +++ /dev/null @@ -1,237 +0,0 @@ ---[[ opts.lua ]] - -vim.cmd([[ - "filetype plugin indent on " Load indent files, to automatically do language-dependent indenting. - "autocmd BufEnter * :syntax sync fromstart - "syntax enable - let g:clipbrdDefaultReg = '+' - "set nocompatible - "autocmd FileType lua set comments=s1:---,m:--,ex:-- - nnoremap @ execute "noautocmd norm! " . v:count1 . "@" . getcharstr() " Fast macros without lazyredraw - xnoremap @ :execute "noautocmd '<,'>norm! " . v:count1 . "@" . getcharstr() -]]) - --- Environment ---vim.opt.shell = "zsh" -- -vim.o.shell = "/bin/zsh" -vim.scriptencoding = "utf-8" -- -vim.opt.encoding = "utf-8" -- -vim.opt.fileencoding = "utf-8" -- -vim.g.python3_host_prog = "/usr/bin/python3" -- -vim.g.loaded_python3_provider = 1 -- -vim.g.sh_noisk = 1 -- iskeyword word boundaries when editing a 'sh' file -vim.o.autochdir = true ---vim.opt.sessionoptions = "buffers,curdir,folds,help,tabpages,winsize,resize,winpos,terminal,globals" -- - --- Colors -vim.opt.termguicolors = true - --- Behaviour -vim.opt.clipboard:append({ "unnamedplus" }) -- Install xclip or this will slowdown startup -vim.opt.backspace = { "start", "eol", "indent" } -- Make backspace work as you would expect. -vim.opt.hidden = true -- Switch between buffers without having to save first. -vim.opt.splitbelow = true -- make split put the new buffer below the current buffer -vim.opt.splitright = true -- make vsplit put the new buffer on the right of the current buffer -vim.opt.scrolloff = 8 -- -vim.opt.sidescrolloff = 8 -- how many lines to scroll when using the scrollbar -vim.opt.autoread = true -- reload files if changed externally -vim.opt.display = "lastline" -- Show as much as possible of the last line. -vim.opt.inccommand = "split" -- -vim.opt.ttyfast = true -- Faster redrawing. ---vim.opt.lazyredraw = true -- Only redraw when necessary -vim.opt.keywordprg = ":help" -- :help options -vim.opt.ruler = true -- -vim.opt.errorbells = false -- -vim.opt.list = true -- Show non-printable characters. -vim.opt.showmatch = true -- -vim.opt.matchtime = 3 -- -vim.opt.showbreak = "↪ " -- -vim.opt.linebreak = true -- -vim.opt.exrc = true -- ---vim.opt.autochdir = true -- or use this to use <:e> to create a file in current directory -vim.opt.autoread = true -- if a file is changed outside of vim, automatically reload it without asking ---vim.opt.notimeout = true -- Timeout on keycodes and not mappings -vim.opt.ttimeout = true -- Makes terminal vim work sanely -vim.opt.ttimeoutlen = 10 -- ---vim.opt.timeoutlen = 100 -- time to wait for a mapped sequence to complete (in milliseconds) ---vim.cmd([[set diffopt = vertical = true]]) -- diffs are shown side-by-side not above/below - --- Indent/tab -vim.opt.breakindent = true -- -vim.opt.autoindent = true -- Indent according to previous line. -vim.opt.copyindent = true -- Copy indent from the previous line -vim.opt.smarttab = false -- -vim.opt.tabstop = 2 -- -vim.opt.expandtab = true -- Indent according to previous line. ---vim.opt.expandtab = true -- Use spaces instead of tabs. -vim.opt.softtabstop = 2 -- Tab key indents by 2 spaces. -vim.opt.shiftwidth = 2 -- >> indents by 2 spaces. -vim.opt.shiftround = true -- >> indents to next multiple of 'shiftwidth'. -vim.opt.smartindent = true -- smart indent - --- Column/statusline/Cl -vim.opt.number = true -- -vim.opt.title = true -- ---vim.opt.colorcolumn = "+1" -- -vim.opt.signcolumn = "yes:1" -- always show the sign column ---vim.opt.signcolumn = "yes:" .. vim.o.numberwidth ---vim.opt.signcolumn = "number" ---vim.opt.signcolumn = "no" -- -vim.opt.laststatus = 3 -- " Always show statusline. -vim.opt.showmode = true -- Show current mode in command-line, example: -- INSERT -- mode -vim.opt.showcmd = true -- Show the command in the status bar -vim.opt.cmdheight = 1 -- ---vim.opt.cmdheight = 0 -- -vim.opt.report = 0 -- Always report changed lines. ---local autocmd = vim.api.nvim_create_autocmd ---autocmd("bufenter", { --- pattern = "*", --- callback = function() --- if vim.bo.ft ~= "terminal" then --- vim.opt.statusline = "%!v:lua.require'ui.statusline'.run()" --- else --- vim.opt.statusline = "%#normal# " --- end --- end, ---}) ----- With vertical splits, the statusline would still show up at the ----- bottom of the split. A quick fix is to just set the statusline ----- to empty whitespace (it can't be an empty string because then ----- it'll get replaced by the default stline). ---vim.opt.stl = " " - --- Backup/undo -vim.opt.backup = false -- ---vim.opt.noswapfile = true -- ---vim.opt.undofile = true -- -vim.opt.backupskip = { "/tmp/*", "/private/tmp/*" } -- - --- Format -vim.opt.textwidth = 80 -- -vim.cmd([[let &t_Cs = "\e[4:3m"]]) -- Undercurl -vim.cmd([[let &t_Ce = "\e[4:0m"]]) -- -vim.opt.path:append({ "**" }) -- Finding files - Search down into subfolder -vim.cmd("set whichwrap+=<,>,[,],h,l") -- -vim.cmd([[set iskeyword+=-]]) -- ---vim.cmd([[set formatoptions-=cro]]) -- TODO: this doesn't seem to work -vim.opt.formatoptions = vim.opt.formatoptions - - "t" -- wrap with text width - + "c" -- wrap comments - + "r" -- insert comment after enter - - "o" -- insert comment after o/O - - "q" -- allow formatting of comments with gq - - "a" -- format paragraphs - + "n" -- recognized numbered lists - - "2" -- use indent of second line for paragraph - + "l" -- long lines are not broken - + "j" -- remove comment when joining lines -vim.opt.wrapscan = true -- " Searches wrap around end-of-file. ---vim.wo.number = true -- ---vim.opt.wrap = false -- No Wrap lines ---vim.opt.foldmethod = 'manual' -- ---vim.opt.foldmethod = "expr" -- -vim.opt.foldmethod = "manual" -vim.opt.foldlevel = 3 -vim.opt.confirm = true -vim.opt.shortmess:append("sI") ---vim.opt.shortmess = "a" ---vim.opt.shortmess = "sI" ---vim.o.shortmess = vim.o.shortmess:gsub('s', '') -vim.opt.fillchars = { - horiz = "━", - horizup = "┻", - horizdown = "┳", - vert = "┃", - vertleft = "┨", - vertright = "┣", - verthoriz = "╋", - fold = "⠀", - eob = " ", - diff = "┃", - msgsep = "‾", - foldopen = "▾", - foldsep = "│", - foldclose = "▸", -} -vim.opt.listchars = { tab = "▸ ", trail = "·" } -- ---vim.opt.fillchars:append({ eob = " " }) -- remove the ~ from end of buffer -vim.opt.modeline = true -- -vim.opt.modelines = 3 -- modelines (comments that set vim options on a per-file basis) ---vim.opt.modelineexpr = true ---vim.opt.nofoldenable = true -- turn folding off ---vim.opt.foldenable = false -- turn folding off -vim.o.showtabline = 2 - --- Highlights -vim.opt.incsearch = true -- Highlight while searching with / or ?. -vim.opt.hlsearch = true -- Keep matches highlighted. -vim.opt.ignorecase = true -- ignore case in search patterns UNLESS /C or capital in search -vim.opt.smartcase = true -- smart case -vim.opt.synmaxcol = 200 -- Only highlight the first 200 columns. -vim.opt.winblend = 30 ---vim.opt.winblend = 5 -vim.opt.wildoptions = "pum" -- ---vim.opt.pumblend = 5 -- -vim.opt.pumblend = 12 -- ---vim.opt.pumblend=15 -vim.opt.pumheight = 10 -- pop up menu height - --- Better Completion -vim.opt.complete = { ".", "w", "b", "u", "t" } -- ---vim.opt.completeopt = { "longest,menuone,preview" } -- -vim.opt.completeopt = {'menu', 'menuone', 'noselect'} ---vim.opt.completeopt = { "menuone", "noselect" } -- mostly just for cmp ---vim.opt.completeopt = { "menu", "menuone", "noselect" } -- - --- Wildmenu completion -- -vim.opt.wildmenu = true -- -vim.opt.wildmode = { "list:longest" } -- -vim.opt.wildignore:append({ ".hg", ".git", ".svn" }) -- Version control -vim.opt.wildignore:append({ "*.aux", "*.out", "*.toc" }) -- LaTeX intermediate files -vim.opt.wildignore:append({ "*.jpg", "*.bmp", "*.gif", "*.png", "*.jpeg" }) -- binary images -vim.opt.wildignore:append({ "*.o", "*.obj", "*.exe", "*.dll", "*.manifest" }) -- compiled object files -vim.opt.wildignore:append({ "*.spl" }) -- compiled spelling word lists -vim.opt.wildignore:append({ "*.sw?" }) -- Vim swap files -vim.opt.wildignore:append({ "*.DS_Store" }) -- OSX bullshit -vim.opt.wildignore:append({ "*.luac" }) -- Lua byte code -vim.opt.wildignore:append({ "migrations" }) -- Django migrations -vim.opt.wildignore:append({ "*.pyc" }) -- Python byte code -vim.opt.wildignore:append({ "*.orig" }) -- Merge resolution files -vim.opt.wildignore:append({ "*/node_modules/*" }) -- - --- Shada -vim.opt.shada = "!,'1000,f1,<1000,s100,:1000,/1000,h" - --- Sessions -vim.opt.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" - --- Cursorline -vim.cmd([[ " Only show cursorline in the current window and in normal mode - augroup cline - au! - au WinLeave,InsertEnter * set nocursorline - au WinEnter,InsertLeave * set cursorline - augroup END -]]) -vim.opt.cursorline = true -- -vim.opt.guicursor = "i:ver100,r:hor100" -- - --- Trailing whitespace -vim.cmd([[ " Only show in insert mode - augroup trailing - au! - au InsertEnter * :set listchars-=trail:⌴ - au InsertLeave * :set listchars+=trail:⌴ - augroup END -]]) - --- Line Return -vim.cmd([[ " Return to the same line when we reopen a file - augroup line_return - au! - au BufReadPost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ execute 'normal! g`"zvzz' | - \ endif - augroup END -]]) diff --git a/config/nvim/lua/user/pack.lua b/config/nvim/lua/user/pack.lua deleted file mode 100644 index 061a443..0000000 --- a/config/nvim/lua/user/pack.lua +++ /dev/null @@ -1,403 +0,0 @@ -local fn = vim.fn - --- Automatically install packer -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -if fn.empty(fn.glob(install_path)) > 0 then - PACKER_BOOTSTRAP = fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) - print("Installing packer close and reopen Neovim...") - vim.cmd([[packadd packer.nvim]]) -end - --- Autocommand that reloads neovim whenever you save the plugins.lua file -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost pack.lua source | PackerSync - augroup end -]]) - --- Use a protected call so we don't error out on first use -local status_ok, packer = pcall(require, "packer") -if not status_ok then - return -end - --- Have packer use a popup window -packer.init({ - auto_reload_compiled = true, - display = { - open_fn = function() - return require("packer.util").float({ border = "rounded" }) - end, - }, -}) - --- Install your plugins here -return packer.startup(function(use) - use("wbthomason/packer.nvim") -- Have packer manage itself - - use("lewis6991/impatient.nvim") - use("nvim-lua/plenary.nvim") -- Useful lua functions used ny lots of plugins - --use("jose-elias-alvarez/null-ls.nvim") - - -- lsp - use { - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - "neovim/nvim-lspconfig", - } - require("mason").setup() - local mason_lspconfig = require("mason-lspconfig") - mason_lspconfig.setup({ - ensure_installed = { - "pylsp", - "pyright", - "clangd", - --"vim-language-server", - --"bash-language-server", - --"lua-language-server", - "sumneko_lua", - } - }) - use({ "j-hui/fidget.nvim", - config = function() - require("fidget").setup() - end - }) - --use({ "folke/trouble.nvim", - -- config = function() - -- require("trouble").setup({ position = "right", }) - -- end - --}) - --use({ - --"folke/trouble.nvim", - --requires = "kyazdani42/nvim-web-devicons", - --config = function() - -- require("trouble").setup({ - -- --postion = "top", - -- postion = "right", - -- -- your configuration comes here - -- -- or leave it empty to use the default settings - -- -- refer to the configuration section below - -- }) - --end, - --}) - - --use({ - -- "https://git.sr.ht/~whynothugo/lsp_lines.nvim", -- See also: https://github.com/Maan2003/lsp_lines.nvim - -- config = function() - -- require("lsp_lines").setup() - - -- -- disable virtual_text since it's redundant due to lsp_lines. - -- vim.diagnostic.config({ - -- virtual_text = false, - -- }) - -- end, - --}) - use { "simrat39/symbols-outline.nvim", - config = function() - require("symbols-outline").setup({ - auto_close = true, - }) - end - } - use "antoinemadec/FixCursorHold.nvim" - use { "kosayoda/nvim-lightbulb", requires = { "antoinemadec/FixCursorHold.nvim" } } - --use("folke/lsp-colors.nvim") - use "mfussenegger/nvim-lint" - use "weilbith/nvim-code-action-menu" - use "simrat39/rust-tools.nvim" - use { "saecki/crates.nvim", - requires = { "nvim-lua/plenary.nvim" }, - config = function() - require("crates").setup() - end, - } - --use "lvimuser/lsp-inlayhints.nvim" -- rust-tools already provides this feature, but gopls doesn't - - -- null-ls - --use({ "jose-elias-alvarez/null-ls.nvim", - -- config = function() - -- require("null-ls").setup({ - -- sources = { - -- require("null-ls").builtins.diagnostics.checkmake, -- https://github.com/mrtazz/checkmake - -- } - -- }) - -- end - --}) - use({ - "jose-elias-alvarez/null-ls.nvim", - config = function() - require("null-ls").setup() - end, - requires = { "nvim-lua/plenary.nvim" }, - }) - use({ - "SmiteshP/nvim-navic", - requires = "neovim/nvim-lspconfig", - }) - - -- nvimlsp plugins - --use({ - -- "williamboman/mason.nvim", - -- config = function() - -- require("mason").setup() - -- require("mason-lspconfig").setup({ - -- ensure_installed = { "sumneko_lua", "clangd", "rust_analyzer" }, - -- }) - -- end, - --}) - --use("williamboman/mason.nvim") - --use("williamboman/mason-lspconfig.nvim") - --use("neovim/nvim-lspconfig") - --use("williamboman/nvim-lsp-installer") - --use("glepnir/lspsaga.nvim") - --use("nvim-lua/lsp-status.nvim") - --use({ - -- "glepnir/lspsaga.nvim", - -- branch = "main", - -- config = function() - -- local saga = require("lspsaga") - - -- saga.init_lsp_saga({ - -- -- your configuration - -- }) - -- end, - --}) - -- use("nvim-lua/popup.nvim") - --use("SmiteshP/nvim-gps") - -- autocomplete plugins - use("hrsh7th/nvim-cmp") - use("hrsh7th/cmp-nvim-lsp") - use("hrsh7th/cmp-buffer") - use("hrsh7th/cmp-path") - use("hrsh7th/cmp-cmdline") - use("petertriho/cmp-git") - use("tamago324/cmp-zsh") - use("f3fora/cmp-spell") - use("hrsh7th/cmp-calc") - use("saadparwaiz1/cmp_luasnip") - use("hrsh7th/cmp-nvim-lsp-signature-help") - use("onsails/lspkind-nvim") - - -- snippets - --use("L3MON4D3/LuaSnip") --snippet engine - use("L3MON4D3/LuaSnip") - use("rafamadriz/friendly-snippets") -- a bunch of snippets to use - --use("github/copilot.vim") - --use({ - --"zbirenbaum/copilot.lua", - --event = { "VimEnter" }, - --config = function() - --vim.defer_fn(function() - --require("plugins.copilot") - --end, 100) - --end, - --}) - --use({ - --"zbirenbaum/copilot-cmp", - --module = "copilot_cmp", - --}) - - -- treesitter plugins - use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) --folding, jumping, refactoring... - use("nvim-treesitter/nvim-treesitter-refactor") - use("nvim-treesitter/nvim-treesitter-context") - --use({ - -- "danymat/neogen", - -- config = function() - -- require("neogen").setup({ snippet_engine = "luasnip" }) - -- end, - -- requires = "nvim-treesitter/nvim-treesitter", - --}) - --use({ "junegunn/fzf", run = ":call fzf#install()" }) - use('ibhagwan/fzf-lua') - -- telescope plugins - use("nvim-telescope/telescope.nvim") - use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }) - use("tami5/sqlite.lua") - --use("nvim-telescope/telescope-frecency.nvim") - use("nvim-telescope/telescope-ui-select.nvim") - use("nvim-telescope/telescope-media-files.nvim") - use("nvim-telescope/telescope-file-browser.nvim") - -- search emoji and other symbols - use({ "nvim-telescope/telescope-symbols.nvim", after = "telescope.nvim" }) - use("axkirillov/telescope-changed-files") - --use({ - --"princejoogie/dir-telescope.nvim", - --requires = {"nvim-telescope/telescope.nvim"}, - --config = function() - -- require("dir-telescope").setup({ - -- hidden = true, - -- respect_gitignore = true, - -- }) - --end, - --}) - use("airblade/vim-rooter") - -- statusline plugins - --use("nvim-lualine/lualine.nvim") - --use({ - -- "nvim-lualine/lualine.nvim", - -- requires = { "kyazdani42/nvim-web-devicons", opt = true }, - --}) - --use({ - -- "folke/trouble.nvim", - -- requires = "kyazdani42/nvim-web-devicons", - -- config = function() - -- require("trouble").setup({ - -- -- your configuration comes here - -- -- or leave it empty to use the default settings - -- -- refer to the configuration section below - -- }) - -- end, - --}) - use("rebelot/heirline.nvim") - --use({ "akinsho/bufferline.nvim", tag = "v2.*", requires = "kyazdani42/nvim-web-devicons" }) - --use("itchyny/lightline.vim") - -- debug plugins - --use("puremourning/vimspector") - use("mfussenegger/nvim-dap") - use("rcarriga/nvim-dap-ui") - --use({ - -- "rcarriga/neotest", - -- requires = { - -- "nvim-lua/plenary.nvim", - -- "nvim-treesitter/nvim-treesitter", - -- "antoinemadec/FixCursorHold.nvim", - -- "rcarriga/neotest-python", - -- "rcarriga/neotest-vim-test", - -- "rcarriga/neotest-plenary", - -- "vim-test/vim-test", - -- }, - -- config = function() - -- require("plugins.neotest") - -- end, - --}) - --use("vim-test/vim-test") - --use({ - -- "rcarriga/vim-ultest", - -- requires = { "vim-test/vim-test" }, - -- run = ":UpdateRemotePlugins", - -- config = function() - -- require("plugins.ultest") - -- end, - --}) - -- UI - use("karb94/neoscroll.nvim") - use("folke/which-key.nvim") - use("MunifTanjim/prettier.nvim") -- Prettier plugin for Neovim's built-in LSP client - use("norcalli/nvim-colorizer.lua") - use("folke/zen-mode.nvim") - use("romainl/vim-cool") - --use("p00f/nvim-ts-rainbow") - --use("goolord/alpha-nvim") - --use("feline-nvim/feline.nvim") - --use({ "fgheng/winbar.nvim" }) - --use("vim-airline/vim-airline") - --use("kdheepak/tabline.nvim") - -- use({ - -- "kdheepak/tabline.nvim", - -- config = function() - -- require("tabline").setup({ enable = false }) - -- end, - -- requires = { "hoob3rt/lualine.nvim", "kyazdani42/nvim-web-devicons" }, - -- notification plugin - use("rcarriga/nvim-notify") - --use("lukas-reineke/indent-blankline.nvim") - use("kyazdani42/nvim-web-devicons") - -- Colorschemes - use("gruvbox-community/gruvbox") - use("srcery-colors/srcery-vim") - use("tomasr/molokai") - use("ayu-theme/ayu-vim") - --use("sjl/badwolf") - use("joshdick/onedark.vim") - use("everblush/everblush.nvim") - use("EdenEast/nightfox.nvim") - use("bluz71/vim-nightfly-guicolors") - --use({ "shaunsingh/oxocarbon.nvim", run = "./install.sh" }) - use("jacoborus/tender.vim") - use("sainnhe/sonokai") - use("NTBBloodbath/doom-one.nvim") - - -- Utilities - use("nathom/filetype.nvim") - use("christoomey/vim-tmux-navigator") - use("preservim/vimux") - use("myusuf3/numbers.vim") - use("windwp/nvim-autopairs") - use("lewis6991/gitsigns.nvim") - use("dinhhuy258/git.nvim") -- For git blame & browse - use("kyazdani42/nvim-tree.lua") - use("numToStr/Comment.nvim") - --use("akinsho/toggleterm.nvim") - --use("godlygeek/tabular") - --use("Vonr/align.nvim") - --use("junegunn/vim-easy-align") - --use("dstein64/vim-startuptime") - use("tweekmonster/startuptime.vim") - -- use("luukvbaal/stabilize.nvim") - --use("rhysd/clever-f.vim") - --use("ggandor/lightspeed.nvim") -- use 'cl' and 'cc' instead of 's' and 'S' respectively - --use("ggandor/leap.nvim") - use({ - "ggandor/leap.nvim", - config = function() - require("leap").set_default_keymaps() - --vim.keymap.set('n', '-', '(leap-forward)', {}) - --vim.keymap.set('n', '_', '(leap-backward)', {}) - end, - }) - use({ "ggandor/flit.nvim", - config = function() - require("flit").setup() - end, - }) - - --use("Shatur/neovim-session-manager") - --use("rmagatti/auto-session") - --use("rmagatti/session-lens") - --use("ahmedkhalf/project.nvim") - --use("aserowy/tmux.nvim") - --use("wakatime/vim-wakatime") - --use("tpope/vim-eunuch") - -- Handy unix command inside Vim (Rename, Move etc.) - use({ "tpope/vim-eunuch", cmd = { "Rename", "Delete" } }) - --use("tpope/vim-fugitive") - --use("tpope/vim-surround") - --use("tpope/vim-obsession") - --use("tpope/vim-unimpaired") - --use("voldikss/vim-floaterm") - --use("vimpostor/vim-tpipeline") - --use({ - -- "vimwiki/vimwiki", - -- config = function() - -- vim.g.vimwiki_list = { - -- { - -- path = "~/", - -- syntax = "markdown", - -- ext = ".md", - -- }, - -- } - -- vim.g.vimwiki_ext2syntax = { - -- [".md"] = "markdown", - -- [".markdown"] = "markdown", - -- [".mdown"] = "markdown", - use({ - "iamcco/markdown-preview.nvim", - run = function() vim.fn["mkdp#util#install"]() end, - }) - - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if PACKER_BOOTSTRAP then - require("packer").sync() - end -end) diff --git a/config/nvim/lua/user/utils.lua b/config/nvim/lua/user/utils.lua deleted file mode 100644 index bfb5faa..0000000 --- a/config/nvim/lua/user/utils.lua +++ /dev/null @@ -1,85 +0,0 @@ -local fn = vim.fn - -local M = {} - -function M.executable(name) - if fn.executable(name) > 0 then - return true - end - - return false -end - ---- check whether a feature exists in Nvim ---- @feat: string ---- the feature name, like `nvim-0.7` or `unix`. ---- return: bool -M.has = function(feat) - if fn.has(feat) == 1 then - return true - end - - return false -end - ---- Create a dir if it does not exist -function M.may_create_dir(dir) - local res = fn.isdirectory(dir) - - if res == 0 then - fn.mkdir(dir, "p") - end -end - -M['unload_lua_namespace'] = function(prefix) - local prefix_with_dot = prefix .. '.' - for key, value in pairs(package.loaded) do - if key == prefix or key:sub(1, #prefix_with_dot) == prefix_with_dot then - package.loaded[key] = nil - end - end -end - --- toggle cmp completion -vim.g.cmp_toggle_flag = false -- initialize -local normal_buftype = function() - return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt" -end -M.toggle_completion = function() - local ok, cmp = pcall(require, "cmp") - if ok then - local next_cmp_toggle_flag = not vim.g.cmp_toggle_flag - if next_cmp_toggle_flag then - print("completion on") - else - print("completion off") - end - cmp.setup({ - enabled = function() - vim.g.cmp_toggle_flag = next_cmp_toggle_flag - if next_cmp_toggle_flag then - return normal_buftype - else - return next_cmp_toggle_flag - end - end, - }) - else - print("completion not available") - end -end - -function M.get_nvim_version() - local actual_ver = vim.version() - - local nvim_ver_str = string.format("%d.%d.%d", actual_ver.major, actual_ver.minor, actual_ver.patch) - return nvim_ver_str -end - -function M.add_pack(name) - local status, error = pcall(vim.cmd, "packadd " .. name) - - return status -end - -return M -- cgit v1.2.3