diff --git a/.gitmodules b/.gitmodules index e02eb0d..4475b2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "root/usr/local/src/z.lua"] path = "root/usr/local/src/z.lua" url = "https://github.com/skywind3000/z.lua" +[submodule "home/.config/nvim"] + path = home/.config/nvim + url = https://github.com/ItsDrike/neovim diff --git a/home/.config/nvim b/home/.config/nvim new file mode 160000 index 0000000..5e10bd3 --- /dev/null +++ b/home/.config/nvim @@ -0,0 +1 @@ +Subproject commit 5e10bd30328a890bc2f62d8687b3c346a8032b14 diff --git a/home/.config/nvim/coc-settings.json b/home/.config/nvim/coc-settings.json deleted file mode 100644 index 3665990..0000000 --- a/home/.config/nvim/coc-settings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "pairs.enableCharacters": [ - "(", - "[", - "{", - "'", - "\"", - "`" - ], - "diagnostic.checkCurrentLine": true, - "coc.preferences.formatOnSaveFiletypes": [ - "json" - ], - "python.linting.flake8Enabled": true -} diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua deleted file mode 100644 index e562985..0000000 --- a/home/.config/nvim/init.lua +++ /dev/null @@ -1,13 +0,0 @@ --- The configuration is scattered across multiple files in the lua/ folder --- We can require the individual configurations from here - - --- This loads in the basic nvim configuration that doesn't rely on any --- plugins. it provides default keymaps, options, theming, autocmds, ... -require "core" - --- This loads packer plugin manager which manages our plugins --- NOTE: Removing this will NOT disable the plugins, but it will disable --- automatic packer installation, allowing for the plugins to be deleted --- manually (from ~/.local/share/nvim/site/pack/packer). -require "plugins" diff --git a/home/.config/nvim/lua/core/abbreviations.lua b/home/.config/nvim/lua/core/abbreviations.lua deleted file mode 100644 index 95cb0e1..0000000 --- a/home/.config/nvim/lua/core/abbreviations.lua +++ /dev/null @@ -1,26 +0,0 @@ -local vim = require("vim") -local fn = vim.fn -local m = require("utility.mappings") - -local function cabbrev(input, result, reabbrev) - m.abbrev("c", input, result, reabbrev) -end - --- Invalid case abbreviations -cabbrev("Wq", "wq") -cabbrev("wQ", "wq") -cabbrev("WQ", "wq") -cabbrev("Wa", "wa") -cabbrev("W", "w") -cabbrev("Q", "q") -cabbrev("Qall", "qall") -cabbrev("W!", "w!") -cabbrev("Q!", "q!") -cabbrev("Qall!", "qall!") - --- Save file with sudo -cabbrev("w!!", "w !sudo tee > /dev/null %") - --- Reload lua configuration -local initlua = fn.stdpath("config") .. "init.lua" -cabbrev("reload", "luafile " .. initlua) diff --git a/home/.config/nvim/lua/core/autocmd.lua b/home/.config/nvim/lua/core/autocmd.lua deleted file mode 100644 index f98eefb..0000000 --- a/home/.config/nvim/lua/core/autocmd.lua +++ /dev/null @@ -1,21 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd - --- Disable automatic commenting on newlines -cmd[[autocmd FileType * setlocal formatoptions-=cro]] - --- Have vim jump to last position when reopening a file -cmd[[autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]] - --- Automatically delete all trailing whitespace on save -cmd[[autocmd BufWritePre * %s/\s\+$//e]] - --- Enable spellcheck for certain file types -cmd[[autocmd FileType tex,latex,markdown,gitcommit setlocal spell spelllang=en_us]] - --- Use auto-wrap for certain file types at 119 chars -cmd[[autocmd FileType markdown setlocal textwidth=119]] - --- Don't show line numbers in terminal -cmd[[autocmd BufEnter term://* setlocal nonumber | setlocal norelativenumber]] - diff --git a/home/.config/nvim/lua/core/init.lua b/home/.config/nvim/lua/core/init.lua deleted file mode 100644 index 2eba0e8..0000000 --- a/home/.config/nvim/lua/core/init.lua +++ /dev/null @@ -1,7 +0,0 @@ --- Require additional scripts which contain individual configurations - -require "core.options" -require "core.theme" -require "core.mappings" -require "core.abbreviations" -require "core.autocmd" diff --git a/home/.config/nvim/lua/core/mappings.lua b/home/.config/nvim/lua/core/mappings.lua deleted file mode 100644 index 4e4afa8..0000000 --- a/home/.config/nvim/lua/core/mappings.lua +++ /dev/null @@ -1,111 +0,0 @@ -local m = require("utility.mappings") -local vim = require("vim") -local g = vim.g - - --- This is a bit silly, but I don't like passing the mode argument -g.mapleader = "\\" - --- Unmap arrow keys in normal mode to remove bad habits -m.keymap("n", "", "") -m.keymap("n", "", "") -m.keymap("n", "", "") -m.keymap("n", "", "") - --- Tab navigation -m.keymap("n", "", "gt") -m.keymap("n", "", "gT") -m.keymap("n", "", ":tabnew") -m.keymap("n", "", ":tabmove +") -m.keymap("n", "", ":tabmove -") -m.keymap("n", "", ":tabp") -m.keymap("n", "", ":tabn") -m.keymap("n", "", ":tabc") - --- Buffer navigation -m.keymap("n", "", ":bn") -m.keymap("n", "", ":bp") -m.keymap("n", "", ":bd") - --- Set splits navigation to just ALT + hjkl -m.keymap("n", "", "h") -m.keymap("n", "", "j") -m.keymap("n", "", "k") -m.keymap("n", "", "l") - --- Split size adjusting -m.keymap("n", "", ":vertical resize +3") -m.keymap("n", "", ":vertical resize -3") -m.keymap("n", "", ":resize +3") -m.keymap("n", "", ":resize -3") - --- Define some common shortcuts -m.keymap("n", "", ":w") -m.keymap("i", "", ":wi") -m.keymap("n", "", ":undo") -m.keymap("n", "", ":redo") - --- Terminal -m.keymap("n", "", ":split term://zsh:resize -7i") -m.keymap("n", "", ":vnew term://zshi") -m.keymap("n", "", ":tabnew term://zshi") -m.keymap("t", "", "") - --- Use space for folding/unfolding sections -m.keymap("n", "", "za") -m.keymap("v", "", "zf") - --- Use shift to quickly move 10 lines up/down -m.keymap("n", "K", "10k") -m.keymap("n", "J", "10j") - --- Moving lines around -m.keymap("v", "", ":m '>+1gv=gv") -m.keymap("v", "", ":m '<-2gv=gv") -m.keymap("i", "", ":m .+1==i") -m.keymap("i", "", ":m .-2==i") -m.keymap("n", "j", ":m .+1==") -m.keymap("n", "k", ":m .-2==") - --- Quick word replacing (use . for next word) -m.keymap("n", "cn", "*``cgn") -m.keymap("n", "cN", "*``cgN") - --- Enable/Disable auto commenting -m.keymap("n", "c", ":setlocal formatoptions-=cro") -m.keymap("n", "C", ":setlocal formatoptions+=cro") - --- Don't leave visual mode after indenting -m.keymap("v", "<", "", ">gv") - --- Center (and unfold) after going to next/prev search item -m.keymap("n", "n", "nzzzv") -m.keymap("n", "N", "Nzzzv") - --- System clipboard copying -m.keymap("v", "", '"+y') - --- Alias replace all -m.keymap("n", "", ":%s//gI", {silent=false}) - --- Stop search highlight with Esc -m.keymap("n", "", ":noh") - --- Start spell-check -m.keymap("n", "s", ":setlocal spell! spelllang=en_us") - --- Run shell check -m.keymap("n", "p", ":!shellckeck %") - --- Compile opened file (using custom script) -m.keymap("n", "", ":w | !comp %") - --- Close all opened buffers -m.keymap("n", "Q", ":bufdo bdelete") - --- Don't set the incredibely annoying mappings that trigger dynamic SQL --- completion with dbext and keeps on freezing vim whenever pressed with --- a message saying that dbext plugin isn't installed --- See :h ft-sql.txt -vim.g.omni_sql_no_default_maps = 1 diff --git a/home/.config/nvim/lua/core/options.lua b/home/.config/nvim/lua/core/options.lua deleted file mode 100644 index b2cb2d2..0000000 --- a/home/.config/nvim/lua/core/options.lua +++ /dev/null @@ -1,55 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd -local o = vim.opt - -cmd[[filetype plugin on]] - --- Tab/Indent settings -o.autoindent = true -- Enable autoindent -o.expandtab = true -- Expand tabs to spaces -o.tabstop = 4 -- Tab size in spaces -o.shiftwidth = 4 -- Indentation size -o.softtabstop = 4 -- Tabs/Spaces interlop -o.tabpagemax = 50 -- More tabs -o.shiftround = true -- Always round indent to multiple of shiftwidth - --- Folding -o.foldmethod = "indent" -- Use indent to determine the fold levels -o.foldnestmax = 8 -- Only fold up to given amount of levels -o.foldlevel = 2 -- Set initial fold level (don't fold first 2 levels) -o.foldenable = false -- Hide all folds by default - --- Split order -o.splitbelow = true -- Put new windows below current -o.splitright = true -- Put new vertical splits to right - --- In-file search (/) -o.ignorecase = true -- Use case insensitive matching -o.incsearch = true -- Show partial matches while typing -o.hlsearch = true -- Highlight search matches - --- Show whitespace -o.list = true -- Enable showing characters like , , ... -o.listchars = {tab = " ", trail = "·"} -- Specify which characters to show - --- Command-mode search -o.wildmode = {"longest", "list", "full"} -- Enable autocompletion -o.wildmenu = true -- Display all matching files when we tab complete -table.insert(o.path, "**") -- Search down into subfolders with tab completion -o.wildignore = vim.tbl_extend( -- Ignore certain files/folders in wildmenu - "force", o.wildignore, { - "*.pyc", "*_build/*", - "**/coverage/*", "**/node_modules/*", - "**/android/*", "**/ios/*", - "**/.git/*", - } -) - --- Files -o.encoding = "utf-8" -- Use UTF-8 encoding -o.autoread = true -- Automatically reload files on change - --- Misc -o.mouse = "a" -- Enable mouse mode -o.undolevels = 999 -- Lots of these -o.history = 1000 -- More history diff --git a/home/.config/nvim/lua/core/theme.lua b/home/.config/nvim/lua/core/theme.lua deleted file mode 100644 index b2628c5..0000000 --- a/home/.config/nvim/lua/core/theme.lua +++ /dev/null @@ -1,43 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd -local g = vim.g -local o = vim.opt - -cmd[[syntax on]] -- Turn on syntax highlighting - -o.cursorline = true -- Highlight cursor line -o.laststatus = 2 -- Always show status line -o.number = true -- Show line numbers -o.relativenumber = true -- Use relative line numbers -o.showmatch = true -- Show matching bracket -o.scrolloff = 5 -- Keep 5 lines horizontal scrolloff -o.sidescrolloff = 5 -- Keep 5 chars vertical scrolloff -o.showmode = false -- Don't display mode (it's on status line anyway) - --- I wasn't able to find a way to set guioptions directly in lua -cmd[[ -set guioptions-=m " Remove menubar -set guioptions-=T " Remove toolbar -set guioptions-=r " Remove right-hand scrollbar -set guioptions-=L " Remove left-hand scrollbar -]] - --- Override some colorscheme colors --- * Use more noticable cursor line color -cmd[[ -augroup coloroverride - autocmd! - autocmd ColorScheme * highlight CursorLine guibg=#2b2b2b - autocmd ColorScheme * highlight CursorLineNr guifg=#1F85DE ctermfg=LightBlue -augroup END -]] - --- Set the colorscheme to default to trigger the above autocmds --- This can be overridden from plugin definitions as this file is ran before those -cmd[[colorscheme default]] - --- Don't use true colors in TTY -o.termguicolors = os.getenv("DISPLAY") and true or false - --- Use proper syntax highlighting in fenced codeblocks -g.markdown_fenced_languages = {"html", "javascript", "typescript", "css", "scss", "lua", "vim", "python"} diff --git a/home/.config/nvim/lua/lsp/autoformat.lua b/home/.config/nvim/lua/lsp/autoformat.lua deleted file mode 100644 index e4363c1..0000000 --- a/home/.config/nvim/lua/lsp/autoformat.lua +++ /dev/null @@ -1,5 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd - --- Always automatically format on write for given filenames -cmd[[autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)]] diff --git a/home/.config/nvim/lua/lsp/init.lua b/home/.config/nvim/lua/lsp/init.lua deleted file mode 100644 index 1e26feb..0000000 --- a/home/.config/nvim/lua/lsp/init.lua +++ /dev/null @@ -1,31 +0,0 @@ --- Neovim has built in support for the language server protocol (LSP). For --- which reason I decided to utilize it directly instead of relying on plugins --- such as COC, which reimplement it completely just to support default vim --- too, since I don't need pure vim support, utilizing this built in support --- makes a lot more sense and will be faster. --- --- By default, setting up LSP doesn't technically require any plugins, however --- I still do use the recommended neovim/nvim-lspconfig plugin, along with --- williamboman/nvim-lsp-installer, because it makes things a lot easier to get --- working. The lspconfig holds the default configurations for the individual --- language servers, avoiding the need of tediously configuring them manually, --- and the lspinstaller gives us a way to automatically install selected --- language servers locally for nvim only, which means we won't need to look at --- the install instructions for each language server and install it user or --- system wide. --- --- However, since this configuration shouldn't be plugin dependant, as it is --- outside of the plugins/ directory and LSP is supported by neovim directly, --- this folder is here to provide the non-plugin dependant LSP configuration, --- but I do not manually define the configuration for each language server, --- since I do actually utilize those plugins, but sturcturing like this still --- does give space for completely custom configurations written from scratch --- without relying on any external plugins at all. If you do want to do that, --- this would be the place to set this up. --- --- NOTE: With my current configuration, this file is only ran by being required --- in the lsp plugin config file, if you don't wish to run with plugins, you'll --- want to require this file from init.lua directly. - -require("lsp.keymaps") -require("lsp.autoformat") diff --git a/home/.config/nvim/lua/lsp/keymaps.lua b/home/.config/nvim/lua/lsp/keymaps.lua deleted file mode 100644 index e3c9b9a..0000000 --- a/home/.config/nvim/lua/lsp/keymaps.lua +++ /dev/null @@ -1,57 +0,0 @@ -local m = require("utility.mappings") - --- See `:help vim.lsp.*` for documentation on any of the below mapped functions - --- Check if certain plugins are installed, if so, they should be used --- to define some mappings -local telescope_installed, _ = pcall(require, "telescope") -local lsp_signature_installed, _ = pcall(require, "lsp_signature") - --- Lookups -m.keymap("n", "gd", "lua vim.lsp.buf.definition()") -m.keymap('n', 'gD', 'lua vim.lsp.buf.declaration()') -m.keymap("n", "gr", "lua vim.lsp.buf.references()") -m.keymap("n", "gi", "lua vim.lsp.buf.implementation()") -m.keymap("n", "gt", "lua vim.lsp.buf.type_definition()") - -if telescope_installed then - m.keymap('n', 'gd', 'lua require("telescope.builtin").lsp_definitions()') - m.keymap('n', 'gr', 'lua require("telescope.builtin").lsp_references()') - m.keymap('n', 'gi', 'lua require("telescope.builtin").lsp_implementations()') - m.keymap('n', 'gt', 'lua require("telescope.builtin").lsp_type_definitions()') -end - --- Formatting -m.keymap('n', 'gf', 'lua vim.lsp.buf.formatting()') -m.keymap('v', 'gf', 'lua vim.lsp.buf.range_formatting()') - --- Hover info -m.keymap("n", "", "lua vim.lsp.buf.signature_help()") -m.keymap("n", "M", "lua vim.lsp.buf.hover()") - -if lsp_signature_installed then - m.keymap('n', '', 'lua require("lsp_signature").signature()') -end - --- Diagnostics -m.keymap('n', '[g', 'lua vim.diagnostic.goto_prev()') -m.keymap('n', ']g', 'lua vim.diagnostic.goto_next()') -m.keymap('n', 'ge', 'lua vim.diagnostic.open_float(nil, { scope = "line", })') - -if telescope_installed then - m.keymap('n', 'ge', 'lua require("telescope.builtin").lsp_document_diagnostics()') -end - --- LSP Workspace -m.keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()') -m.keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()') -m.keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))') - ---Actions -if telescope_installed then - m.keymap('n', 'ga', 'lua require("telescope.builtin").lsp_code_actions()') - m.keymap('v', 'ga', 'lua require("telescope.builtin").lsp_range_code_actions()') -end - --- Use custom implementation for renaming all references -m.keymap('n', 'gn', 'lua require("lsp.rename").rename()') diff --git a/home/.config/nvim/lua/lsp/rename.lua b/home/.config/nvim/lua/lsp/rename.lua deleted file mode 100644 index 6ce4cc6..0000000 --- a/home/.config/nvim/lua/lsp/rename.lua +++ /dev/null @@ -1,147 +0,0 @@ --- Nvim's LSP lacks rename-all functionality which plugins like Coc provide --- this is a manual implementation of this feature -local vim = require("vim") -local api = vim.api -local cmd = vim.cmd -local lsp = vim.lsp -local fn = vim.fn - -local M = {} - --- Unique name for the rename window, so we can access it --- from close_rename_win function. -local unique_name = "lsp-rename-win" - --- File require string. Neede because we will be defining keymaps --- applied only to the rename window buffer which will refer to --- functions within this file, for that, they need to call require -local file_require_string = "lsp.rename" - --- Check whether LSP is actually active. -local function check_lsp_active() - local active_clients = lsp.get_active_clients() - if next(active_clients) == nil then - return false - end - return true -end - --- Once in the rename window buffer, apply specific mappings to confirm or --- cancel renaming, and define a specific autocmd to close the window if --- we leave it. -local function apply_actions() - local prefix = string.format("lua require('%s')", file_require_string) - local close_win_s = prefix .. ".close_rename_win()" - local do_rename_s = prefix .. ".do_rename()" - -- Automatically close the window if it's escaped - api.nvim_command("autocmd QuitPre ++nested ++once :silent " .. close_win_s) - -- Define confirm and exit buffer-specific keymaps - api.nvim_command("inoremap " .. do_rename_s .. "") - api.nvim_command("nnoremap q " .. close_win_s .. "") -end - --- Closes the rename window (identified by the `unique_name`) -function M.close_rename_win() - if fn.mode() == "1" then - cmd[[stopinsert]] - end - - local exists, winid = pcall(api.nvim_win_get_var, 0, unique_name) - if exists then - api.nvim_win_close(winid, true) - end -end - --- Trigger renaming -function M.do_rename() - local new_name = vim.trim(fn.getline('.')) - M.close_rename_win() - local current_name = fn.expand("") - - if not new_name or #new_name == 0 or new_name == current_name then - return - end - - local params = lsp.util.make_position_params() - params.newName = new_name - lsp.buf_request(0, "textDocument/rename", params, function(_, result, _, _) - if not result then - -- If the server returns an empty result, don't do anything - return - end - - -- The result contains all places we need to update the name - -- of the identifier, so we apply those edits. - lsp.util.apply_workspace_edit(result) - - if not result.changes then - return - end - - -- Collect amounts of affected files and total renames. - local total_files = 0 - local total_renames = 0 - for _, renames in pairs(result.changes) do - total_files = total_files + 1 - for _ in pairs(renames) do - total_renames = total_renames + 1 - end - end - - -- Once the changes were applied, these files won't be saved - -- automatically, let's remind ourselves to save those... - print(string.format( - "Changed %s file%s (%s rename%s). To save %s, run ':w%s'", - total_files, - total_files > 1 and "s" or "", - total_renames, - total_renames > 1 and "s" or "", - total_files > 1 and "them" or "it", - total_files > 1 and "a" or "" - )) - end) -end - --- Create the rename window -function M.rename() - if not check_lsp_active() then - print("No LSP client available, can't rename!") - return - end - - -- In case there already is another rename window opened, close it - M.close_rename_win() - - - -- Read the current name here, before we're in the rename window - local current_name = fn.expand('') - - -- Create a window within our buffer with our `unique_name` so that it - -- can be found from the close fucntion and automatically enter it - local win_opts = { - relative = 'cursor', - row = 0, - col = 0, - width = 30, - height = 1, - style = 'minimal', - border = 'single' - } - local buf = api.nvim_create_buf(false, true) - local win = api.nvim_open_win(buf, true, win_opts) - api.nvim_win_set_var(0, unique_name, win) - - -- Automatically enter insert mode - cmd[[startinsert]] - - -- Pre-write the current name of given object into the rename window - -- and set cursor behind it - api.nvim_buf_set_lines(buf, 0, -1, false, {current_name}) - api.nvim_win_set_cursor(win, {1, #current_name}) - - -- Set actions for auto-closing the window and buffer-specific mappings - -- to confirm or close rename - apply_actions() -end - -return M diff --git a/home/.config/nvim/lua/plugins/init.lua b/home/.config/nvim/lua/plugins/init.lua deleted file mode 100644 index d93a202..0000000 --- a/home/.config/nvim/lua/plugins/init.lua +++ /dev/null @@ -1,36 +0,0 @@ -local vim = require("vim") -local packer_m = require("plugins.packer") - --- Require packer_compiled to lazy-load all of the plugins and their settings --- automatically. If this fails, it means we probably didn't yet compile --- packer. This file is generated upon running :PackerCompile, so if we didn't --- find it, we inform the user to run it. We can't run it here directly, --- because packer may not yet be installed, bootstrapping happens only after --- this to allow this lazy loadning behavior. If we required packer before --- this, the lazy-loading would have no effect. -local packer_compiled_ok, _ = pcall(require, "compiled.packer_compiled") -if not packer_compiled_ok then - vim.notify( - "Run :PackerCompile or :PackerSync", - vim.log.levels.WARN, - { title = "Notification" } - ) -end - --- If packer isn't present, install it automatically it -local present, packer = pcall(require, "packer") - -local first_install = false -if not present then - first_install = packer_m.bootstrap_packer() - if first_install then - -- We know this will work now that packer was bootstrapped - -- Otherwise we'd receive false in first_install - ---@diagnostic disable-next-line:different-requires - packer = require("packer") - end -end - --- Obtain the plugins defined in plugin_list.ua -local plugin_list = require("plugins.plugin_list") -packer_m.startup(packer, plugin_list, first_install) diff --git a/home/.config/nvim/lua/plugins/packer.lua b/home/.config/nvim/lua/plugins/packer.lua deleted file mode 100644 index 624b663..0000000 --- a/home/.config/nvim/lua/plugins/packer.lua +++ /dev/null @@ -1,114 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd -local fn = vim.fn - -local M = {} - --- Define some paths used in the functions -M.packer_install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -M.packer_compile_path = fn.stdpath("config") .. "/lua/compiled/packer_compiled.lua" - --- Define basic default settings for packer -M.packer_settings = { - display = { - open_fn = function() - return require('packer.util').float({ border = "rounded" }) - end, - prompt_border = "rounded", - }, - git = { - -- Timeout for git clones in seconds - clone_timeout = 600, - }, - profile = { - enable = true, - -- The time that a pluign's load time must surpass for it to be included - -- in the profile (in miliseconds) - threshold = 1, - }, - compile_path = M.packer_compile_path, - auto_clean = true, - compile_on_sync = true -} - --- Define default plugins which should always be used -M.default_plugin_list = { - -- Let packer manager itself, so that it gets updates - { "wbthomason/packer.nvim" }, - - -- Add plugin for speeding up `require` in lua by caching - --{ "lewis6991/impatient.nvim" }, - - -- Replaces default filetype.vim sourced on startup, which includes - -- 800+ autocommands setting the filetype based on the filename. This - -- is very slow and this plugin merges them into single autocommand, - -- which is 175x faster, improving startup time - --{ "nathom/filetype.nvim" }, -} - --- Download and load packer plugin manager -function M.bootstrap_packer() - print("Clonning pakcer plugin manager, please wait...") - -- First remove the directory in case it already exists but packer isn't present - fn.delete(M.packer_install_path, "rf") - fn.system({ - "git", "clone", "--depth", "1", - "https://github.com/wbthomason/packer.nvim", - M.packer_install_path - }) - - -- Add packer plugin via nvim's internal plugin system - -- and make sure that we can now require it. - cmd("packadd packer.nvim") - local present, packer = pcall(require, "packer") - if present then - print("Packer clonned successfully.") - return true - else - print("Couldn't clone packer! Packer path: " .. M.packer_install_path .. "\n" .. packer) - return false - end -end - --- Run packer startup with the default config and given plugin settings --- Expects: `packer`, `plugin_list`, `run_sync`, `settings_override` -function M.startup(packer, plugin_list, run_sync, settings_override) - -- Initialize packer with default settings extended by - -- the given settings override - local settings = M.packer_settings - if settings_override then - settings = vim.tbl_extend("foce", settings, settings_override) - end - packer.reset() - packer.init(settings) - - -- Run packer startup and use all given plugins with their settings - -- including the default plugins - local use = packer.use - return packer.startup(function() - -- Use the default plugins (should be first) - for _, plugin_settings in pairs(M.default_plugin_list) do - use(plugin_settings) - end - - -- Use the obtained plugins - if plugin_list and not vim.tbl_isempty(plugin_list) then - for _, plugin_settings in pairs(plugin_list) do - use(plugin_settings) - end - end - - -- We can also automatically run sync to install all specified plugins - -- immediately, this is useful if we've just bootstrapped packer. - if run_sync then - vim.notify( - "Make sure to restart after packer sync!", - vim.log.levels.WARN, - { title = "Notification" } - ) - packer.sync() - end - end) -end - -return M diff --git a/home/.config/nvim/lua/plugins/plugin_list.lua b/home/.config/nvim/lua/plugins/plugin_list.lua deleted file mode 100644 index de4a4ce..0000000 --- a/home/.config/nvim/lua/plugins/plugin_list.lua +++ /dev/null @@ -1,124 +0,0 @@ -local vim = require("vim") -local fn = vim.fn - -local plugin_directory = fn.stdpath("config") .. "/lua/plugins/settings" - --- Return the line (string) to be executed with lua that loads in given plugin file. --- This is useful for the `config` or `setup` parameters of packer's use to source --- both `.vim` and `.lua` files. --- Expects a `plugin_file` which is a relative path from the `plugin_directory` folder. -local function get_plugin_file(plugin_file) - local source_line = string.format('source %s/%s', plugin_directory, plugin_file) - return string.format("vim.fn.execute('%s')", source_line) -end - - --- Define packer plugins --- The individual tables will get passed into the packer's use function -local plugin_list = { - { "airblade/vim-gitgutter" }, -- Git status in files - { "dhruvasagar/vim-table-mode" }, -- Easy way to construct markdown tables - { "wakatime/vim-wakatime" }, -- Track time spent coding - { "mhinz/vim-startify" }, -- Nice startup screen for vim when started withotu file/dir - { "dbeniamine/cheat.sh-vim" }, -- Quick interaction with cheat.sh cheatsheets - { - "tveskag/nvim-blame-line", -- Show commit affecting cursor line - config = get_plugin_file("blame_line.lua") - }, - { - "vimwiki/vimwiki", -- Wiki pages for vim - config = get_plugin_file("vimwiki.lua"), - }, - { - "tpope/vim-commentary", -- Adds ability to comment out sections of files - config = get_plugin_file("commentary.lua") - }, - { - "tomasiser/vim-code-dark", -- Vim theme inspired by vscode's Dark+ - config = get_plugin_file("vim-code-dark.lua") - }, - { - "nvim-treesitter/nvim-treesitter", -- AST language analysis providing semantic highlighting - config = get_plugin_file("treesitter.lua"), - run = ':TSUpdate', - requires = { "nvim-treesitter/playground", opt = true } - }, - { - "vim-airline/vim-airline", -- Status line - config = get_plugin_file("airline.lua"), - requires = { - { "vim-airline/vim-airline-themes" }, - { "ryanoasis/vim-devicons" }, - }, - }, - -- TODO: Consider changing this to nvim-tree - { - "preservim/nerdtree", -- File tree - config = get_plugin_file("nerdtree.lua"), - requires = { - { "Xuyuanp/nerdtree-git-plugin" }, - { "tiagofumo/vim-nerdtree-syntax-highlight" }, - { "ryanoasis/vim-devicons" }, - }, - }, - { - "mfussenegger/nvim-dap", -- Support for the debugging within vim - config = get_plugin_file("nvim-dap.lua"), - requires = { "mfussenegger/nvim-dap-python" }, - }, - { - "junegunn/fzf.vim", -- Fuzzy finder (TODO: consider replacing with telescope) - run = function() fn['fzf#install']() end, - config = get_plugin_file("fzf.lua"), - requires = { - { "junegunn/fzf" }, - { "stsewd/fzf-checkout.vim" }, - } - }, - { - 'glacambre/firenvim', -- Integrates neovim into the browser - config = get_plugin_file("firenvim.lua"), - run = function() vim.fn['firenvim#install'](0) end - }, - { - "williamboman/nvim-lsp-installer", -- LSP auto-installer - config = get_plugin_file("lsp.lua"), - requires = { - -- Predefined LSP server configurations - "neovim/nvim-lspconfig", - -- Support for autocompletion - "hrsh7th/nvim-cmp", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - }, - }, - - -- TODO: Consider testing out telescope as an alternative to FZF, I've heard a lot of - -- positive feedback about it, but I haven't yet got the chance to meaningfully test - -- it and configure it. - --{ - -- "nvim-telescope/telescope.nvim", - -- --config = get_plugin_file("telescope.lua") - -- module = "telescope", - -- cmd = "Telescope", - -- requires = { - -- { "nvim-lua/popup.nvim" }, - -- { "nvim-lua/plenary.nvim" }, - -- } - --}, - - -- Coc is disabled because we're using LSP. It implements support from language servers from - -- scratch, which is slower than neovim's built-in LSP and since this configuration won't work - -- with pure vim, we can rely on nvim-only thigns. I left it here because LSP can sometimes - -- cause issues and Coc is a lot more friendly to setup. - -- { - -- "neoclide/coc.nvim", - -- branch = "release", - -- config = get_plugin_file("coc.vim"), - -- requires = { "antoinemadec/coc-fzf", opt = true }, - -- }, -} - -return plugin_list diff --git a/home/.config/nvim/lua/plugins/settings/airline.lua b/home/.config/nvim/lua/plugins/settings/airline.lua deleted file mode 100644 index 7184da5..0000000 --- a/home/.config/nvim/lua/plugins/settings/airline.lua +++ /dev/null @@ -1,36 +0,0 @@ -local vim = require("vim") -local g = vim.g -local cmd = vim.cmd - --- Don't use special separators -g.airline_right_sep = "" -- (default: <) -g.airline_left_sep = "" -- (default: >) - --- Tabline setup --- TODO: Figure out how to set # separated variables in lua (open for PRs) -cmd[[let g:airline#extensions#tabline#enabled = 1]] -- Enable tabline (top line) -cmd[[let g:airline#tabline#formatter = 'unique_tail']] -- Tabline filename formatter - --- Special symbols -g.webdevicons_enable_airline_statusline = 0 -- Use special icons from vim-devicons (requires nerdfonts) -g.airline_powerline_fonts = 1 -- Use special symbols from poweline fonts (line no, col no) -if not os.getenv("DISPLAY") then -- Use ASCII-only if we're in TTY - g.airline_symbols_ascii = 1 -end - --- Disable airline in nerdtree buffer --- TODO; For some reason, this fails even though it works in regular vimscript ---[[ -cmd[[ -augroup filetype_nerdtree - au! - au FileType nerdtree call s:disable_airline_on_nerdtree() - au WinEnter,BufWinEnter,TabEnter * call s:disable_airline_on_nerdtree() -augroup END - -fu s:disable_airline_on_nerdtree() abort - let nerdtree_winnr = index(map(range(1, winnr('$')), {_,v -> getbufvar(winbufnr(v), '&ft')}), 'nerdtree') + 1 - call timer_start(0, {-> nerdtree_winnr && setwinvar(nerdtree_winnr, '&stl', '%#Normal#')}) -endfu -]] ---]] diff --git a/home/.config/nvim/lua/plugins/settings/blame_line.lua b/home/.config/nvim/lua/plugins/settings/blame_line.lua deleted file mode 100644 index 8165577..0000000 --- a/home/.config/nvim/lua/plugins/settings/blame_line.lua +++ /dev/null @@ -1,14 +0,0 @@ -local vim = require("vim") -local m = require("utility.mappings") - -m.keymap("n", "", ":ToggleBlameLine") - --- Enable blame line automatically ---vim.cmd[[autocmd BufEnter * EnableBlameLine]] - --- Specify the highlight group used for the virtual text ('Comment' by default) -vim.g.blameLineVirtualTextHighlight = 'Question' - --- Don't show a blame line when it isn't yet commited --- there's no reason to show "Not yet commited" since we have git gutter -vim.g.blameLineMessageWhenNotYetCommited = '' diff --git a/home/.config/nvim/lua/plugins/settings/coc.vim b/home/.config/nvim/lua/plugins/settings/coc.vim deleted file mode 100644 index 11be2ae..0000000 --- a/home/.config/nvim/lua/plugins/settings/coc.vim +++ /dev/null @@ -1,99 +0,0 @@ -" Converting these settings into lua isn't easy since we utilize -" which needs to be in a vim script context, making it impossible -" to replicate with simple vim.cmd call. It also contains a lot of function -" definitions taken from the coc github page without provided lua alternatives -" this makes it quite complicated to replicate this in pure lua, -" however if anyone knows how to completely reproduce everything here in lua, -" this is open to pull requests - -let g:coc_global_extensions = [ - \ 'coc-pyright', 'coc-json', 'coc-git', 'coc-html', 'coc-css', - \ 'coc-clangd', 'coc-cmake', 'coc-java', 'coc-sh', 'coc-toml', - \ 'coc-yaml', 'coc-omnisharp', 'coc-markdownlint', 'coc-pairs', - \ 'coc-lua' - \ ] - -nmap l :CocFzfList - -" Use tab for trigger completion with characters ahead and navigate. -" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion. -inoremap coc#refresh() - -" Use to confirm completion, `u` means break undo chain at current position. -" Coc only does snippet and additional edit on confirm. -inoremap pumvisible() ? "\" : "\u\" -" Or use `complete_info` if your vim support it, like: -" inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" - -" Use `[g` and `]g` to navigate diagnostics -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" Remap keys for gotos -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -" Remap for rename current word -nmap rn (coc-rename) - -" Remap for format selected region -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -augroup CocGroup - autocmd! - " Setup formatexpr specified filetype(s). - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Remap for do codeAction of selected region, ex: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap for do codeAction of current line -nmap ac (coc-codeaction) -" Fix autofix problem of current line -nmap qf (coc-fix-current) - -" Create mappings for function text object, requires document symbols feature of languageserver. -xmap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap if (coc-funcobj-i) -omap af (coc-funcobj-a) - -" Use `:Format` to format current buffer -command! -nargs=0 Format :call CocAction('format') - -" Use `:Fold` to fold current buffer -command! -nargs=? Fold :call CocAction('fold', ) - -" use `:OR` for organize import of current buffer -command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') - -" Add status line support, for integration with other plugin, checkout `:h coc-status` -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} diff --git a/home/.config/nvim/lua/plugins/settings/commentary.lua b/home/.config/nvim/lua/plugins/settings/commentary.lua deleted file mode 100644 index 6a1f92e..0000000 --- a/home/.config/nvim/lua/plugins/settings/commentary.lua +++ /dev/null @@ -1,10 +0,0 @@ -local m = require("utility.mappings") -local vim = require("vim") -local cmd = vim.cmd - --- Set up shortcuts to quickly comment some code -m.keymap("n", "", ":Commentary") -m.keymap("v", "", ":Commentary") - --- Set up comments for unhandled file types -cmd[[autocmd FileType apache setlocal commentstring=#\ %s]] diff --git a/home/.config/nvim/lua/plugins/settings/deprecated/semshi.lua b/home/.config/nvim/lua/plugins/settings/deprecated/semshi.lua deleted file mode 100644 index a2479e6..0000000 --- a/home/.config/nvim/lua/plugins/settings/deprecated/semshi.lua +++ /dev/null @@ -1,31 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd -local fn = vim.fn - --- Unused because the extension significantly slows down the opening time for vim. --- Also, while the semantic highlighting in it is neat, for me, it isn't worth in. --- --- The extension default colorscheme makes the code look like unicorn vommit. --- I'd prefer a simpler extension that only really distinguishes between classes, --- functions and perhaps unused variables. I don't need to see a different color --- when I access something as an attribute, but it would be neat to see what that --- attribute actually holds, is it a class or a fucntion. But from my searching, --- I wasn't able to find anything like this. This is open to pull requests. --- Plugin: numirias/semshi - -if (fn.has("python3")) then - fn.system({"pip", "install", "nvim", "--upgrade"}) -end - -cmd[[ -function MyCustomHighlights() - hi semshiParameter ctermfg=117 guifg=#93CCED - hi semshiParameterUnused ctermfg=117 guifg=#5e8193 cterm=underline gui=underline - hi semshiBuiltin ctermfg=29 guifg=#48bda5 - hi semshiAttribute ctermfg=254 guifg=#d1d1d1 - hi semshiImported ctermfg=214 guifg=#f8c466 cterm=bold gui=bold - hi semshiLocal ctermfg=209 guifg=#ff875f -endfunction - -autocmd FileType python call MyCustomHighlights() -]] diff --git a/home/.config/nvim/lua/plugins/settings/firenvim.lua b/home/.config/nvim/lua/plugins/settings/firenvim.lua deleted file mode 100644 index 3aa19ce..0000000 --- a/home/.config/nvim/lua/plugins/settings/firenvim.lua +++ /dev/null @@ -1,27 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd -local g = vim.g - --- Detect filetype based on filename for certain websites -cmd[[ -autocmd BufEnter github.com_*.txt set filetype=markdown -autocmd BufEnter txti.es_*.txt set filetype=typescript -]] - --- Define firenvim configuration -g.firenvim_config = { - globalSettings = { alt="all" }, - localSettings = { - [".*"] = { - cmdline = "neovim", - content = "text", - priority = 0, - selector = "textarea", - -- Don't automatically take over, require the shortcut - takeover = "never", - }, - -- Enable automatic takeover on certain websites where it makes sense - ["https?://github.com"] = { takeover = "always", priority=1 }, - ["https?://txti.es"] = { takeover = "always", priority = 1 }, - } -} diff --git a/home/.config/nvim/lua/plugins/settings/fzf.lua b/home/.config/nvim/lua/plugins/settings/fzf.lua deleted file mode 100644 index 5cd78d0..0000000 --- a/home/.config/nvim/lua/plugins/settings/fzf.lua +++ /dev/null @@ -1,36 +0,0 @@ -local m = require("utility.mappings") -local vim = require("vim") -local cmd = vim.cmd -local g = vim.g - -g.fzf_layout = { - up = '~90%', - window = { - width = 0.8, - height = 0.8, - yoffset = 0.5, - offset = 0.5 - } -} - -cmd[[let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline']] - --- Customize the Files command to use ripgrep which respects .gitignore files -cmd[[ -command! -bang -nargs=? -complete=dir Files - \ call fzf#run(fzf#wrap('files', fzf#vim#with_preview({ 'dir': , 'sink': 'e', 'source': 'rg --files --hidden' }), 0)) -]] - --- Add an AllFiles variation that shows ignored files too -cmd[[ -command! -bang -nargs=? -complete=dir AllFiles - \ call fzf#run(fzf#wrap('allfiles', fzf#vim#with_preview({ 'dir': , 'sink': 'e', 'source': 'rg --files --hidden --no-ignore' }), 0)) -]] - -m.keymap("n", "f", ":Files") -m.keymap("n", "F", ":AllFiles") -m.keymap("n", "b", ":Buffers") -m.keymap("n", "h", ":History") -m.keymap("n", "r", ":Rg") -m.keymap("n", "R", ":Rg", { silent = false }) -m.keymap("n", "gb", ":GBranches") diff --git a/home/.config/nvim/lua/plugins/settings/lsp.lua b/home/.config/nvim/lua/plugins/settings/lsp.lua deleted file mode 100644 index ffa6c3c..0000000 --- a/home/.config/nvim/lua/plugins/settings/lsp.lua +++ /dev/null @@ -1,87 +0,0 @@ -local vim = require("vim") -local fn = vim.fn - --- Load in our default plugin independant LSP settings. --- These are loaded from here, because we don't need them if we aren't using --- these plugins, which actually load in the LSP configurations and install the --- individual language servers. However it is possible to configure nvim --- without these plugins and so this config is separated from the plugin --- config. for more info, check the comments in lsp/init.lua -require("lsp") - - --- Configure nvim-cmp to respect LSP completions. -local cmp = require("cmp") - -cmp.setup({ - sources = { - { name = "nvim_lsp" } - } -}) - --- The nvim-cmp almost supports LSP's capabilities so you should advertise it to LSP servers -local cmp_capabilities = vim.lsp.protocol.make_client_capabilities() -cmp_capabilities = require("cmp_nvim_lsp").update_capabilities(cmp_capabilities) - --- Load in the needed settigns for nvim-lsp-installer plugin. --- This ensures automatic installation for the individual language servers. -local lsp_installer = require("nvim-lsp-installer") - --- Define some settings for the UI and installation path for the language --- servers. -lsp_installer.settings({ - ui = { - icons = { - server_installed = "✓", - server_pending = "➜", - server_uninstalled = "✗" - }, - keymaps = { - toggle_server_expand = "", - install_server = "i", - update_server = "u", - uninstall_server = "X", - }, - }, - install_root_dir = fn.stdpath("data") .. "/lsp_servers", -}) - --- Define a table of requested language servers which should be automatically --- installed. --- --- NOTE: pylsp requires external installaion with --- :PylspInstall pyls-flake8 pyls-mypy pyls-isort -local requested_servers = { - "clangd", "cmake", "omnisharp", - "cssls", "dockerls", "gopls", "html", - "hls", "jsonls", "jdtls", "tsserver", - "sumneko_lua", "pyright", "pylsp", - "sqlls", "vimls", "yamlls" -} - --- Go through the requested servers and ensure installation --- Once the servers are ready, run setup() on them. This setup is basically --- running the lspconfig.server.setup() which means lspconfig is needed to do --- this. -local lsp_installer_servers = require('nvim-lsp-installer.servers') -for _, requested_server in pairs(requested_servers) do - local server_available, server = lsp_installer_servers.get_server(requested_server) - if server_available then - -- Setup the server once it will become ready - server:on_ready(function() - -- Advertise completion capabilities by nvim-cmp - local opts = { capabilities = cmp_capabilities } - server:setup(opts) - end) - -- If the server isn't yet installed, schedule the installation - if not server:is_installed() then - server:install() - end - else - vim.notify( - "Can't install: Language server " .. server .. " was not found - SKIPPED", - vim.log.levels.WARN, - { title = "Notification" } - ) - end -end diff --git a/home/.config/nvim/lua/plugins/settings/nerdtree.lua b/home/.config/nvim/lua/plugins/settings/nerdtree.lua deleted file mode 100644 index 5ea4d21..0000000 --- a/home/.config/nvim/lua/plugins/settings/nerdtree.lua +++ /dev/null @@ -1,62 +0,0 @@ -local m = require("utility.mappings") -local vim = require("vim") -local g = vim.g -local fn = vim.fn -local cmd = vim.cmd - --- Implement manual NERDTreeToggle, but use NERDTreeFind for openning. --- This makes NERDTree open with the current file pre-selected -m.keymap("n", "", "g:NERDTree.IsOpen() ? ':NERDTreeClose' : @% == '' ? ':NERDTree' : ':NERDTreeFind'", {expr=true}) - -g.NERDTreeShowHidden = 1 -g.NERDTreeMinimalUI = 1 -g.NERDTreeShowLineNumbers = 0 -g.NERDTreeWinSize = 25 - -g.NERDTreeDirArrowExpandable = '►' -g.NERDTreeDirArrowCollapsible = '▼' - --- Disable devicons for nerdtree in TTY -if not os.getenv("DISPLAY") then - g.webdevicons_enable_nerdtree = 0 -else - g.DevIconsEnableFoldersOpenClose = 1 -end - --- If a directory is specified, start NERDTree -cmd[[ -autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | - \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | - \ endif -]] - --- Exit Vim if NERDTree is the only window left. --- WARNING: This causes issues when closing buffers ---[[ -cmd[[ -autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | - \ quit | endif -]] - --- If another buffer tries to replace NerdTree, put it in another window, and bring back NerdTree. -cmd[[ -autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | - \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif -]] - --- Use $NERDTREE_BOOKMARKS environment variable for the location of .NERDTreeBookmarks file -local bookmark_loc = os.getenv("NERDTREE_BOOKMARKS") -if bookmark_loc then - -- Check if file exists (lua doesn't have a built-in function for this) - local file_exists = os.rename(bookmark_loc, bookmark_loc) and true or false - - if not file_exists then - -- While this is possible with os.execute in lua, we would need to do some hacky - -- things to capture output from os.execute and it's simpler to just use vimscript - local dir = fn.system("dirname $NERDTREE_BOOKMARKS") - fn.system({"mkdir", "-p", dir}) - fn.system("touch $NERDTREE_BOOKMARKS") - end - g.NERDTreeBookmarksFile = bookmark_loc -end diff --git a/home/.config/nvim/lua/plugins/settings/nvim-dap.lua b/home/.config/nvim/lua/plugins/settings/nvim-dap.lua deleted file mode 100644 index ef597ff..0000000 --- a/home/.config/nvim/lua/plugins/settings/nvim-dap.lua +++ /dev/null @@ -1,25 +0,0 @@ -local m = require("utility.mappings") -local vim = require("vim") -local cmd = vim.cmd - --- Define dap mappings (:help dap-mapping) -local prefix = ":lua require('dap')." -m.keymap("n", "", prefix .. "continue()") -m.keymap("n", "", prefix .. "step_over()") -m.keymap("n", "", prefix .. "step_into()") -m.keymap("n", "", prefix .. "step_out()") -m.keymap("n", "", prefix .. "toggle_breakpoint()") -m.keymap("n", "", prefix .. "set_breakpoint(vim.fn.input('Breakpoint condition: '))") -m.keymap("n", "", prefix .. "set_breakpoint(nil, nil, vim.fn.input('Log point message: '))") -m.keymap("n", "di", prefix .. "repl.open()") -m.keymap("n", "dl", prefix .. "run_last()") - --- Setup dap for python (requires nvim-dap-python plugin) -require('dap-python').setup('/usr/bin/python') -- Path to python with `debugpy` library installed -require('dap-python').test_runner = 'pytest' -- Use pytest to run unit tests - --- Python mappings -local pyprefix = ":lua require('dap-python')." -m.keymap("n", "dptm", pyprefix .. "test_method()") -m.keymap("n", "dptc", pyprefix .. "test_class()") -m.keymap("v", "ds", "" .. pyprefix .. "debug_selection()") diff --git a/home/.config/nvim/lua/plugins/settings/treesitter.lua b/home/.config/nvim/lua/plugins/settings/treesitter.lua deleted file mode 100644 index 7f90fe3..0000000 --- a/home/.config/nvim/lua/plugins/settings/treesitter.lua +++ /dev/null @@ -1,28 +0,0 @@ -local vim = require("vim") -local g = vim.g - --- Enable treesitter highlight for all languages -require'nvim-treesitter.configs'.setup { - -- Always automatically install parsers for these languages - ensure_installed = { - "bash", "python", "lua", "rust", "go", "haskell", - "c", "cpp", "cmake", "c_sharp", "java", "dockerfile", - "json", "toml", "yaml", "regex", "vim", "html", "css", - "typescript", "javascript", - }, - highlight = { - enable = true, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} - --- Use git instead of curl for downloading parsers -require("nvim-treesitter.install").prefer_git = true - --- Use treesitter for syntax-aware folding -g.foldmethod = "expr" -g.foldexpr = "nvim_treesitter#foldexpr()" diff --git a/home/.config/nvim/lua/plugins/settings/vim-code-dark.lua b/home/.config/nvim/lua/plugins/settings/vim-code-dark.lua deleted file mode 100644 index 6690b7f..0000000 --- a/home/.config/nvim/lua/plugins/settings/vim-code-dark.lua +++ /dev/null @@ -1,4 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd - -cmd[[colorscheme codedark]] diff --git a/home/.config/nvim/lua/plugins/settings/vimwiki.lua b/home/.config/nvim/lua/plugins/settings/vimwiki.lua deleted file mode 100644 index 80a10cc..0000000 --- a/home/.config/nvim/lua/plugins/settings/vimwiki.lua +++ /dev/null @@ -1,12 +0,0 @@ -local vim = require("vim") -local cmd = vim.cmd -local g = vim.g - -local wiki_conf = {} -wiki_conf["path"] = "~/Personal/vimwiki" -wiki_conf["path_html"] = "~/Personal/vimwiki-html" -wiki_conf["html_template"] = "~/Personal/vimwiki-html/template.tpl" -wiki_conf["syntax"] = "markdown" -wiki_conf["ext"] = ".md" -g.vimwiki_list = {wiki_conf} - diff --git a/home/.config/nvim/lua/utility/mappings.lua b/home/.config/nvim/lua/utility/mappings.lua deleted file mode 100644 index 6d18a7e..0000000 --- a/home/.config/nvim/lua/utility/mappings.lua +++ /dev/null @@ -1,29 +0,0 @@ -local vim = require("vim") -local api = vim.api -local cmd = vim.cmd - -local M = {} - --- Define a keymap -function M.keymap(mode, shortcut, command, options) - -- Assume silent, noremap unless specified otherwise - local opts = {noremap=true, silent=true} - - if options then opts = vim.tbl_extend("force", opts, options) end - api.nvim_set_keymap(mode, shortcut, command, opts) -end - --- Define an abbreviation -function M.abbrev(mode, input, result, reabbrev) - -- Assume noreabbrev unless specified otherwise - reabbrev = reabbrev or false - local command - if reabbrev then - command = mode .. "abbrev" - else - command = mode .. "noreabbrev" - end - cmd(command .. " " .. input .. " " .. result) -end - -return M diff --git a/home/.config/nvim/lua/vim.lua b/home/.config/nvim/lua/vim.lua deleted file mode 100644 index 2bfb110..0000000 --- a/home/.config/nvim/lua/vim.lua +++ /dev/null @@ -1,7 +0,0 @@ --- This file is here to allow running `local vim = require("vim")`, which --- avoids the hassle of having to ignore vim as undefined-global for lua --- language server diagnostics. Another advantage is that it actually allows --- us to detect the attributes of vim so we will get suggestions. - ----@diagnostic disable-next-line:undefined-global -return vim