From 2cd8c6a21cb6c9af91e631f565e31f5803cdaa7c Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Thu, 15 Apr 2021 00:17:48 -0400 Subject: LunarVim --- README.md | 91 +++++++-------- init.lua | 65 ++++------- lua/lsp/emmet-ls.lua | 19 ++++ lua/lsp/virtual_text.lua | 15 --- lua/lv-autocommands/init.lua | 58 ++++++++++ lua/lv-autopairs/init.lua | 77 +++++++++++++ lua/lv-barbar/init.lua | 3 + lua/lv-comment/init.lua | 3 + lua/lv-compe/init.lua | 102 +++++++++++++++++ lua/lv-dashboard/init.lua | 55 +++++++++ lua/lv-emmet/init.lua | 19 ++++ lua/lv-galaxyline/init.lua | 208 ++++++++++++++++++++++++++++++++++ lua/lv-gitsigns/init.lua | 24 ++++ lua/lv-globals.lua | 66 +++++++++++ lua/lv-lspinstall/init.lua | 18 +++ lua/lv-lspkind/init.lua | 26 +++++ lua/lv-nvim-dap/init.lua | 0 lua/lv-nvimtree/init.lua | 65 +++++++++++ lua/lv-rnvimr/init.lua | 6 + lua/lv-telescope/init.lua | 64 +++++++++++ lua/lv-treesitter/init.lua | 12 ++ lua/lv-utils/init.lua | 190 +++++++++++++++++++++++++++++++ lua/nv-autocommands/init.lua | 58 ---------- lua/nv-autopairs/init.lua | 77 ------------- lua/nv-barbar/init.lua | 3 - lua/nv-bookmark/init.lua | 2 - lua/nv-colorizer/init.lua | 12 -- lua/nv-comment/init.lua | 3 - lua/nv-compe/init.lua | 102 ----------------- lua/nv-dadbod/init.lua | 6 - lua/nv-dashboard/init.lua | 33 ------ lua/nv-dependency/init.lua | 1 - lua/nv-dial/init.lua | 15 --- lua/nv-doge/init.lua | 1 - lua/nv-emmet/init.lua | 19 ---- lua/nv-floaterm/init.lua | 14 --- lua/nv-galaxyline/init.lua | 208 ---------------------------------- lua/nv-gitblame/init.lua | 2 - lua/nv-gitsigns/init.lua | 24 ---- lua/nv-globals.lua | 66 ----------- lua/nv-hop/init.lua | 3 - lua/nv-indentline/init.lua | 11 -- lua/nv-lightbulb/init.lua | 34 ------ lua/nv-lspinstall/init.lua | 18 --- lua/nv-lspkind/init.lua | 26 ----- lua/nv-matchup/init.lua | 1 - lua/nv-numb/init.lua | 4 - lua/nv-nvim-dap/init.lua | 0 lua/nv-nvim-peekup/init.lua | 2 - lua/nv-nvimtree/init.lua | 74 ------------ lua/nv-quickscope/init.lua | 4 - lua/nv-rnvimr/init.lua | 24 ---- lua/nv-startify/init.lua | 33 ------ lua/nv-surround/init.lua | 0 lua/nv-telescope/init.lua | 73 ------------ lua/nv-treesitter/init.lua | 21 ---- lua/nv-utils/init.lua | 190 ------------------------------- lua/nv-vim-rooter/init.lua | 2 - lua/plugins.lua | 224 +++++++++++++------------------------ lv-settings.lua | 52 +++++++++ nv-settings.lua | 53 --------- utils/init.lua | 2 - utils/installer/install.sh | 28 ++--- utils/media/demo.png | Bin 681946 -> 876670 bytes utils/media/nvcode_logo.png | Bin 11319 -> 0 bytes utils/media/nvcode_logo.png.old | Bin 6112 -> 0 bytes vimscript/functions.vim | 54 +++++---- vimscript/lv-vscode/init.vim | 119 ++++++++++++++++++++ vimscript/lv-whichkey/init.vim | 140 +++++++++++++++++++++++ vimscript/nv-vscode/init.vim | 119 -------------------- vimscript/nv-whichkey/init.vim | 242 ---------------------------------------- 71 files changed, 1502 insertions(+), 1883 deletions(-) create mode 100644 lua/lsp/emmet-ls.lua delete mode 100644 lua/lsp/virtual_text.lua create mode 100644 lua/lv-autocommands/init.lua create mode 100644 lua/lv-autopairs/init.lua create mode 100644 lua/lv-barbar/init.lua create mode 100644 lua/lv-comment/init.lua create mode 100644 lua/lv-compe/init.lua create mode 100644 lua/lv-dashboard/init.lua create mode 100644 lua/lv-emmet/init.lua create mode 100644 lua/lv-galaxyline/init.lua create mode 100644 lua/lv-gitsigns/init.lua create mode 100644 lua/lv-globals.lua create mode 100644 lua/lv-lspinstall/init.lua create mode 100644 lua/lv-lspkind/init.lua create mode 100644 lua/lv-nvim-dap/init.lua create mode 100644 lua/lv-nvimtree/init.lua create mode 100644 lua/lv-rnvimr/init.lua create mode 100644 lua/lv-telescope/init.lua create mode 100644 lua/lv-treesitter/init.lua create mode 100644 lua/lv-utils/init.lua delete mode 100644 lua/nv-autocommands/init.lua delete mode 100644 lua/nv-autopairs/init.lua delete mode 100644 lua/nv-barbar/init.lua delete mode 100644 lua/nv-bookmark/init.lua delete mode 100644 lua/nv-colorizer/init.lua delete mode 100644 lua/nv-comment/init.lua delete mode 100644 lua/nv-compe/init.lua delete mode 100644 lua/nv-dadbod/init.lua delete mode 100644 lua/nv-dashboard/init.lua delete mode 100644 lua/nv-dependency/init.lua delete mode 100644 lua/nv-dial/init.lua delete mode 100644 lua/nv-doge/init.lua delete mode 100644 lua/nv-emmet/init.lua delete mode 100644 lua/nv-floaterm/init.lua delete mode 100644 lua/nv-galaxyline/init.lua delete mode 100644 lua/nv-gitblame/init.lua delete mode 100644 lua/nv-gitsigns/init.lua delete mode 100644 lua/nv-globals.lua delete mode 100644 lua/nv-hop/init.lua delete mode 100644 lua/nv-indentline/init.lua delete mode 100644 lua/nv-lightbulb/init.lua delete mode 100644 lua/nv-lspinstall/init.lua delete mode 100644 lua/nv-lspkind/init.lua delete mode 100644 lua/nv-matchup/init.lua delete mode 100644 lua/nv-numb/init.lua delete mode 100644 lua/nv-nvim-dap/init.lua delete mode 100644 lua/nv-nvim-peekup/init.lua delete mode 100644 lua/nv-nvimtree/init.lua delete mode 100644 lua/nv-quickscope/init.lua delete mode 100644 lua/nv-rnvimr/init.lua delete mode 100644 lua/nv-startify/init.lua delete mode 100644 lua/nv-surround/init.lua delete mode 100644 lua/nv-telescope/init.lua delete mode 100644 lua/nv-treesitter/init.lua delete mode 100644 lua/nv-utils/init.lua delete mode 100644 lua/nv-vim-rooter/init.lua create mode 100644 lv-settings.lua delete mode 100644 nv-settings.lua delete mode 100644 utils/init.lua delete mode 100755 utils/media/nvcode_logo.png delete mode 100755 utils/media/nvcode_logo.png.old create mode 100644 vimscript/lv-vscode/init.vim create mode 100644 vimscript/lv-whichkey/init.vim delete mode 100644 vimscript/nv-vscode/init.vim delete mode 100644 vimscript/nv-whichkey/init.vim diff --git a/README.md b/README.md index 41db95c8..ba844bb8 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,33 @@ -![NVCode Logo](./utils/media/nvcode_logo.png) +``` + _..._ + .' (_`. _ __ ___ +: . : | | _ _ _ __ __ _ _ _\ \ / (_)_ __ ___ +:) () : | | | | | | '_ \ / _` | '__\ \ / /| | '_ ` _ \ +`. . .' | |__| |_| | | | | (_| | | \ V / | | | | | | | + `-...-' |_____\__,_|_| |_|\__,_|_| \_/ |_|_| |_| |_| +``` -chat on Discord -[![GitHub license](https://img.shields.io/github/license/ChristianChiarulli/nvcode)](https://github.com/ChristianChiarulli/nvcode/blob/master/LICENSE) -[![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/ChristianChiarulli/nvcode) +[![GitHub license](https://img.shields.io/github/license/ChristianChiarulli/lunarvim)](https://github.com/ChristianChiarulli/lunarvim/blob/master/LICENSE) +[![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/ChristianChiarulli/lunarvim) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) Patreon donate button follow on Twitter +![LunarVim Demo](./utils/media/demo.png) +1. This project aims to help one transition away from VSCode, and into a superior text editing experience. (Just making this clear) +2. This is also a community project, if you would like to see support for a feature or [language](https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md) consider making a PR. -![NVCode Demo](./utils/media/demo.png) - -This project aims to help one transition away from VSCode, and into a superior text editing experience. (Just making this clear) - -This is also a community project, if you would like to see support for a feature or language consider making a PR. +3. This project will do it's best to include core features you would expect from a modern IDE, while making it easy to add or remove what the user wants. ## Install In One Command! Make sure you have the newest version of Neovim ``` bash -bash <(curl -s https://raw.githubusercontent.com/ChristianChiarulli/nvim/master/utils/installer/install.sh) +bash <(curl -s https://raw.githubusercontent.com/ChristianChiarulli/lunarvim/master/utils/installer/install.sh) ``` After installation run `nvim` and then `:PackerInstall` @@ -43,30 +48,6 @@ or if you are on Arch you can get it from the AUR yay -S neovim-nightly-git ``` -## VSCode support - -I recommend you support Free/Libre versions if you plan to use VSCode: - -- [VSCodium](https://vscodium.com/) - -- Article to get you set up with VSCodium: [link](https://www.chrisatmachine.com/Neovim/22-vscodium-neovim/) - -After installing the [Neovim -extension](https://github.com/asvetliakov/vscode-neovim) in VSCode - -I recommend using this alongside the VSCode -[which-key](https://github.com/VSpaceCode/vscode-which-key) extension - -You will also need `settings.json` and `keybindings.json` which can be -found in utils/vscode\_config - -Point the nvim path to your `nvim` binary - -Point your `init.vim` path to: - -``` vim -$HOME/.config/nvim/vimscript/nv-vscode/init.vim -``` ## Clipboard Support @@ -110,16 +91,12 @@ For a more in depth LSP support: ## Useful Programs +LunarVim depends on the following: + ``` bash ranger ueberzug -fd ripgrep -jq -fzf -lazygit -lazydocker -ncdu pynvim neovim-remote ``` @@ -160,23 +137,35 @@ npm install -g prettier pandoc ``` -## Vim Gists +## De-bugging -To use vim-gists you will need to configure the following: +To set up your particular debugger, look here: +[link](https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation) -``` bash -git config --global github.user -``` +## VSCodium -## Snippets +I recommend you support Free/Libre versions if you plan to use VSCode: -If you are looking for snippets checkout this github topic: [Snippet -Topic](https://github.com/topics/vscode-snippets) +- [VSCodium](https://vscodium.com/) -## De-bugging +- Article to get you set up with VSCodium: [link](https://www.chrisatmachine.com/Neovim/22-vscodium-neovim/) -To set up your particular debugger, look here: -[link](https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation) +After installing the [Neovim +extension](https://github.com/asvetliakov/vscode-neovim) in VSCode + +I recommend using this alongside the VSCode +[which-key](https://github.com/VSpaceCode/vscode-which-key) extension + +You will also need `settings.json` and `keybindings.json` which can be +found in utils/vscode\_config + +Point the nvim path to your `nvim` binary + +Point your `init.vim` path to: + +``` vim +$HOME/.config/nvim/vimscript/lv-vscode/init.vim +``` ## TODO diff --git a/init.lua b/init.lua index 3d14f420..a61f14c2 100644 --- a/init.lua +++ b/init.lua @@ -1,49 +1,27 @@ --- General mappings require('plugins') -require('nv-globals') -require('nv-utils') -vim.cmd('luafile ~/.config/nvim/nv-settings.lua') -require('nv-autocommands') --- require('config') +require('lv-globals') +require('lv-utils') +vim.cmd('luafile ~/.config/nvim/lv-settings.lua') +require('lv-autocommands') require('settings') require('keymappings') require('colorscheme') -require('nv-galaxyline') - --- Plugins -require('nv-compe') -require('nv-colorizer') -require('nv-nvimtree') -require('nv-treesitter') -require('nv-barbar') -require('nv-emmet') -require('nv-quickscope') -require('nv-gitsigns') -require('nv-autopairs') -require('nv-comment') -require('nv-rnvimr') -require('nv-telescope') -require('nv-floaterm') -require('nv-vim-rooter') -require('nv-matchup') -require('nv-lspkind') -require('nv-numb') -require('nv-hop') -require('nv-gitblame') -require('nv-nvim-peekup') -require('nv-dashboard') -require('nv-dial') -require('nv-nvim-dap') -require('nv-lightbulb') -require('nv-indentline') -require('nv-bookmark') -require('nv-dadbod') -require('nv-doge') -require('nv-dependency') --- require('nv-lspinstall') +require('lv-galaxyline') +require('lv-comment') +require('lv-lspkind') +require('lv-compe') +require('lv-barbar') +require('lv-dashboard') +require('lv-telescope') +require('lv-gitsigns') +require('lv-nvimtree') +require('lv-treesitter') +require('lv-autopairs') +require('lv-barbar') +require('lv-rnvimr') -- Which Key (Hope to replace with Lua plugin someday) -vim.cmd('source ~/.config/nvim/vimscript/nv-whichkey/init.vim') +vim.cmd('source ~/.config/nvim/vimscript/lv-whichkey/init.vim') vim.cmd('source ~/.config/nvim/vimscript/functions.vim') -- LSP @@ -62,14 +40,11 @@ require('lsp.yaml-ls') require('lsp.terraform-ls') require('lsp.vim-ls') require('lsp.graphql-ls') -require('lsp.css-ls') require('lsp.docker-ls') require('lsp.html-ls') +require('lsp.css-ls') +require('lsp.emmet-ls') require('lsp.efm-general-ls') -require('lsp.virtual_text') require('lsp.latex-ls') require('lsp.svelte-ls') require('lsp.tailwindcss-ls') - --- vim.lsp.callbacks["textDocument/publishDiagnostics"] = function() end --- vim.lsp.handlers["textDocument/publishDiagnostics"] = nil diff --git a/lua/lsp/emmet-ls.lua b/lua/lsp/emmet-ls.lua new file mode 100644 index 00000000..6531ccf0 --- /dev/null +++ b/lua/lsp/emmet-ls.lua @@ -0,0 +1,19 @@ +local nvim_lsp = require'lspconfig' +local configs = require'lspconfig/configs' +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +configs.emmet_ls = { + default_config = { + cmd = {'emmet-ls', '--stdio'}; + filetypes = {'html', 'css'}; + root_dir = function() + return vim.loop.cwd() + end; + settings = {}; + }; +} + +nvim_lsp.emmet_ls.setup{ + -- on_attach = on_attach; +} diff --git a/lua/lsp/virtual_text.lua b/lua/lsp/virtual_text.lua deleted file mode 100644 index 9ca2e998..00000000 --- a/lua/lsp/virtual_text.lua +++ /dev/null @@ -1,15 +0,0 @@ -local virtual_text = {} - -virtual_text.show = true - -virtual_text.toggle = function() - virtual_text.show = not virtual_text.show - vim.lsp.diagnostic.display( - vim.lsp.diagnostic.get(0, 1), - 0, - 1, - {virtual_text = virtual_text.show} - ) -end - -return virtual_text diff --git a/lua/lv-autocommands/init.lua b/lua/lv-autocommands/init.lua new file mode 100644 index 00000000..5b562784 --- /dev/null +++ b/lua/lv-autocommands/init.lua @@ -0,0 +1,58 @@ +local utils = require('lv-utils') + +local auto_formatters = { } + +local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end + +local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +if O.tsserver.autoformat then + table.insert(auto_formatters, javascript_autoformat) + table.insert(auto_formatters, javascriptreact_autoformat) +end + +local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +if O.lua.autoformat then table.insert(auto_formatters, lua_format) end + +local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +if O.json.autoformat then table.insert(auto_formatters, json_format) end + +utils.define_augroups({ + _general_settings = { + {'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'}, + {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, + {'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, + {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, + {'VimLeavePre', '*', 'set title set titleold='} + + -- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'}, + -- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'}, + }, + _java = { + {'FileType', 'java', 'luafile ~/.config/nvim/lua/lsp/java-ls.lua'}, + {'FileType', 'java', 'nnoremap ca lua require(\'jdtls\').code_action()'} + }, + _dashboard = { + -- seems to be nobuflisted that makes my stuff disapear will do more testing + { + 'FileType', 'dashboard', + 'setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ' + }, {'FileType', 'dashboard', 'set showtabline=0 | autocmd BufLeave set showtabline=2'} + }, + _markdown = {{'FileType', 'markdown', 'setlocal wrap'}, {'FileType', 'markdown', 'setlocal spell'}}, + _solidity = { + {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'}, + {'BufNewFile', '*.sol', 'setlocal filetype=solidity'} + }, + _gemini = { + {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'}, + {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'} + }, + _buffer_bindings = { + {'FileType', 'dashboard', 'nnoremap q :q'}, + {'FileType', 'lspinfo', 'nnoremap q :q'}, + {'FileType', 'floaterm', 'nnoremap q :q'}, + }, + _auto_formatters = auto_formatters +}) diff --git a/lua/lv-autopairs/init.lua b/lua/lv-autopairs/init.lua new file mode 100644 index 00000000..5d0adf85 --- /dev/null +++ b/lua/lv-autopairs/init.lua @@ -0,0 +1,77 @@ +require('nvim-autopairs').setup() +local npairs = require('nvim-autopairs') + +local function imap(lhs, rhs, opts) + local options = {noremap = false} + if opts then options = vim.tbl_extend('force', options, opts) end + vim.api.nvim_set_keymap('i', lhs, rhs, options) +end + +_G.MUtils = {} + +-- TEST +vim.g.completion_confirm_key = "" +MUtils.completion_confirm = function() + if vim.fn.pumvisible() ~= 0 then + if vim.fn.complete_info()["selected"] ~= -1 then + vim.fn["compe#confirm"]() + -- return npairs.esc("") + return npairs.esc("") + else + vim.defer_fn(function() + vim.fn["compe#confirm"]("") + end, 20) + return npairs.esc("") + end + else + return npairs.check_break_line_char() + end +end +-- TEST + +MUtils.completion_confirm = function() + if vim.fn.pumvisible() ~= 0 then + if vim.fn.complete_info()["selected"] ~= -1 then + vim.fn["compe#confirm"]() + return npairs.esc("") + else + vim.api.nvim_select_popupmenu_item(0, false, false, {}) + vim.fn["compe#confirm"]() + return npairs.esc("") + end + else + return npairs.check_break_line_char() + end +end + +MUtils.tab = function() + if vim.fn.pumvisible() ~= 0 then + return npairs.esc("") + else + if vim.fn["vsnip#available"](1) ~= 0 then + vim.fn.feedkeys(string.format('%c%c%c(vsnip-expand-or-jump)', 0x80, 253, 83)) + return npairs.esc("") + else + return npairs.esc("") + end + end +end + +MUtils.s_tab = function() + if vim.fn.pumvisible() ~= 0 then + return npairs.esc("") + else + if vim.fn["vsnip#jumpable"](-1) ~= 0 then + vim.fn.feedkeys(string.format('%c%c%c(vsnip-jump-prev)', 0x80, 253, 83)) + return npairs.esc("") + else + return npairs.esc("") + end + end +end + +-- Autocompletion and snippets +vim.api.nvim_set_keymap('i', '', 'v:lua.MUtils.completion_confirm()', {expr = true, noremap = true}) +-- imap("", "v:lua.MUtils.completion_confirm()", {expr = true, noremap = true}) +imap("", "v:lua.MUtils.tab()", {expr = true, noremap = true}) +imap("", "v:lua.MUtils.s_tab()", {expr = true, noremap = true}) diff --git a/lua/lv-barbar/init.lua b/lua/lv-barbar/init.lua new file mode 100644 index 00000000..49c1206b --- /dev/null +++ b/lua/lv-barbar/init.lua @@ -0,0 +1,3 @@ +vim.api.nvim_set_keymap('n', '', ':BufferNext', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':BufferPrevious', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':BufferClose', { noremap = true, silent = true }) diff --git a/lua/lv-comment/init.lua b/lua/lv-comment/init.lua new file mode 100644 index 00000000..df794386 --- /dev/null +++ b/lua/lv-comment/init.lua @@ -0,0 +1,3 @@ +require('nvim_comment').setup() +vim.api.nvim_set_keymap("n", "/", ":CommentToggle", {noremap=true, silent = true}) +vim.api.nvim_set_keymap("v", "/", ":CommentToggle", {noremap=true, silent = true}) diff --git a/lua/lv-compe/init.lua b/lua/lv-compe/init.lua new file mode 100644 index 00000000..61270960 --- /dev/null +++ b/lua/lv-compe/init.lua @@ -0,0 +1,102 @@ +vim.o.completeopt = "menuone,noselect" + +require'compe'.setup { + enabled = O.auto_complete, + autocomplete = true, + debug = false, + min_length = 1, + preselect = 'enable', + throttle_time = 80, + source_timeout = 200, + incomplete_delay = 400, + max_abbr_width = 100, + max_kind_width = 100, + max_menu_width = 100, + documentation = true, + + source = { + path = {kind = "  "}, + buffer = {kind = "  "}, + calc = {kind = "  "}, + vsnip = {kind = "  "}, + nvim_lsp = {kind = "  "}, + -- nvim_lua = {kind = "  "}, + nvim_lua = false, + spell = {kind = "  "}, + tags = false, + vim_dadbod_completion = true, + -- snippets_nvim = {kind = "  "}, + -- ultisnips = {kind = "  "}, + -- treesitter = {kind = "  "}, + emoji = {kind = " ﲃ ", filetypes={"markdown", "text"}} + -- for emoji press : (idk if that in compe tho) + } +} + +--  +--  +--  +--  +--  +--  +--  +--  +--  +--  +--  +--  +--  +--  +--  +--  +-- ﬘ +--  +--  +--  +-- m +--  +--  +--  +--  + +local t = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + +local check_back_space = function() + local col = vim.fn.col('.') - 1 + if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + return true + else + return false + end +end + +-- Use (s-)tab to: +--- move to prev/next item in completion menuone +--- jump to prev/next snippet's placeholder +_G.tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#available", {1}) == 1 then + return t "(vsnip-expand-or-jump)" + elseif check_back_space() then + return t "" + else + return vim.fn['compe#complete']() + end +end +_G.s_tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then + return t "(vsnip-jump-prev)" + else + return t "" + end +end + +vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) diff --git a/lua/lv-dashboard/init.lua b/lua/lv-dashboard/init.lua new file mode 100644 index 00000000..b8553405 --- /dev/null +++ b/lua/lv-dashboard/init.lua @@ -0,0 +1,55 @@ +-- vim.g.dashboard_custom_header = { +-- '███╗ ██╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗', +-- '████╗ ██║██║ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝', +-- '██╔██╗ ██║██║ ██║██║ ██║ ██║██║ ██║█████╗', +-- '██║╚██╗██║╚██╗ ██╔╝██║ ██║ ██║██║ ██║██╔══╝', +-- '██║ ╚████║ ╚████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗', +-- '╚═╝ ╚═══╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝' +-- } +-- vim.g.dashboard_custom_header = { +-- +-- ' _..._ ', +-- ' .\' `. ██  ██  ██ ███  ██  █████  ██████  ██  ██ ██ ███  ███ ', +-- ' : : ██  ██  ██ ████  ██ ██   ██ ██   ██ ██  ██ ██ ████  ████ ', +-- ' : : ██  ██  ██ ██ ██  ██ ███████ ██████  ██  ██ ██ ██ ████ ██ ', +-- ' `. .\' ██  ██  ██ ██  ██ ██ ██   ██ ██   ██  ██  ██  ██ ██  ██  ██ ', +-- ' `-...-\' ███████  ██████  ██   ████ ██  ██ ██  ██   ████   ██ ██      ██ ', +-- +-- } + +vim.g.dashboard_custom_header = { + +' _..._ ', +' .\' (_`. _ __ ___ ', +' : . : | | _ _ _ __ __ _ _ _\\ \\ / (_)_ __ ___ ', +' :) () : | | | | | | \'_ \\ / _` | \'__\\ \\ / /| | \'_ ` _ \\ ', +' `. . .\' | |__| |_| | | | | (_| | | \\ V / | | | | | | |', +' `-...-\' |_____\\__,_|_| |_|\\__,_|_| \\_/ |_|_| |_| |_|', + +} + + +vim.g.dashboard_default_executive = 'telescope' + +vim.g.dashboard_custom_section = { + a = {description = {' Find File '}, command = 'Telescope find_files'}, + b = {description = {' Recently Used Files'}, command = 'Telescope oldfiles'}, + c = {description = {' Load Last Session '}, command = 'SessionLoad'}, + d = {description = {' Find Word '}, command = 'Telescope live_grep'}, + e = {description = {' Settings '}, command = ':e ~/.config/nvim/nv-settings.lua'} + -- e = {description = {' Marks '}, command = 'Telescope marks'} +} + +-- file_browser = {description = {' File Browser'}, command = 'Telescope find_files'}, + +-- vim.g.dashboard_custom_shortcut = { +-- a = 'f', +-- find_word = 'SPC f a', +-- last_session = 'SPC s l', +-- new_file = 'SPC c n', +-- book_marks = 'SPC f b' +-- } +-- find_history = 'SPC f h', + +-- vim.g.dashboard_session_directory = '~/.cache/nvim/session' +vim.g.dashboard_custom_footer = {'chrisatmachine.com'} diff --git a/lua/lv-emmet/init.lua b/lua/lv-emmet/init.lua new file mode 100644 index 00000000..445a33f7 --- /dev/null +++ b/lua/lv-emmet/init.lua @@ -0,0 +1,19 @@ +-- After you have what you want press C-Y and , at the same time +-- autocmd FileType html,css EmmetInstall +-- vim.g.user_emmet_leader_key='' +vim.g.user_emmet_mode='inv' +vim.g.user_emmet_expandabbr_key = ',' +vim.g.user_emmet_expandword_key = ';' +vim.g.user_emmet_update_tag = 'u' +vim.g.user_emmet_balancetaginward_key = 'd' +vim.g.user_emmet_balancetagoutward_key = 'D' +vim.g.user_emmet_next_key = 'n' +vim.g.user_emmet_prev_key = 'N' +vim.g.user_emmet_imagesize_key = 'i' +vim.g.user_emmet_togglecomment_key = '/' +vim.g.user_emmet_splitjointag_key = 'j' +vim.g.user_emmet_removetag_key = 'k' +vim.g.user_emmet_anchorizeurl_key = 'a' +vim.g.user_emmet_anchorizesummary_key = 'A' +vim.g.user_emmet_mergelines_key = 'm' +vim.g.user_emmet_codepretty_key = 'c' diff --git a/lua/lv-galaxyline/init.lua b/lua/lv-galaxyline/init.lua new file mode 100644 index 00000000..f9ac859b --- /dev/null +++ b/lua/lv-galaxyline/init.lua @@ -0,0 +1,208 @@ +local gl = require('galaxyline') +-- get my theme in galaxyline repo +-- local colors = require('galaxyline.theme').default +local colors = { + -- bg = '#2E2E2E', + bg = '#292D38', + yellow = '#DCDCAA', + dark_yellow = '#D7BA7D', + cyan = '#4EC9B0', + green = '#608B4E', + light_green = '#B5CEA8', + string_orange = '#CE9178', + orange = '#FF8800', + purple = '#C586C0', + magenta = '#D16D9E', + grey = '#858585', + blue = '#569CD6', + vivid_blue = '#4FC1FF', + light_blue = '#9CDCFE', + red = '#D16969', + error_red = '#F44747', + info_yellow = '#FFCC66' +} +local condition = require('galaxyline.condition') +local gls = gl.section +gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'} + +gls.left[1] = { + ViMode = { + provider = function() + -- auto change color according the vim mode + local mode_color = { + n = colors.blue, + i = colors.green, + v = colors.purple, + [''] = colors.purple, + V = colors.purple, + c = colors.magenta, + no = colors.blue, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.red, + Rv = colors.red, + cv = colors.blue, + ce = colors.blue, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.blue, + t = colors.blue + } + vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()]) + return '▊ ' + end, + highlight = {colors.red, colors.bg} + } +} +print(vim.fn.getbufvar(0, 'ts')) +vim.fn.getbufvar(0, 'ts') + +gls.left[2] = { + GitIcon = { + provider = function() + return ' ' + end, + condition = condition.check_git_workspace, + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.orange, colors.bg} + } +} + +gls.left[3] = { + GitBranch = { + provider = 'GitBranch', + condition = condition.check_git_workspace, + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.grey, colors.bg} + } +} + +gls.left[4] = { + DiffAdd = { + provider = 'DiffAdd', + condition = condition.hide_in_width, + icon = '  ', + highlight = {colors.green, colors.bg} + } +} +gls.left[5] = { + DiffModified = { + provider = 'DiffModified', + condition = condition.hide_in_width, + icon = ' 柳', + highlight = {colors.blue, colors.bg} + } +} +gls.left[6] = { + DiffRemove = { + provider = 'DiffRemove', + condition = condition.hide_in_width, + icon = '  ', + highlight = {colors.red, colors.bg} + } +} + +gls.right[1] = { + DiagnosticError = {provider = 'DiagnosticError', icon = '  ', highlight = {colors.error_red, colors.bg}} +} +gls.right[2] = {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', highlight = {colors.orange, colors.bg}}} + +gls.right[3] = { + DiagnosticHint = {provider = 'DiagnosticHint', icon = '  ', highlight = {colors.vivid_blue, colors.bg}} +} + +gls.right[4] = {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', highlight = {colors.info_yellow, colors.bg}}} + +gls.right[5] = { + ShowLspClient = { + provider = 'GetLspClient', + condition = function() + local tbl = {['dashboard'] = true, [' '] = true} + if tbl[vim.bo.filetype] then return false end + return true + end, + icon = ' ', + highlight = {colors.grey, colors.bg} + } +} + +gls.right[6] = { + LineInfo = { + provider = 'LineColumn', + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.grey, colors.bg} + } +} + +gls.right[7] = { + PerCent = { + provider = 'LinePercent', + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.grey, colors.bg} + } +} + +gls.right[8] = { + Tabstop = { + provider = function() + return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " " + end, + condition = condition.hide_in_width, + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.grey, colors.bg} + } +} + +gls.right[9] = { + BufferType = { + provider = 'FileTypeName', + condition = condition.hide_in_width, + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.grey, colors.bg} + } +} + +gls.right[10] = { + FileEncode = { + provider = 'FileEncode', + condition = condition.hide_in_width, + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.grey, colors.bg} + } +} + +gls.right[11] = { + Space = { + provider = function() + return ' ' + end, + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.orange, colors.bg} + } +} + +gls.short_line_left[1] = { + BufferType = { + provider = 'FileTypeName', + separator = ' ', + separator_highlight = {'NONE', colors.bg}, + highlight = {colors.grey, colors.bg} + } +} + +gls.short_line_left[2] = { + SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}} +} + +gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}} diff --git a/lua/lv-gitsigns/init.lua b/lua/lv-gitsigns/init.lua new file mode 100644 index 00000000..c19a5d00 --- /dev/null +++ b/lua/lv-gitsigns/init.lua @@ -0,0 +1,24 @@ +require('gitsigns').setup { + signs = { + -- TODO add hl to colorscheme + add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + }, + numhl = false, + linehl = false, + keymaps = { + -- Default keymap options + noremap = true, + buffer = true, + }, + watch_index = { + interval = 1000 + }, + sign_priority = 6, + update_debounce = 200, + status_formatter = nil, -- Use default + use_decoration_api = false +} diff --git a/lua/lv-globals.lua b/lua/lv-globals.lua new file mode 100644 index 00000000..a8fc6b21 --- /dev/null +++ b/lua/lv-globals.lua @@ -0,0 +1,66 @@ +O = { + auto_close_tree = 0, + auto_complete = true, + colorscheme = 'lunar', + hidden_files = true, + wrap_lines = false, + number = true, + relative_number = true, + shell = 'bash', + + -- @usage pass a table with your desired languages + treesitter = { + ensure_installed = "all", + ignore_install = {"haskell"}, + highlight = {enabled = true}, + playground = {enabled = true}, + rainbow = {enabled = false} + }, + + database = {save_location = '~/.config/nvcode_db', auto_execute = 1}, + python = { + linter = '', + -- @usage can be 'yapf', 'black' + formatter = '', + autoformat = false, + isort = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + dart = {sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot'}, + lua = { + -- @usage can be 'lua-format' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + sh = { + -- @usage can be 'shellcheck' + linter = '', + -- @usage can be 'shfmt' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + tsserver = { + -- @usage can be 'eslint' + linter = '', + -- @usage can be 'prettier' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + json = { + -- @usage can be 'prettier' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + tailwindls = {filetypes = {'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}}, + clang = {diagnostics = {virtual_text = true, signs = true, underline = true}} + -- css = {formatter = '', autoformat = false, virtual_text = true}, + -- json = {formatter = '', autoformat = false, virtual_text = true} +} + +DATA_PATH = vim.fn.stdpath('data') +CACHE_PATH = vim.fn.stdpath('cache') + diff --git a/lua/lv-lspinstall/init.lua b/lua/lv-lspinstall/init.lua new file mode 100644 index 00000000..2b6e0edb --- /dev/null +++ b/lua/lv-lspinstall/init.lua @@ -0,0 +1,18 @@ +-- 1. get the config for this server from nvim-lspconfig and adjust the cmd path. +-- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us! +local config = require'lspconfig'.jdtls.document_config +require'lspconfig/configs'.jdtls = nil -- important, unset the loaded config again +-- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server" + +-- 2. extend the config with an install_script and (optionally) uninstall_script +require'lspinstall/servers'.jdtls = vim.tbl_extend('error', config, { + -- lspinstall will automatically create/delete the install directory for every server + install_script = [[ + git clone https://github.com/eclipse/eclipse.jdt.ls.git + cd eclipse.jdt.ls + ./mvnw clean verify + ]], + uninstall_script = nil -- can be omitted +}) + +require'lspinstall'.setup() diff --git a/lua/lv-lspkind/init.lua b/lua/lv-lspkind/init.lua new file mode 100644 index 00000000..e3c590fc --- /dev/null +++ b/lua/lv-lspkind/init.lua @@ -0,0 +1,26 @@ +-- symbols for autocomplete +require('lspkind').init({ + with_text = false, + symbol_map = { + Text = '  ', + Method = '  ', + Function = '  ', + Constructor = '  ', + Variable = '[]', + Class = '  ', + Interface = ' 蘒', + Module = '  ', + Property = '  ', + Unit = ' 塞 ', + Value = '  ', + Enum = ' 練', + Keyword = '  ', + Snippet = '  ', + Color = '', + File = '', + Folder = ' ﱮ ', + EnumMember = '  ', + Constant = '  ', + Struct = '  ' + }, +}) diff --git a/lua/lv-nvim-dap/init.lua b/lua/lv-nvim-dap/init.lua new file mode 100644 index 00000000..e69de29b diff --git a/lua/lv-nvimtree/init.lua b/lua/lv-nvimtree/init.lua new file mode 100644 index 00000000..3d2f7ad7 --- /dev/null +++ b/lua/lv-nvimtree/init.lua @@ -0,0 +1,65 @@ +--[[ " +--let g:nvim_tree_auto_ignore_ft = 'startify' "empty by default, don't auto open tree on specific filetypes. +let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.` +let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). +" let g:nvim_tree_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open +" let g:nvim_tree_width_allow_resize = 1 "0 by default, will not resize the tree when opening a file +let g:nvim_tree_show_icons = { + \ 'git': 1, + \ 'folders': 1, + \ 'files': 1, + \ } + +"If 0, do not show the icons for one of 'git' 'folder' and 'files' +"1 by default, notice that if 'files' is 1, it will only display +"if nvim-web-devicons is installed and on your runtimepath ]] -- vim.g.nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default +vim.g.nvim_tree_disable_netrw = 0 -- "1 by default, disables netrw +-- vim.g.nvim_tree_hijack_netrw = 0 --"1 by default, prevents netrw from automatically opening when opening directories (but lets you keep its other utilities) +vim.g.nvim_tree_hide_dotfiles = 1 -- 0 by default, this option hides files and folders starting with a dot `.` +vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent markers when folders are open +vim.g.nvim_tree_follow = 1 -- "0 by default, this option allows the cursor to be updated when entering a buffer +vim.g.nvim_tree_auto_close = O.auto_close_tree -- 0 by default, closes the tree when it's the last window +vim.g.nvim_tree_auto_ignore_ft = 'startify' --empty by default, don't auto open tree on specific filetypes. +local tree_cb = require'nvim-tree.config'.nvim_tree_callback + vim.g.nvim_tree_bindings = { + -- [""] = ":YourVimFunction()", + -- ["u"] = ":lua require'some_module'.some_function()", + + -- default mappings + [""] = tree_cb("edit"), + ["o"] = tree_cb("edit"), + ["l"] = tree_cb("edit"), + ["<2-LeftMouse>"] = tree_cb("edit"), + ["<2-RightMouse>"] = tree_cb("cd"), + [""] = tree_cb("cd"), + [""] = tree_cb("vsplit"), + [""] = tree_cb("split"), + [""] = tree_cb("tabnew"), + ["<"] = tree_cb("prev_sibling"), + [">"] = tree_cb("next_sibling"), + [""] = tree_cb("close_node"), + -- ["h"] = tree_cb("close_node"), + [""] = tree_cb("close_node"), + [""] = tree_cb("preview"), + ["I"] = tree_cb("toggle_ignored"), + ["H"] = tree_cb("toggle_dotfiles"), + ["R"] = tree_cb("refresh"), + ["a"] = tree_cb("create"), + ["d"] = tree_cb("remove"), + ["r"] = tree_cb("rename"), + [""] = tree_cb("full_rename"), + ["x"] = tree_cb("cut"), + ["c"] = tree_cb("copy"), + ["p"] = tree_cb("paste"), + ["[c"] = tree_cb("prev_git_item"), + ["]c"] = tree_cb("next_git_item"), + ["-"] = tree_cb("dir_up"), + ["q"] = tree_cb("close"), + } +-- vim.g.nvim_tree_show_icons = {git = 1, folders = 1, files = 1} +vim.g.nvim_tree_icons = { + default = '', + symlink = '', + git = {unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = ""}, + folder = {default = "", open = "", empty = "", empty_open = "", symlink = ""} +} diff --git a/lua/lv-rnvimr/init.lua b/lua/lv-rnvimr/init.lua new file mode 100644 index 00000000..f84bde9a --- /dev/null +++ b/lua/lv-rnvimr/init.lua @@ -0,0 +1,6 @@ +-- Make Ranger replace netrw and be the file explorer +vim.g.rnvimr_ex_enable = 1 +vim.g.rnvimr_draw_border = 1 +vim.g.rnvimr_pick_enable = 1 +vim.g.rnvimr_bw_enable = 1 +vim.api.nvim_set_keymap('n', '-', ':RnvimrToggle', {noremap = true, silent = true}) diff --git a/lua/lv-telescope/init.lua b/lua/lv-telescope/init.lua new file mode 100644 index 00000000..0e561f51 --- /dev/null +++ b/lua/lv-telescope/init.lua @@ -0,0 +1,64 @@ +local actions = require('telescope.actions') +-- Global remapping +------------------------------ +-- '--color=never', +require('telescope').setup { + defaults = { + find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'}, + prompt_position = "top", + prompt_prefix = " ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "descending", + layout_strategy = "horizontal", + layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}}, + file_sorter = require'telescope.sorters'.get_fuzzy_file, + file_ignore_patterns = {}, + generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, + shorten_path = true, + winblend = 0, + width = 0.75, + preview_cutoff = 120, + results_height = 1, + results_width = 0.8, + border = {}, + borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, + color_devicons = true, + use_less = true, + set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, + file_previewer = require'telescope.previewers'.vim_buffer_cat.new, + grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, + qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, + + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.smart_send_to_qflist + actions.open_qflist, + -- To disable a keymap, put [map] = false + -- So, to not map "", just put + -- [""] = false, + [""] = actions.close, + + -- Otherwise, just set the mapping to the function that you want it to be. + -- [""] = actions.select_horizontal, + + -- Add up multiple actions + [""] = actions.select_default + actions.center + + -- You can perform as many actions in a row as you like + -- [""] = actions.select_default + actions.center + my_cool_custom_action, + }, + n = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.smart_send_to_qflist + actions.open_qflist, + -- [""] = my_cool_custom_action, + } + } + } +} diff --git a/lua/lv-treesitter/init.lua b/lua/lv-treesitter/init.lua new file mode 100644 index 00000000..02a9a826 --- /dev/null +++ b/lua/lv-treesitter/init.lua @@ -0,0 +1,12 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages + ignore_install = O.treesitter.ignore_install, + highlight = { + enable = O.treesitter.highlight.enabled -- false will disable the whole extension + }, + -- indent = {enable = true, disable = {"python", "html", "javascript"}}, + -- TODO seems to be broken + indent = {enable = {"javascriptreact"}}, + autotag = {enable = true}, +} + diff --git a/lua/lv-utils/init.lua b/lua/lv-utils/init.lua new file mode 100644 index 00000000..c177cb09 --- /dev/null +++ b/lua/lv-utils/init.lua @@ -0,0 +1,190 @@ +local nv_utils = {} + +function nv_utils.define_augroups(definitions) -- {{{1 + -- Create autocommand groups based on the passed definitions + -- + -- The key will be the name of the group, and each definition + -- within the group should have: + -- 1. Trigger + -- 2. Pattern + -- 3. Text + -- just like how they would normally be defined from Vim itself + for group_name, definition in pairs(definitions) do + vim.cmd('augroup ' .. group_name) + vim.cmd('autocmd!') + + for _, def in pairs(definition) do + local command = table.concat(vim.tbl_flatten {'autocmd', def}, ' ') + vim.cmd(command) + end + + vim.cmd('augroup END') + end +end + +-- lsp + +function nv_utils.add_to_workspace_folder() + vim.lsp.buf.add_workspace_folder() +end + +function nv_utils.clear_references() + vim.lsp.buf.clear_references() +end + +function nv_utils.code_action() + vim.lsp.buf.code_action() +end + +function nv_utils.declaration() + vim.lsp.buf.declaration() + vim.lsp.buf.clear_references() +end + +function nv_utils.definition() + vim.lsp.buf.definition() + vim.lsp.buf.clear_references() +end + +function nv_utils.document_highlight() + vim.lsp.buf.document_highlight() +end + +function nv_utils.document_symbol() + vim.lsp.buf.document_symbol() +end + +function nv_utils.formatting() + vim.lsp.buf.formatting() +end + +function nv_utils.formatting_sync() + vim.lsp.buf.formatting_sync() +end + +function nv_utils.hover() + vim.lsp.buf.hover() +end + +function nv_utils.implementation() + vim.lsp.buf.implementation() +end + +function nv_utils.incoming_calls() + vim.lsp.buf.incoming_calls() +end + +function nv_utils.list_workspace_folders() + vim.lsp.buf.list_workspace_folders() +end + +function nv_utils.outgoing_calls() + vim.lsp.buf.outgoing_calls() +end + +function nv_utils.range_code_action() + vim.lsp.buf.range_code_action() +end + +function nv_utils.range_formatting() + vim.lsp.buf.range_formatting() +end + +function nv_utils.references() + vim.lsp.buf.references() + vim.lsp.buf.clear_references() +end + +function nv_utils.remove_workspace_folder() + vim.lsp.buf.remove_workspace_folder() +end + +function nv_utils.rename() + vim.lsp.buf.rename() +end + +function nv_utils.signature_help() + vim.lsp.buf.signature_help() +end + +function nv_utils.type_definition() + vim.lsp.buf.type_definition() +end + +function nv_utils.workspace_symbol() + vim.lsp.buf.workspace_symbol() +end + +-- diagnostic + +function nv_utils.get_all() + vim.lsp.diagnostic.get_all() +end + +function nv_utils.get_next() + vim.lsp.diagnostic.get_next() +end + +function nv_utils.get_prev() + vim.lsp.diagnostic.get_prev() +end + +function nv_utils.goto_next() + vim.lsp.diagnostic.goto_next() +end + +function nv_utils.goto_prev() + vim.lsp.diagnostic.goto_prev() +end + +function nv_utils.show_line_diagnostics() + vim.lsp.diagnostic.show_line_diagnostics() +end + +-- git signs + +function nv_utils.next_hunk() + require('gitsigns').next_hunk() +end + +function nv_utils.prev_hunk() + require('gitsigns').prev_hunk() +end + +function nv_utils.stage_hunk() + require('gitsigns').stage_hunk() +end + +function nv_utils.undo_stage_hunk() + require('gitsigns').undo_stage_hunk() +end + +function nv_utils.reset_hunk() + require('gitsigns').reset_hunk() +end + +function nv_utils.reset_buffer() + require('gitsigns').reset_buffer() +end + +function nv_utils.preview_hunk() + require('gitsigns').preview_hunk() +end + +function nv_utils.blame_line() + require('gitsigns').blame_line() +end + +-- misc +function nv_utils.file_exists(name) + local f = io.open(name, "r") + if f ~= nil then + io.close(f) + return true + else + return false + end +end + +return nv_utils + diff --git a/lua/nv-autocommands/init.lua b/lua/nv-autocommands/init.lua deleted file mode 100644 index ff2cbf50..00000000 --- a/lua/nv-autocommands/init.lua +++ /dev/null @@ -1,58 +0,0 @@ -local utils = require('nv-utils') - -local auto_formatters = { } - -local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end - -local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.tsserver.autoformat then - table.insert(auto_formatters, javascript_autoformat) - table.insert(auto_formatters, javascriptreact_autoformat) -end - -local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.lua.autoformat then table.insert(auto_formatters, lua_format) end - -local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.json.autoformat then table.insert(auto_formatters, json_format) end - -utils.define_augroups({ - _general_settings = { - {'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'}, - {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, - {'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, - {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, - {'VimLeavePre', '*', 'set title set titleold='}, - - -- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'}, - -- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'}, - }, - _java = { - {'FileType', 'java', 'luafile ~/.config/nvim/lua/lsp/java-ls.lua'}, - {'FileType', 'java', 'nnoremap ca lua require(\'jdtls\').code_action()'} - }, - _dashboard = { - -- seems to be nobuflisted that makes my stuff disapear will do more testing - { - 'FileType', 'dashboard', - 'setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ' - }, {'FileType', 'dashboard', 'set showtabline=0 | autocmd BufLeave set showtabline=2'} - }, - _markdown = {{'FileType', 'markdown', 'setlocal wrap'}, {'FileType', 'markdown', 'setlocal spell'}}, - _solidity = { - {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'}, - {'BufNewFile', '*.sol', 'setlocal filetype=solidity'} - }, - _gemini = { - {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'}, - {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'} - }, - _buffer_bindings = { - {'FileType', 'dashboard', 'nnoremap q :q'}, - {'FileType', 'lspinfo', 'nnoremap q :q'}, - {'FileType', 'floaterm', 'nnoremap q :q'}, - }, - _auto_formatters = auto_formatters -}) diff --git a/lua/nv-autopairs/init.lua b/lua/nv-autopairs/init.lua deleted file mode 100644 index 5d0adf85..00000000 --- a/lua/nv-autopairs/init.lua +++ /dev/null @@ -1,77 +0,0 @@ -require('nvim-autopairs').setup() -local npairs = require('nvim-autopairs') - -local function imap(lhs, rhs, opts) - local options = {noremap = false} - if opts then options = vim.tbl_extend('force', options, opts) end - vim.api.nvim_set_keymap('i', lhs, rhs, options) -end - -_G.MUtils = {} - --- TEST -vim.g.completion_confirm_key = "" -MUtils.completion_confirm = function() - if vim.fn.pumvisible() ~= 0 then - if vim.fn.complete_info()["selected"] ~= -1 then - vim.fn["compe#confirm"]() - -- return npairs.esc("") - return npairs.esc("") - else - vim.defer_fn(function() - vim.fn["compe#confirm"]("") - end, 20) - return npairs.esc("") - end - else - return npairs.check_break_line_char() - end -end --- TEST - -MUtils.completion_confirm = function() - if vim.fn.pumvisible() ~= 0 then - if vim.fn.complete_info()["selected"] ~= -1 then - vim.fn["compe#confirm"]() - return npairs.esc("") - else - vim.api.nvim_select_popupmenu_item(0, false, false, {}) - vim.fn["compe#confirm"]() - return npairs.esc("") - end - else - return npairs.check_break_line_char() - end -end - -MUtils.tab = function() - if vim.fn.pumvisible() ~= 0 then - return npairs.esc("") - else - if vim.fn["vsnip#available"](1) ~= 0 then - vim.fn.feedkeys(string.format('%c%c%c(vsnip-expand-or-jump)', 0x80, 253, 83)) - return npairs.esc("") - else - return npairs.esc("") - end - end -end - -MUtils.s_tab = function() - if vim.fn.pumvisible() ~= 0 then - return npairs.esc("") - else - if vim.fn["vsnip#jumpable"](-1) ~= 0 then - vim.fn.feedkeys(string.format('%c%c%c(vsnip-jump-prev)', 0x80, 253, 83)) - return npairs.esc("") - else - return npairs.esc("") - end - end -end - --- Autocompletion and snippets -vim.api.nvim_set_keymap('i', '', 'v:lua.MUtils.completion_confirm()', {expr = true, noremap = true}) --- imap("", "v:lua.MUtils.completion_confirm()", {expr = true, noremap = true}) -imap("", "v:lua.MUtils.tab()", {expr = true, noremap = true}) -imap("", "v:lua.MUtils.s_tab()", {expr = true, noremap = true}) diff --git a/lua/nv-barbar/init.lua b/lua/nv-barbar/init.lua deleted file mode 100644 index 49c1206b..00000000 --- a/lua/nv-barbar/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.api.nvim_set_keymap('n', '', ':BufferNext', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '', ':BufferPrevious', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '', ':BufferClose', { noremap = true, silent = true }) diff --git a/lua/nv-bookmark/init.lua b/lua/nv-bookmark/init.lua deleted file mode 100644 index 1f729bc8..00000000 --- a/lua/nv-bookmark/init.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.g.bookmark_no_default_key_mappings = 1 -vim.g.bookmark_sign = '' diff --git a/lua/nv-colorizer/init.lua b/lua/nv-colorizer/init.lua deleted file mode 100644 index a3a7aaed..00000000 --- a/lua/nv-colorizer/init.lua +++ /dev/null @@ -1,12 +0,0 @@ -require'colorizer'.setup( - {'*';}, - { - RGB = true; -- #RGB hex codes - RRGGBB = true; -- #RRGGBB hex codes - RRGGBBAA = true; -- #RRGGBBAA hex codes - rgb_fn = true; -- CSS rgb() and rgba() functions - hsl_fn = true; -- CSS hsl() and hsla() functions - css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn - }) - -- names = true; -- "Name" codes like Blue diff --git a/lua/nv-comment/init.lua b/lua/nv-comment/init.lua deleted file mode 100644 index df794386..00000000 --- a/lua/nv-comment/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -require('nvim_comment').setup() -vim.api.nvim_set_keymap("n", "/", ":CommentToggle", {noremap=true, silent = true}) -vim.api.nvim_set_keymap("v", "/", ":CommentToggle", {noremap=true, silent = true}) diff --git a/lua/nv-compe/init.lua b/lua/nv-compe/init.lua deleted file mode 100644 index 61270960..00000000 --- a/lua/nv-compe/init.lua +++ /dev/null @@ -1,102 +0,0 @@ -vim.o.completeopt = "menuone,noselect" - -require'compe'.setup { - enabled = O.auto_complete, - autocomplete = true, - debug = false, - min_length = 1, - preselect = 'enable', - throttle_time = 80, - source_timeout = 200, - incomplete_delay = 400, - max_abbr_width = 100, - max_kind_width = 100, - max_menu_width = 100, - documentation = true, - - source = { - path = {kind = "  "}, - buffer = {kind = "  "}, - calc = {kind = "  "}, - vsnip = {kind = "  "}, - nvim_lsp = {kind = "  "}, - -- nvim_lua = {kind = "  "}, - nvim_lua = false, - spell = {kind = "  "}, - tags = false, - vim_dadbod_completion = true, - -- snippets_nvim = {kind = "  "}, - -- ultisnips = {kind = "  "}, - -- treesitter = {kind = "  "}, - emoji = {kind = " ﲃ ", filetypes={"markdown", "text"}} - -- for emoji press : (idk if that in compe tho) - } -} - ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  --- ﬘ ---  ---  ---  --- m ---  ---  ---  ---  - -local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end - -local check_back_space = function() - local col = vim.fn.col('.') - 1 - if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then - return true - else - return false - end -end - --- Use (s-)tab to: ---- move to prev/next item in completion menuone ---- jump to prev/next snippet's placeholder -_G.tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "" - elseif vim.fn.call("vsnip#available", {1}) == 1 then - return t "(vsnip-expand-or-jump)" - elseif check_back_space() then - return t "" - else - return vim.fn['compe#complete']() - end -end -_G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "" - elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then - return t "(vsnip-jump-prev)" - else - return t "" - end -end - -vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) diff --git a/lua/nv-dadbod/init.lua b/lua/nv-dadbod/init.lua deleted file mode 100644 index f5de451a..00000000 --- a/lua/nv-dadbod/init.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.api.nvim_set_keymap("n", "Du", ":DBUIToggle", {noremap=true, silent = true}) -vim.api.nvim_set_keymap("n", "Df", ":DBUIFindBuffer", {noremap=true, silent = true}) -vim.api.nvim_set_keymap("n", "Dr", ":DBUIRenameBuffer", {noremap=true, silent = true}) -vim.api.nvim_set_keymap("n", "Dl", ":DBUILastQueryInfo", {noremap=true, silent = true}) -vim.g.db_ui_save_location = O.database.save_location -vim.g.db_ui_auto_execute_table_helpers = O.database.auto_execute \ No newline at end of file diff --git a/lua/nv-dashboard/init.lua b/lua/nv-dashboard/init.lua deleted file mode 100644 index 9ef9b2d6..00000000 --- a/lua/nv-dashboard/init.lua +++ /dev/null @@ -1,33 +0,0 @@ -vim.g.dashboard_custom_header = { - '███╗ ██╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗', - '████╗ ██║██║ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝', - '██╔██╗ ██║██║ ██║██║ ██║ ██║██║ ██║█████╗', - '██║╚██╗██║╚██╗ ██╔╝██║ ██║ ██║██║ ██║██╔══╝', - '██║ ╚████║ ╚████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗', - '╚═╝ ╚═══╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝' -} - -vim.g.dashboard_default_executive = 'telescope' - -vim.g.dashboard_custom_section = { - a = {description = {' Find File '}, command = 'Telescope find_files'}, - b = {description = {' Recently Used Files'}, command = 'Telescope oldfiles'}, - c = {description = {' Load Last Session '}, command = 'SessionLoad'}, - d = {description = {' Find Word '}, command = 'Telescope live_grep'}, - e = {description = {' Settings '}, command = ':e ~/.config/nvim/nv-settings.lua'} - -- e = {description = {' Marks '}, command = 'Telescope marks'} -} - --- file_browser = {description = {' File Browser'}, command = 'Telescope find_files'}, - --- vim.g.dashboard_custom_shortcut = { --- a = 'f', --- find_word = 'SPC f a', --- last_session = 'SPC s l', --- new_file = 'SPC c n', --- book_marks = 'SPC f b' --- } --- find_history = 'SPC f h', - --- vim.g.dashboard_session_directory = '~/.cache/nvim/session' -vim.g.dashboard_custom_footer = {'chrisatmachine.com'} diff --git a/lua/nv-dependency/init.lua b/lua/nv-dependency/init.lua deleted file mode 100644 index fc056d55..00000000 --- a/lua/nv-dependency/init.lua +++ /dev/null @@ -1 +0,0 @@ -require('dependency_assist').setup() \ No newline at end of file diff --git a/lua/nv-dial/init.lua b/lua/nv-dial/init.lua deleted file mode 100644 index a743303f..00000000 --- a/lua/nv-dial/init.lua +++ /dev/null @@ -1,15 +0,0 @@ -local dial = require("dial") - -dial.augends["custom#boolean"] = dial.common.enum_cyclic{ - name = "boolean", - strlist = {"true", "false"}, -} -table.insert(dial.config.searchlist.normal, "custom#boolean") -vim.cmd([[ -nmap (dial-increment) -nmap (dial-decrement) -vmap (dial-increment) -vmap (dial-decrement) -vmap g (dial-increment-additional) -vmap g (dial-decrement-additional) - ]]) diff --git a/lua/nv-doge/init.lua b/lua/nv-doge/init.lua deleted file mode 100644 index 31746795..00000000 --- a/lua/nv-doge/init.lua +++ /dev/null @@ -1 +0,0 @@ -vim.g.doge_mapping = '*' \ No newline at end of file diff --git a/lua/nv-emmet/init.lua b/lua/nv-emmet/init.lua deleted file mode 100644 index 445a33f7..00000000 --- a/lua/nv-emmet/init.lua +++ /dev/null @@ -1,19 +0,0 @@ --- After you have what you want press C-Y and , at the same time --- autocmd FileType html,css EmmetInstall --- vim.g.user_emmet_leader_key='' -vim.g.user_emmet_mode='inv' -vim.g.user_emmet_expandabbr_key = ',' -vim.g.user_emmet_expandword_key = ';' -vim.g.user_emmet_update_tag = 'u' -vim.g.user_emmet_balancetaginward_key = 'd' -vim.g.user_emmet_balancetagoutward_key = 'D' -vim.g.user_emmet_next_key = 'n' -vim.g.user_emmet_prev_key = 'N' -vim.g.user_emmet_imagesize_key = 'i' -vim.g.user_emmet_togglecomment_key = '/' -vim.g.user_emmet_splitjointag_key = 'j' -vim.g.user_emmet_removetag_key = 'k' -vim.g.user_emmet_anchorizeurl_key = 'a' -vim.g.user_emmet_anchorizesummary_key = 'A' -vim.g.user_emmet_mergelines_key = 'm' -vim.g.user_emmet_codepretty_key = 'c' diff --git a/lua/nv-floaterm/init.lua b/lua/nv-floaterm/init.lua deleted file mode 100644 index b8ecbd40..00000000 --- a/lua/nv-floaterm/init.lua +++ /dev/null @@ -1,14 +0,0 @@ --- Floaterm -vim.g.floaterm_keymap_toggle = '' -vim.g.floaterm_keymap_next = '' -vim.g.floaterm_keymap_prev = '' -vim.g.floaterm_keymap_new = '' -vim.g.floaterm_title='' - -vim.g.floaterm_gitcommit='floaterm' -vim.g.floaterm_shell=O.shell -vim.g.floaterm_autoinsert=1 -vim.g.floaterm_width=0.8 -vim.g.floaterm_height=0.8 -vim.g.floaterm_wintitle=0 -vim.g.floaterm_autoclose=1 diff --git a/lua/nv-galaxyline/init.lua b/lua/nv-galaxyline/init.lua deleted file mode 100644 index f9ac859b..00000000 --- a/lua/nv-galaxyline/init.lua +++ /dev/null @@ -1,208 +0,0 @@ -local gl = require('galaxyline') --- get my theme in galaxyline repo --- local colors = require('galaxyline.theme').default -local colors = { - -- bg = '#2E2E2E', - bg = '#292D38', - yellow = '#DCDCAA', - dark_yellow = '#D7BA7D', - cyan = '#4EC9B0', - green = '#608B4E', - light_green = '#B5CEA8', - string_orange = '#CE9178', - orange = '#FF8800', - purple = '#C586C0', - magenta = '#D16D9E', - grey = '#858585', - blue = '#569CD6', - vivid_blue = '#4FC1FF', - light_blue = '#9CDCFE', - red = '#D16969', - error_red = '#F44747', - info_yellow = '#FFCC66' -} -local condition = require('galaxyline.condition') -local gls = gl.section -gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'} - -gls.left[1] = { - ViMode = { - provider = function() - -- auto change color according the vim mode - local mode_color = { - n = colors.blue, - i = colors.green, - v = colors.purple, - [''] = colors.purple, - V = colors.purple, - c = colors.magenta, - no = colors.blue, - s = colors.orange, - S = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - R = colors.red, - Rv = colors.red, - cv = colors.blue, - ce = colors.blue, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.blue, - t = colors.blue - } - vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()]) - return '▊ ' - end, - highlight = {colors.red, colors.bg} - } -} -print(vim.fn.getbufvar(0, 'ts')) -vim.fn.getbufvar(0, 'ts') - -gls.left[2] = { - GitIcon = { - provider = function() - return ' ' - end, - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.orange, colors.bg} - } -} - -gls.left[3] = { - GitBranch = { - provider = 'GitBranch', - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.left[4] = { - DiffAdd = { - provider = 'DiffAdd', - condition = condition.hide_in_width, - icon = '  ', - highlight = {colors.green, colors.bg} - } -} -gls.left[5] = { - DiffModified = { - provider = 'DiffModified', - condition = condition.hide_in_width, - icon = ' 柳', - highlight = {colors.blue, colors.bg} - } -} -gls.left[6] = { - DiffRemove = { - provider = 'DiffRemove', - condition = condition.hide_in_width, - icon = '  ', - highlight = {colors.red, colors.bg} - } -} - -gls.right[1] = { - DiagnosticError = {provider = 'DiagnosticError', icon = '  ', highlight = {colors.error_red, colors.bg}} -} -gls.right[2] = {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = '  ', highlight = {colors.orange, colors.bg}}} - -gls.right[3] = { - DiagnosticHint = {provider = 'DiagnosticHint', icon = '  ', highlight = {colors.vivid_blue, colors.bg}} -} - -gls.right[4] = {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = '  ', highlight = {colors.info_yellow, colors.bg}}} - -gls.right[5] = { - ShowLspClient = { - provider = 'GetLspClient', - condition = function() - local tbl = {['dashboard'] = true, [' '] = true} - if tbl[vim.bo.filetype] then return false end - return true - end, - icon = ' ', - highlight = {colors.grey, colors.bg} - } -} - -gls.right[6] = { - LineInfo = { - provider = 'LineColumn', - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[7] = { - PerCent = { - provider = 'LinePercent', - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[8] = { - Tabstop = { - provider = function() - return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " " - end, - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[9] = { - BufferType = { - provider = 'FileTypeName', - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[10] = { - FileEncode = { - provider = 'FileEncode', - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[11] = { - Space = { - provider = function() - return ' ' - end, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.orange, colors.bg} - } -} - -gls.short_line_left[1] = { - BufferType = { - provider = 'FileTypeName', - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.short_line_left[2] = { - SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}} -} - -gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}} diff --git a/lua/nv-gitblame/init.lua b/lua/nv-gitblame/init.lua deleted file mode 100644 index 12645a7f..00000000 --- a/lua/nv-gitblame/init.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.cmd('highlight default link gitblame SpecialComment') -vim.g.gitblame_enabled = 0 diff --git a/lua/nv-gitsigns/init.lua b/lua/nv-gitsigns/init.lua deleted file mode 100644 index c19a5d00..00000000 --- a/lua/nv-gitsigns/init.lua +++ /dev/null @@ -1,24 +0,0 @@ -require('gitsigns').setup { - signs = { - -- TODO add hl to colorscheme - add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - }, - numhl = false, - linehl = false, - keymaps = { - -- Default keymap options - noremap = true, - buffer = true, - }, - watch_index = { - interval = 1000 - }, - sign_priority = 6, - update_debounce = 200, - status_formatter = nil, -- Use default - use_decoration_api = false -} diff --git a/lua/nv-globals.lua b/lua/nv-globals.lua deleted file mode 100644 index bae0e9db..00000000 --- a/lua/nv-globals.lua +++ /dev/null @@ -1,66 +0,0 @@ -O = { - auto_close_tree = 0, - auto_complete = true, - colorscheme = 'nvcode', - hidden_files = true, - wrap_lines = false, - number = true, - relative_number = true, - shell = 'bash', - - -- @usage pass a table with your desired languages - treesitter = { - ensure_installed = "all", - ignore_install = {"haskell"}, - highlight = {enabled = true}, - playground = {enabled = true}, - rainbow = {enabled = false} - }, - - database = {save_location = '~/.config/nvcode_db', auto_execute = 1}, - python = { - linter = '', - -- @usage can be 'yapf', 'black' - formatter = '', - autoformat = false, - isort = false, - diagnostics = {virtual_text = true, signs = true, underline = true} - }, - dart = {sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot'}, - lua = { - -- @usage can be 'lua-format' - formatter = '', - autoformat = false, - diagnostics = {virtual_text = true, signs = true, underline = true} - }, - sh = { - -- @usage can be 'shellcheck' - linter = '', - -- @usage can be 'shfmt' - formatter = '', - autoformat = false, - diagnostics = {virtual_text = true, signs = true, underline = true} - }, - tsserver = { - -- @usage can be 'eslint' - linter = '', - -- @usage can be 'prettier' - formatter = '', - autoformat = false, - diagnostics = {virtual_text = true, signs = true, underline = true} - }, - json = { - -- @usage can be 'prettier' - formatter = '', - autoformat = false, - diagnostics = {virtual_text = true, signs = true, underline = true} - }, - tailwindls = {filetypes = {'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}}, - clang = {diagnostics = {virtual_text = true, signs = true, underline = true}} - -- css = {formatter = '', autoformat = false, virtual_text = true}, - -- json = {formatter = '', autoformat = false, virtual_text = true} -} - -DATA_PATH = vim.fn.stdpath('data') -CACHE_PATH = vim.fn.stdpath('cache') - diff --git a/lua/nv-hop/init.lua b/lua/nv-hop/init.lua deleted file mode 100644 index cd71293b..00000000 --- a/lua/nv-hop/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.api.nvim_set_keymap('n', 's', ":HopChar2", {silent = true}) -vim.api.nvim_set_keymap('n', 'S', ":HopWord", {silent = true}) - diff --git a/lua/nv-indentline/init.lua b/lua/nv-indentline/init.lua deleted file mode 100644 index 8ec677b4..00000000 --- a/lua/nv-indentline/init.lua +++ /dev/null @@ -1,11 +0,0 @@ -vim.g.indent_blankline_buftype_exclude = {'terminal'} -vim.g.indent_blankline_filetype_exclude = {'man', 'help', 'startify', 'dashboard', 'packer', 'neogitstatus', 'markdown'} -vim.g.indent_blankline_char = '▏' --- vim.g.indent_blankline_use_treesitter = true -vim.g.indent_blankline_show_trailing_blankline_indent = false -vim.g.indent_blankline_show_current_context = true -vim.g.indent_blankline_context_patterns = { - 'class', 'return', 'function', 'method', '^if', '^while', 'jsx_element', '^for', '^object', '^table', 'block', - 'arguments', 'if_statement', 'else_clause', 'jsx_element', 'jsx_self_closing_element', 'try_statement', - 'catch_clause', 'import_statement', 'operation_type' -} diff --git a/lua/nv-lightbulb/init.lua b/lua/nv-lightbulb/init.lua deleted file mode 100644 index 02b21184..00000000 --- a/lua/nv-lightbulb/init.lua +++ /dev/null @@ -1,34 +0,0 @@ --- Showing defaults -require'nvim-lightbulb'.update_lightbulb { - sign = { - enabled = true, - -- Priority of the gutter sign - priority = 10, - text = "💡", - }, - float = { - enabled = false, - -- Text to show in the popup float - text = "💡", - -- Available keys for window options: - -- - height of floating window - -- - width of floating window - -- - wrap_at character to wrap at for computing height - -- - max_width maximal width of floating window - -- - max_height maximal height of floating window - -- - pad_left number of columns to pad contents at left - -- - pad_right number of columns to pad contents at right - -- - pad_top number of lines to pad contents at top - -- - pad_bottom number of lines to pad contents at bottom - -- - offset_x x-axis offset of the floating window - -- - offset_y y-axis offset of the floating window - -- - anchor corner of float to place at the cursor (NW, NE, SW, SE) - -- - winblend transparency of the window (0-100) - win_opts = {}, - }, - virtual_text = { - enabled = false, - -- Text to show at virtual text - text = "💡", - } -} diff --git a/lua/nv-lspinstall/init.lua b/lua/nv-lspinstall/init.lua deleted file mode 100644 index 2b6e0edb..00000000 --- a/lua/nv-lspinstall/init.lua +++ /dev/null @@ -1,18 +0,0 @@ --- 1. get the config for this server from nvim-lspconfig and adjust the cmd path. --- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us! -local config = require'lspconfig'.jdtls.document_config -require'lspconfig/configs'.jdtls = nil -- important, unset the loaded config again --- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server" - --- 2. extend the config with an install_script and (optionally) uninstall_script -require'lspinstall/servers'.jdtls = vim.tbl_extend('error', config, { - -- lspinstall will automatically create/delete the install directory for every server - install_script = [[ - git clone https://github.com/eclipse/eclipse.jdt.ls.git - cd eclipse.jdt.ls - ./mvnw clean verify - ]], - uninstall_script = nil -- can be omitted -}) - -require'lspinstall'.setup() diff --git a/lua/nv-lspkind/init.lua b/lua/nv-lspkind/init.lua deleted file mode 100644 index e3c590fc..00000000 --- a/lua/nv-lspkind/init.lua +++ /dev/null @@ -1,26 +0,0 @@ --- symbols for autocomplete -require('lspkind').init({ - with_text = false, - symbol_map = { - Text = '  ', - Method = '  ', - Function = '  ', - Constructor = '  ', - Variable = '[]', - Class = '  ', - Interface = ' 蘒', - Module = '  ', - Property = '  ', - Unit = ' 塞 ', - Value = '  ', - Enum = ' 練', - Keyword = '  ', - Snippet = '  ', - Color = '', - File = '', - Folder = ' ﱮ ', - EnumMember = '  ', - Constant = '  ', - Struct = '  ' - }, -}) diff --git a/lua/nv-matchup/init.lua b/lua/nv-matchup/init.lua deleted file mode 100644 index 44949085..00000000 --- a/lua/nv-matchup/init.lua +++ /dev/null @@ -1 +0,0 @@ -vim.g.matchup_matchparen_offscreen = {} diff --git a/lua/nv-numb/init.lua b/lua/nv-numb/init.lua deleted file mode 100644 index 415327f1..00000000 --- a/lua/nv-numb/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -require('numb').setup{ - show_numbers = true, -- Enable 'number' for the window while peeking - show_cursorline = true -- Enable 'cursorline' for the window while peeking -} diff --git a/lua/nv-nvim-dap/init.lua b/lua/nv-nvim-dap/init.lua deleted file mode 100644 index e69de29b..00000000 diff --git a/lua/nv-nvim-peekup/init.lua b/lua/nv-nvim-peekup/init.lua deleted file mode 100644 index a6ff62b7..00000000 --- a/lua/nv-nvim-peekup/init.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.g.peekup_open = '""' - diff --git a/lua/nv-nvimtree/init.lua b/lua/nv-nvimtree/init.lua deleted file mode 100644 index 2f4d42a9..00000000 --- a/lua/nv-nvimtree/init.lua +++ /dev/null @@ -1,74 +0,0 @@ ---[[ " ---let g:nvim_tree_auto_ignore_ft = 'startify' "empty by default, don't auto open tree on specific filetypes. -let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.` -let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). -" let g:nvim_tree_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open -" let g:nvim_tree_width_allow_resize = 1 "0 by default, will not resize the tree when opening a file -let g:nvim_tree_show_icons = { - \ 'git': 1, - \ 'folders': 1, - \ 'files': 1, - \ } - -"If 0, do not show the icons for one of 'git' 'folder' and 'files' -"1 by default, notice that if 'files' is 1, it will only display -"if nvim-web-devicons is installed and on your runtimepath ]] --- vim.g.nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default -vim.g.nvim_tree_disable_netrw = 0 --"1 by default, disables netrw --- vim.g.nvim_tree_hijack_netrw = 0 --"1 by default, prevents netrw from automatically opening when opening directories (but lets you keep its other utilities) -vim.g.nvim_tree_hide_dotfiles = 1 --0 by default, this option hides files and folders starting with a dot `.` -vim.g.nvim_tree_indent_markers = 1 --"0 by default, this option shows indent markers when folders are open -vim.g.nvim_tree_follow = 1 --"0 by default, this option allows the cursor to be updated when entering a buffer --- vim.g.nvim_tree_lsp_diagnostics = 1 --0 by default, will show lsp diagnostics in the tree. See :help nvim_tree_lsp_diagnostics -vim.g.nvim_tree_auto_close = O.auto_close_tree --0 by default, closes the tree when it's the last window -vim.g.nvim_tree_auto_ignore_ft = 'startify' --"empty by default, don't auto open tree on specific filetypes. -local tree_cb = require'nvim-tree.config'.nvim_tree_callback -vim.g.nvim_tree_bindings = { - -- mappings - [""] = tree_cb("edit"), - ["l"] = tree_cb("edit"), - ["o"] = tree_cb("edit"), - ["<2-LeftMouse>"] = tree_cb("edit"), - ["<2-RightMouse>"] = tree_cb("cd"), - [""] = tree_cb("cd"), - ["v"] = tree_cb("vsplit"), - ["s"] = tree_cb("split"), - [""] = tree_cb("tabnew"), - ["h"] = tree_cb("close_node"), - [""] = tree_cb("close_node"), - [""] = tree_cb("close_node"), - [""] = tree_cb("preview"), - ["I"] = tree_cb("toggle_ignored"), - ["H"] = tree_cb("toggle_dotfiles"), - ["R"] = tree_cb("refresh"), - ["a"] = tree_cb("create"), - ["d"] = tree_cb("remove"), - ["r"] = tree_cb("rename"), - [""] = tree_cb("full_rename"), - ["x"] = tree_cb("cut"), - ["c"] = tree_cb("copy"), - ["p"] = tree_cb("paste"), - ["[c"] = tree_cb("prev_git_item"), - ["]c"] = tree_cb("next_git_item"), - ["-"] = tree_cb("dir_up"), - ["q"] = tree_cb("close") -} -vim.g.nvim_tree_icons = { - default = '', - symlink = '', - git = { - unstaged = "", - staged = "", - unmerged = "", - renamed = "➜", - untracked = "", - -- ignored = "◌" - }, - folder = { - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "" - } -} diff --git a/lua/nv-quickscope/init.lua b/lua/nv-quickscope/init.lua deleted file mode 100644 index 817bc6dc..00000000 --- a/lua/nv-quickscope/init.lua +++ /dev/null @@ -1,4 +0,0 @@ --- Trigger a highlight in the appropriate direction when pressing these keys: --- vim.cmd('let g:qs_highlight_on_keys = [\'f\', \'F\', \'t\', \'T\']') -vim.g.qs_highlight_on_keys = {'f', 'F', 't', 'T'} -vim.g.qs_max_chars=150 diff --git a/lua/nv-rnvimr/init.lua b/lua/nv-rnvimr/init.lua deleted file mode 100644 index 5a9f2b8a..00000000 --- a/lua/nv-rnvimr/init.lua +++ /dev/null @@ -1,24 +0,0 @@ --- Make Ranger replace netrw and be the file explorer -vim.g.rnvimr_ex_enable = 1 -vim.g.rnvimr_draw_border = 1 - --- Make Ranger to be hidden after picking a file -vim.g.rnvimr_pick_enable = 1 - --- Make Neovim to wipe the buffers corresponding to the files deleted by Ranger -vim.g.rnvimr_bw_enable = 1 - --- vim.cmd('nmap r :RnvimrToggle') - ---[[ let g:rnvimr_ranger_cmd = 'ranger --cmd="set column_ratios 1,1"' - " \ --cmd="set draw_borders separators"' - -" let g:rnvimr_layout = { 'relative': 'editor', -" \ 'width': float2nr(round(0.6 * &columns)), -" \ 'height': float2nr(round(0.6 * &lines)), -" \ 'col': float2nr(round(0.2 * &columns)), -" \ 'row': float2nr(round(0.2 * &lines)), -" \ 'style': 'minimal' } - -let g:rnvimr_presets = [ - \ {'width': 0.800, 'height': 0.800}] ]] diff --git a/lua/nv-startify/init.lua b/lua/nv-startify/init.lua deleted file mode 100644 index d7a65bc6..00000000 --- a/lua/nv-startify/init.lua +++ /dev/null @@ -1,33 +0,0 @@ -vim.g.startify_custom_header = { - ' ███╗ ██╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗', - ' ████╗ ██║██║ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝', - ' ██╔██╗ ██║██║ ██║██║ ██║ ██║██║ ██║█████╗', - ' ██║╚██╗██║╚██╗ ██╔╝██║ ██║ ██║██║ ██║██╔══╝', - ' ██║ ╚████║ ╚████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗', - ' ╚═╝ ╚═══╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝' -} - -vim.g.webdevicons_enable_startify = 1 -vim.g.startify_enable_special = 0 -vim.g.startify_session_dir = '~/.config/nvim/session' -vim.g.startify_session_autoload = 1 -vim.g.startify_session_delete_buffers = 1 -vim.g.startify_change_to_vcs_root = 1 -vim.g.startify_fortune_use_unicode = 1 -vim.g.startify_session_persistence = 1 -vim.g.startify_session_dir = '~/.config/nvim/session' - -vim.api.nvim_exec( - 'let startify_lists = [ { \'type\': \'files\', \'header\': [\' Files\'] }, { \'type\': \'sessions\', \'header\': [\' Sessions\'] }, { \'type\': \'bookmarks\', \'header\': [\' Bookmarks\'] }, ]', - true) - -vim.api.nvim_exec( - 'let startify_bookmarks = [ { \'b\': \'~/Blog\' }, { \'c\': \'~/.config/nvim/lua/config.lua\' }, { \'z\': \'~/.zshrc\' }, { \'r\': \'~/.config/nvim/README.md\' }]', - true) - -vim.cmd([[ -function! StartifyEntryFormat() - return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path' -endfunction -]]) - diff --git a/lua/nv-surround/init.lua b/lua/nv-surround/init.lua deleted file mode 100644 index e69de29b..00000000 diff --git a/lua/nv-telescope/init.lua b/lua/nv-telescope/init.lua deleted file mode 100644 index 0255f6cf..00000000 --- a/lua/nv-telescope/init.lua +++ /dev/null @@ -1,73 +0,0 @@ -local actions = require('telescope.actions') --- Global remapping ------------------------------- --- '--color=never', -require('telescope').load_extension('media_files') -require('telescope').setup { - defaults = { - find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'}, - prompt_position = "top", - prompt_prefix = " ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "descending", - layout_strategy = "horizontal", - layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}}, - file_sorter = require'telescope.sorters'.get_fuzzy_file, - file_ignore_patterns = {}, - generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, - shorten_path = true, - winblend = 0, - width = 0.75, - preview_cutoff = 120, - results_height = 1, - results_width = 0.8, - border = {}, - borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, - color_devicons = true, - use_less = true, - set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, - file_previewer = require'telescope.previewers'.vim_buffer_cat.new, - grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, - qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, - - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.smart_send_to_qflist + actions.open_qflist, - -- To disable a keymap, put [map] = false - -- So, to not map "", just put - -- [""] = false, - [""] = actions.close, - - -- Otherwise, just set the mapping to the function that you want it to be. - -- [""] = actions.select_horizontal, - - -- Add up multiple actions - [""] = actions.select_default + actions.center - - -- You can perform as many actions in a row as you like - -- [""] = actions.select_default + actions.center + my_cool_custom_action, - }, - n = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.smart_send_to_qflist + actions.open_qflist, - -- [""] = my_cool_custom_action, - } - } - }, - extensions = { - media_files = { - -- filetypes whitelist - -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} - filetypes = {"png", "webp", "jpg", "jpeg"}, - find_cmd = "rg" -- find command (defaults to `fd`) - } - } -} diff --git a/lua/nv-treesitter/init.lua b/lua/nv-treesitter/init.lua deleted file mode 100644 index f846a917..00000000 --- a/lua/nv-treesitter/init.lua +++ /dev/null @@ -1,21 +0,0 @@ -require'nvim-treesitter.configs'.setup { - ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages - -- TODO seems to be broken - ignore_install = O.treesitter.ignore_install, - highlight = { - enable = O.treesitter.highlight.enabled -- false will disable the whole extension - }, - -- indent = {enable = true, disable = {"python", "html", "javascript"}}, - indent = {enable = {"javascriptreact"}}, - playground = { - enable = O.treesitter.playground.enabled, - disable = {}, - updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code - persist_queries = false -- Whether the query persists across vim sessions - }, - autotag = {enable = true}, - rainbow = {enable = O.treesitter.rainbow.enabled}, - context_commentstring = {enable = true, config = {javascriptreact = {style_element = '{/*%s*/}'}}} - -- refactor = {highlight_definitions = {enable = true}} -} - diff --git a/lua/nv-utils/init.lua b/lua/nv-utils/init.lua deleted file mode 100644 index c177cb09..00000000 --- a/lua/nv-utils/init.lua +++ /dev/null @@ -1,190 +0,0 @@ -local nv_utils = {} - -function nv_utils.define_augroups(definitions) -- {{{1 - -- Create autocommand groups based on the passed definitions - -- - -- The key will be the name of the group, and each definition - -- within the group should have: - -- 1. Trigger - -- 2. Pattern - -- 3. Text - -- just like how they would normally be defined from Vim itself - for group_name, definition in pairs(definitions) do - vim.cmd('augroup ' .. group_name) - vim.cmd('autocmd!') - - for _, def in pairs(definition) do - local command = table.concat(vim.tbl_flatten {'autocmd', def}, ' ') - vim.cmd(command) - end - - vim.cmd('augroup END') - end -end - --- lsp - -function nv_utils.add_to_workspace_folder() - vim.lsp.buf.add_workspace_folder() -end - -function nv_utils.clear_references() - vim.lsp.buf.clear_references() -end - -function nv_utils.code_action() - vim.lsp.buf.code_action() -end - -function nv_utils.declaration() - vim.lsp.buf.declaration() - vim.lsp.buf.clear_references() -end - -function nv_utils.definition() - vim.lsp.buf.definition() - vim.lsp.buf.clear_references() -end - -function nv_utils.document_highlight() - vim.lsp.buf.document_highlight() -end - -function nv_utils.document_symbol() - vim.lsp.buf.document_symbol() -end - -function nv_utils.formatting() - vim.lsp.buf.formatting() -end - -function nv_utils.formatting_sync() - vim.lsp.buf.formatting_sync() -end - -function nv_utils.hover() - vim.lsp.buf.hover() -end - -function nv_utils.implementation() - vim.lsp.buf.implementation() -end - -function nv_utils.incoming_calls() - vim.lsp.buf.incoming_calls() -end - -function nv_utils.list_workspace_folders() - vim.lsp.buf.list_workspace_folders() -end - -function nv_utils.outgoing_calls() - vim.lsp.buf.outgoing_calls() -end - -function nv_utils.range_code_action() - vim.lsp.buf.range_code_action() -end - -function nv_utils.range_formatting() - vim.lsp.buf.range_formatting() -end - -function nv_utils.references() - vim.lsp.buf.references() - vim.lsp.buf.clear_references() -end - -function nv_utils.remove_workspace_folder() - vim.lsp.buf.remove_workspace_folder() -end - -function nv_utils.rename() - vim.lsp.buf.rename() -end - -function nv_utils.signature_help() - vim.lsp.buf.signature_help() -end - -function nv_utils.type_definition() - vim.lsp.buf.type_definition() -end - -function nv_utils.workspace_symbol() - vim.lsp.buf.workspace_symbol() -end - --- diagnostic - -function nv_utils.get_all() - vim.lsp.diagnostic.get_all() -end - -function nv_utils.get_next() - vim.lsp.diagnostic.get_next() -end - -function nv_utils.get_prev() - vim.lsp.diagnostic.get_prev() -end - -function nv_utils.goto_next() - vim.lsp.diagnostic.goto_next() -end - -function nv_utils.goto_prev() - vim.lsp.diagnostic.goto_prev() -end - -function nv_utils.show_line_diagnostics() - vim.lsp.diagnostic.show_line_diagnostics() -end - --- git signs - -function nv_utils.next_hunk() - require('gitsigns').next_hunk() -end - -function nv_utils.prev_hunk() - require('gitsigns').prev_hunk() -end - -function nv_utils.stage_hunk() - require('gitsigns').stage_hunk() -end - -function nv_utils.undo_stage_hunk() - require('gitsigns').undo_stage_hunk() -end - -function nv_utils.reset_hunk() - require('gitsigns').reset_hunk() -end - -function nv_utils.reset_buffer() - require('gitsigns').reset_buffer() -end - -function nv_utils.preview_hunk() - require('gitsigns').preview_hunk() -end - -function nv_utils.blame_line() - require('gitsigns').blame_line() -end - --- misc -function nv_utils.file_exists(name) - local f = io.open(name, "r") - if f ~= nil then - io.close(f) - return true - else - return false - end -end - -return nv_utils - diff --git a/lua/nv-vim-rooter/init.lua b/lua/nv-vim-rooter/init.lua deleted file mode 100644 index a8731945..00000000 --- a/lua/nv-vim-rooter/init.lua +++ /dev/null @@ -1,2 +0,0 @@ --- TODO create file -vim.g.rooter_silent_chdir = 1 diff --git a/lua/plugins.lua b/lua/plugins.lua index 2a48b66b..6bed60a3 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,4 +1,3 @@ --- vim.cmd [[packadd packer.nvim]] local execute = vim.api.nvim_command local fn = vim.fn @@ -9,167 +8,98 @@ if fn.empty(fn.glob(install_path)) > 0 then execute 'packadd packer.nvim' end -local my = function(file) require(file) end +--- Check if a file or directory exists in this path +local function require_plugin(plugin) + local plugin_prefix = fn.stdpath('data') .. '/site/pack/packer/opt/' + + local plugin_path = plugin_prefix .. plugin .. '/' + -- print('test '..plugin_path) + local ok, err, code = os.rename(plugin_path, plugin_path) + if not ok then + if code == 13 then + -- Permission denied, but it exists + return true + end + end + -- print(ok, err, code) + if ok then vim.cmd('packadd ' .. plugin) end + return ok, err, code +end vim.cmd 'autocmd BufWritePost plugins.lua PackerCompile' -- Auto compile when there are changes in plugins.lua --- require('packer').init({display = {non_interactive = true}}) -require('packer').init({display = {auto_clean = false}}) - return require('packer').startup(function(use) -- Packer can manage itself as an optional plugin use 'wbthomason/packer.nvim' - -- Information - -- use 'nanotee/nvim-lua-guide' - - -- Quality of life improvements - -- use 'norcalli/nvim_utils' + -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) + use {'neovim/nvim-lspconfig', opt=true} + use {'glepnir/lspsaga.nvim', opt=true} + use {'onsails/lspkind-nvim', opt=true} + use {'kabouzeid/nvim-lspinstall', opt=true} - -- LSP - use 'neovim/nvim-lspconfig' - use 'glepnir/lspsaga.nvim' - use 'onsails/lspkind-nvim' - use 'kosayoda/nvim-lightbulb' - use 'mfussenegger/nvim-jdtls' - use 'kabouzeid/nvim-lspinstall' + -- Tlescope + use {'nvim-lua/popup.nvim', opt=true} + use {'nvim-lua/plenary.nvim', opt=true} + use {'nvim-telescope/telescope.nvim', opt=true} - -- Debugging - use 'mfussenegger/nvim-dap' + -- Dbugging + use {'mfussenegger/nvim-dap', opt=true} - -- Autocomplete - use 'hrsh7th/nvim-compe' - use 'mattn/emmet-vim' - use 'hrsh7th/vim-vsnip' - use "rafamadriz/friendly-snippets" - use 'ChristianChiarulli/html-snippets' + -- Atocomplete + use {'hrsh7th/nvim-compe', opt=true} + use {'hrsh7th/vim-vsnip', opt=true} + use {"rafamadriz/friendly-snippets", opt=true} - -- Treesitter + -- Teesitter use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} - use 'p00f/nvim-ts-rainbow' - use {'lukas-reineke/indent-blankline.nvim', branch = 'lua'} - use 'nvim-treesitter/playground' - use 'JoosepAlviste/nvim-ts-context-commentstring' - use 'windwp/nvim-ts-autotag' + use {'windwp/nvim-ts-autotag', opt=true} - -- Icons - use 'kyazdani42/nvim-web-devicons' - use 'ryanoasis/vim-devicons' + -- Eplorer + use 'kyazdani42/nvim-tree.lua' + -- TODO remove when open on dir is supported by nvimtree + use 'kevinhwang91/rnvimr' - -- Status Line and Bufferline - use { 'glepnir/galaxyline.nvim' } - -- use { 'glepnir/galaxyline.nvim', config = function() require'nv-galaxyline' end } -- inline fn alternative - use 'romgrk/barbar.nvim' +-- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'} + use {'lewis6991/gitsigns.nvim', opt = true} + use {'liuchengxu/vim-which-key', opt = true} + use {'ChristianChiarulli/dashboard-nvim', opt = true} + use {'windwp/nvim-autopairs', opt = true} + use {'terrortylor/nvim-comment', opt = true} + use {'kevinhwang91/nvim-bqf', opt = true} - -- Telescope - use 'nvim-lua/popup.nvim' - use 'nvim-lua/plenary.nvim' - use 'nvim-telescope/telescope.nvim' - use 'nvim-telescope/telescope-media-files.nvim' + -- Color + use {'christianchiarulli/nvcode-color-schemes.vim', opt = true} - -- Explorer - use 'kyazdani42/nvim-tree.lua' + -- Icons + use {'kyazdani42/nvim-web-devicons', opt = true} - -- Color - use 'christianchiarulli/nvcode-color-schemes.vim' - use 'norcalli/nvim-colorizer.lua' - use 'sheerun/vim-polyglot' - - -- Git - -- use 'TimUntersberger/neogit' - use {'lewis6991/gitsigns.nvim', requires = {'nvim-lua/plenary.nvim'}} - use 'f-person/git-blame.nvim' - use 'tpope/vim-fugitive' - use 'tpope/vim-rhubarb' - - -- Easily Create Gists - use 'mattn/vim-gist' - use 'mattn/webapi-vim' - - -- Webdev - -- TODO add back when I learn it better - -- use 'gennaro-tedesco/nvim-jqx' - -- use 'turbio/bracey.vim' - - -- Php - use 'phpactor/phpactor' - - -- Flutter - use 'thosakwe/vim-flutter' - - -- Dependency assistent - use 'akinsho/dependency-assist.nvim' - - -- Registers - -- use 'gennaro-tedesco/nvim-peekup' - - -- Navigation - use 'unblevable/quick-scope' -- hop may replace you - use 'phaazon/hop.nvim' - use 'kevinhwang91/rnvimr' -- telescope may fully replace you - - -- General Plugins - use 'liuchengxu/vim-which-key' - use 'kevinhwang91/nvim-bqf' - use 'airblade/vim-rooter' - use 'ChristianChiarulli/dashboard-nvim' - use 'metakirby5/codi.vim' - use {'iamcco/markdown-preview.nvim', run = 'cd app && npm install'} - use 'voldikss/vim-floaterm' - use 'terrortylor/nvim-comment' - use 'monaqa/dial.nvim' - use 'junegunn/goyo.vim' - use 'andymass/vim-matchup' - use 'MattesGroeger/vim-bookmarks' - use 'windwp/nvim-autopairs' - use 'mbbill/undotree' - use 'nacro90/numb.nvim' - use 'turbio/bracey.vim' - - -- Database - use 'tpope/vim-dadbod' - use 'kristijanhusak/vim-dadbod-ui' - use 'kristijanhusak/vim-dadbod-completion' - - -- Documentation Generator - use {'kkoomen/vim-doge', run = ':call doge#install()'} - - -- TODO put this back when stable for indent lines - -- vim.g.indent_blankline_space_char = '' - -- use 'b3nj5m1n/kommentary' - -- use { - -- 'glacambre/firenvim', - -- run = function() - -- vim.fn['firenvim#install'](1) - -- end - -- } - -- use 'glepnir/dashboard-nvim' - -- use 'mhinz/vim-startify' - -- use 'cstrap/python-snippets' - -- use 'ylcnfrht/vscode-python-snippet-pack' - -- use 'norcalli/snippets.nvim' - -- use {'akinsho/nvim-bufferline.lua', requires = 'kyazdani42/nvim-web-devicons'} - -- use 'SirVer/ultisnips' - -- use 'honza/vim-snippets' - -- vim.g.UltiSnipsExpandTrigger="" - -- vim.g.UltiSnipsJumpForwardTrigger="" - -- vim.g.UltiSnipsJumpBackwardTrigger="" - -- use 'blackcauldron7/surround.nvim' - -- use 'ChristianChiarulli/java-snippets' - -- use 'xabikos/vscode-javascript' - -- use 'dsznajder/vscode-es7-javascript-react-snippets' - -- use 'golang/vscode-go' - -- use 'rust-lang/vscode-rust' - -- use 'ChristianChiarulli/python-snippets' - -- use 'kshenoy/vim-signature' - -- use 'nelstrom/vim-visual-star-search' - -- TODO switch back when config support snips - -- use 'cohama/lexima.vim' - -- use 'bfredl/nvim-miniyank' - -- use 'brooth/far.vim' - -- use 'liuchengxu/vista.vim' - -- use 'psliwka/vim-smoothie' - -- use 'nvim-treesitter/nvim-treesitter-refactor' - -- use 'nvim-treesitter/playground' - -- use 'moll/vim-bbye' + -- Status Line and Bufferline + use {'glepnir/galaxyline.nvim', opt = true} + use {'romgrk/barbar.nvim', opt = true} + + require_plugin('nvim-lspconfig') + require_plugin('lspsaga.nvim') + require_plugin('lspkind-nvim') + require_plugin('nvim-lspinstall') + require_plugin('popup.nvim') + require_plugin('plenary.nvim') + require_plugin('telescope.nvim') + require_plugin('nvim-dap') + require_plugin('nvim-compe') + require_plugin('vim-vsnip') + require_plugin('nvim-treesitter') + require_plugin('nvim-ts-autotag') + require_plugin('nvim-tree.lua') + require_plugin('gitsigns.nvim') + require_plugin('vim-which-key') + require_plugin('dashboard-nvim') + require_plugin('nvim-autopairs') + require_plugin('nvim-comment') + require_plugin('nvim-bqf') + require_plugin('nvcode-color-schemes.vim') + require_plugin('nvim-web-devicons') + require_plugin('galaxyline.nvim') + require_plugin('barbar.nvim') end) + diff --git a/lv-settings.lua b/lv-settings.lua new file mode 100644 index 00000000..70d72b4a --- /dev/null +++ b/lv-settings.lua @@ -0,0 +1,52 @@ +--[[ +O is the global options object + +Formatters and linters should be +filled in as strings with either +a global executable or a path to +an executable +]] + +-- general +O.auto_complete = true +O.colorscheme = 'lunar' +O.auto_close_tree = 0 +O.wrap_lines = false + +-- if you don't want all the parsers change this to a table of the ones you want +O.treesitter.ensure_installed = "all" +O.treesitter.ignore_install = {"haskell"} +O.treesitter.highlight.enabled = true + + +O.clang.diagnostics.virtual_text = false +O.clang.diagnostics.signs = false +O.clang.diagnostics.underline = false + +-- python +-- add things like O.python.formatter.yapf.exec_path +-- add things like O.python.linter.flake8.exec_path +-- add things like O.python.formatter.isort.exec_path +O.python.formatter = 'yapf' +-- O.python.linter = 'flake8' +O.python.isort = true +O.python.autoformat = true +O.python.diagnostics.virtual_text = true +O.python.diagnostics.signs = true +O.python.diagnostics.underline = true + +-- lua +-- TODO look into stylua +O.lua.formatter = 'lua-format' +-- O.lua.formatter = 'lua-format' +O.lua.autoformat = false + +-- javascript +O.tsserver.formatter = 'prettier' +O.tsserver.linter = nil +O.tsserver.autoformat = true + +-- json +O.json.autoformat = true + +-- create custom autocommand field (This would be easy with lua) diff --git a/nv-settings.lua b/nv-settings.lua deleted file mode 100644 index 0125ad8c..00000000 --- a/nv-settings.lua +++ /dev/null @@ -1,53 +0,0 @@ ---[[ -O is the global options object - -Formatters and linters should be -filled in as strings with either -a global executable or a path to -an executable -]] - --- general -O.auto_complete = true -O.colorscheme = 'lunar' -O.auto_close_tree = 0 -O.wrap_lines = false - -O.treesitter.ensure_installed = "all" -O.treesitter.ignore_install = {"haskell"} -O.treesitter.highlight.enabled = true -O.treesitter.playground.enabled = true -O.treesitter.rainbow.enabled = false - - -O.clang.diagnostics.virtual_text = false -O.clang.diagnostics.signs = false -O.clang.diagnostics.underline = false - --- python --- add things like O.python.formatter.yapf.exec_path --- add things like O.python.linter.flake8.exec_path --- add things like O.python.formatter.isort.exec_path -O.python.formatter = 'yapf' --- O.python.linter = 'flake8' -O.python.isort = true -O.python.autoformat = true -O.python.diagnostics.virtual_text = true -O.python.diagnostics.signs = true -O.python.diagnostics.underline = true - --- lua --- TODO look into stylua -O.lua.formatter = 'lua-format' --- O.lua.formatter = 'lua-format' -O.lua.autoformat = false - --- javascript -O.tsserver.formatter = 'prettier' -O.tsserver.linter = nil -O.tsserver.autoformat = true - --- json -O.json.autoformat = true - --- create custom autocommand field (This would be easy with lua) diff --git a/utils/init.lua b/utils/init.lua deleted file mode 100644 index 6bcd551c..00000000 --- a/utils/init.lua +++ /dev/null @@ -1,2 +0,0 @@ - require('plugins') - diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 21bf6b28..f8d140b7 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -15,7 +15,7 @@ installnodeubuntu() { } moveoldnvim() { - echo "Not installing NVCode" + echo "Not installing LunarVim" echo "Please move your ~/.config/nvim folder before installing" exit } @@ -66,13 +66,13 @@ installpacker() { } cloneconfig() { - echo "Cloning NVCode configuration" - git clone https://github.com/ChristianChiarulli/nvcode.git ~/.config/nvim - mv $HOME/.config/nvim/init.lua $HOME/.config/nvim/init.lua.tmp - mv $HOME/.config/nvim/utils/init.lua $HOME/.config/nvim/init.lua - # nvim -u $HOME/.config/nvim/init.lua --headless --noplugin +PackerInstall +qall - rm $HOME/.config/nvim/init.lua - mv $HOME/.config/nvim/init.lua.tmp $HOME/.config/nvim/init.lua + echo "Cloning LunarVim configuration" + git clone https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim + # mv $HOME/.config/nvim/init.lua $HOME/.config/nvim/init.lua.tmp + # mv $HOME/.config/nvim/utils/init.lua $HOME/.config/nvim/init.lua + nvim -u $HOME/.config/nvim/init.lua +PackerInstall + # rm $HOME/.config/nvim/init.lua + # mv $HOME/.config/nvim/init.lua.tmp $HOME/.config/nvim/init.lua } asktoinstallnode() { @@ -123,7 +123,7 @@ installextrapackages() { } # Welcome -echo 'Installing NVCode' +echo 'Installing LunarVim' # move old nvim directory if it exists [ -d "$HOME/.config/nvim" ] && moveoldnvim @@ -143,17 +143,17 @@ else installpacker fi -if [ -a "$HOME/.config/nvcode/init.lua" ]; then +if [ -a "$HOME/.config/nvim/init.lua" ]; then echo 'nvcode already installed' else # clone config down cloneconfig - echo 'export PATH=$HOME/.config/nvcode/utils/bin:$PATH' >>~/.zshrc - echo 'export PATH=$HOME/.config/nvcode/utils/bin:$PATH' >>~/.bashrc + # echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc + # echo 'export PATH=$HOME/.config/nvcode/utils/bin:$PATH' >>~/.bashrc fi echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts" -echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf" +# echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf" -echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH appending to zshrc/bashrc' +# echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH appending to zshrc/bashrc' diff --git a/utils/media/demo.png b/utils/media/demo.png index fd8cafe4..08e3dba1 100755 Binary files a/utils/media/demo.png and b/utils/media/demo.png differ diff --git a/utils/media/nvcode_logo.png b/utils/media/nvcode_logo.png deleted file mode 100755 index 99d6ff9a..00000000 Binary files a/utils/media/nvcode_logo.png and /dev/null differ diff --git a/utils/media/nvcode_logo.png.old b/utils/media/nvcode_logo.png.old deleted file mode 100755 index d8bad3ee..00000000 Binary files a/utils/media/nvcode_logo.png.old and /dev/null differ diff --git a/vimscript/functions.vim b/vimscript/functions.vim index c1905971..78da3589 100644 --- a/vimscript/functions.vim +++ b/vimscript/functions.vim @@ -1,28 +1,28 @@ -command! LspCodeAction lua require 'nv-utils'.code_action() -command! LspDeclaration lua require 'nv-utils'.declaration() -command! LspDefinition lua require 'nv-utils'.definition() -command! LspDocumentSymbol lua require 'nv-utils'.document_symbol() -command! LspFormatting lua require 'nv-utils'.formatting() -command! LspFormattingSync lua require 'nv-utils'.formatting_sync() -command! LspHover lua require 'nv-utils'.hover() -command! LspImplementation lua require 'nv-utils'.implementation() -command! LspRangeCodeAction lua require 'nv-utils'.range_code_action() -command! LspRangeFormatting lua require 'nv-utils'.range_formatting() -command! LspReferences lua require 'nv-utils'.references() -command! LspRename lua require 'nv-utils'.rename() -command! LspTypeDefinition lua require 'nv-utils'.type_definition() -command! LspWorkspaceSymbol lua require 'nv-utils'.workspace_symbol() -command! LspGotoNext lua require 'nv-utils'.goto_next() -command! LspGotoPrev lua require 'nv-utils'.goto_prev() -command! LspShowLineDiagnostics lua require 'nv-utils'.show_line_diagnostics() -command! NextHunk lua require 'nv-utils'.next_hunk() -command! PrevHunk lua require 'nv-utils'.prev_hunk() -command! StageHunk lua require 'nv-utils'.stage_hunk() -command! UndoStageHunk lua require 'nv-utils'.undo_stage_hunk() -command! ResetHunk lua require 'nv-utils'.reset_hunk() -command! ResetBuffer lua require 'nv-utils'.reset_buffer() -command! PreviewHunk lua require 'nv-utils'.preview_hunk() -command! BlameLine lua require 'nv-utils'.blame_line() +command! LspCodeAction lua require 'lv-utils'.code_action() +command! LspDeclaration lua require 'lv-utils'.declaration() +command! LspDefinition lua require 'lv-utils'.definition() +command! LspDocumentSymbol lua require 'lv-utils'.document_symbol() +command! LspFormatting lua require 'lv-utils'.formatting() +command! LspFormattingSync lua require 'lv-utils'.formatting_sync() +command! LspHover lua require 'lv-utils'.hover() +command! LspImplementation lua require 'lv-utils'.implementation() +command! LspRangeCodeAction lua require 'lv-utils'.range_code_action() +command! LspRangeFormatting lua require 'lv-utils'.range_formatting() +command! LspReferences lua require 'lv-utils'.references() +command! LspRename lua require 'lv-utils'.rename() +command! LspTypeDefinition lua require 'lv-utils'.type_definition() +command! LspWorkspaceSymbol lua require 'lv-utils'.workspace_symbol() +command! LspGotoNext lua require 'lv-utils'.goto_next() +command! LspGotoPrev lua require 'lv-utils'.goto_prev() +command! LspShowLineDiagnostics lua require 'lv-utils'.show_line_diagnostics() +command! NextHunk lua require 'lv-utils'.next_hunk() +command! PrevHunk lua require 'lv-utils'.prev_hunk() +command! StageHunk lua require 'lv-utils'.stage_hunk() +command! UndoStageHunk lua require 'lv-utils'.undo_stage_hunk() +command! ResetHunk lua require 'lv-utils'.reset_hunk() +command! ResetBuffer lua require 'lv-utils'.reset_buffer() +command! PreviewHunk lua require 'lv-utils'.preview_hunk() +command! BlameLine lua require 'lv-utils'.blame_line() command! W noa w " Debugging @@ -55,10 +55,6 @@ command! DebugGetSession lua require'dap'.session() " nnoremap dr :lua require'dap'.repl.open() " nnoremap dl :lua require'dap'.run_last() -" TODO find out why this thing follows me everywhere in java -let blacklist = ['java'] -autocmd CursorHold,CursorHoldI * if index(blacklist, &ft) < 0 | lua require'nvim-lightbulb'.update_lightbulb() - autocmd! User GoyoEnter lua require('gitsigns').toggle_signs() autocmd! User GoyoLeave lua require('gitsigns').toggle_signs() diff --git a/vimscript/lv-vscode/init.vim b/vimscript/lv-vscode/init.vim new file mode 100644 index 00000000..e3e7f6eb --- /dev/null +++ b/vimscript/lv-vscode/init.vim @@ -0,0 +1,119 @@ +" TODO there is a more contemporary version of this file +" TODO Also some of it is redundant +" packadd quickscope + +luafile ~/.config/nvim/lua/settings.lua + +" let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] + +" highlight QuickScopePrimary guifg='#00C7DF' gui=underline ctermfg=155 cterm=underline +" highlight QuickScopeSecondary guifg='#eF5F70' gui=underline ctermfg=81 cterm=underline +" let g:qs_max_chars=150 + +"VSCode +function! s:split(...) abort + let direction = a:1 + let file = a:2 + call VSCodeCall(direction == 'h' ? 'workbench.action.splitEditorDown' : 'workbench.action.splitEditorRight') + if file != '' + call VSCodeExtensionNotify('open-file', expand(file), 'all') + endif +endfunction + +function! s:splitNew(...) + let file = a:2 + call s:split(a:1, file == '' ? '__vscode_new__' : file) +endfunction + +function! s:closeOtherEditors() + call VSCodeNotify('workbench.action.closeEditorsInOtherGroups') + call VSCodeNotify('workbench.action.closeOtherEditors') +endfunction + +function! s:manageEditorSize(...) + let count = a:1 + let to = a:2 + for i in range(1, count ? count : 1) + call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize') + endfor +endfunction + +function! s:vscodeCommentary(...) abort + if !a:0 + let &operatorfunc = matchstr(expand(''), '[^. ]*$') + return 'g@' + elseif a:0 > 1 + let [line1, line2] = [a:1, a:2] + else + let [line1, line2] = [line("'["), line("']")] + endif + + call VSCodeCallRange("editor.action.commentLine", line1, line2, 0) +endfunction + +function! s:openVSCodeCommandsInVisualMode() + normal! gv + let visualmode = visualmode() + if visualmode == "V" + let startLine = line("v") + let endLine = line(".") + call VSCodeNotifyRange("workbench.action.showCommands", startLine, endLine, 1) + else + let startPos = getpos("v") + let endPos = getpos(".") + call VSCodeNotifyRangePos("workbench.action.showCommands", startPos[1], endPos[1], startPos[2], endPos[2], 1) + endif +endfunction + +function! s:openWhichKeyInVisualMode() + normal! gv + let visualmode = visualmode() + if visualmode == "V" + let startLine = line("v") + let endLine = line(".") + call VSCodeNotifyRange("whichkey.show", startLine, endLine, 1) + else + let startPos = getpos("v") + let endPos = getpos(".") + call VSCodeNotifyRangePos("whichkey.show", startPos[1], endPos[1], startPos[2], endPos[2], 1) + endif +endfunction + + +command! -complete=file -nargs=? Split call split('h', ) +command! -complete=file -nargs=? Vsplit call split('v', ) +command! -complete=file -nargs=? New call split('h', '__vscode_new__') +command! -complete=file -nargs=? Vnew call split('v', '__vscode_new__') +command! -bang Only if == '!' | call closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif + +" Better Navigation +nnoremap :call VSCodeNotify('workbench.action.navigateDown') +xnoremap :call VSCodeNotify('workbench.action.navigateDown') +nnoremap :call VSCodeNotify('workbench.action.navigateUp') +xnoremap :call VSCodeNotify('workbench.action.navigateUp') +nnoremap :call VSCodeNotify('workbench.action.navigateLeft') +xnoremap :call VSCodeNotify('workbench.action.navigateLeft') +nnoremap :call VSCodeNotify('workbench.action.navigateRight') +xnoremap :call VSCodeNotify('workbench.action.navigateRight') + +nnoremap gr call VSCodeNotify('editor.action.goToReferences') + +" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors +xnoremap vscodeCommentary() +nnoremap vscodeCommentary() . '_' + +nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') + +nnoremap :call VSCodeNotify('whichkey.show') +xnoremap :call openWhichKeyInVisualMode() + +xnoremap :call openVSCodeCommandsInVisualMode() + +xmap gc VSCodeCommentary +nmap gc VSCodeCommentary +omap gc VSCodeCommentary +nmap gcc VSCodeCommentaryLine + +" Simulate same TAB behavior in VSCode +nmap :Tabnext +nmap :Tabprev diff --git a/vimscript/lv-whichkey/init.vim b/vimscript/lv-whichkey/init.vim new file mode 100644 index 00000000..2d2b4441 --- /dev/null +++ b/vimscript/lv-whichkey/init.vim @@ -0,0 +1,140 @@ +" Leader Key Maps + +" Timeout +let g:which_key_timeout = 100 + +let g:which_key_display_names = {'': '↵', '': '⇆', " ": 'SPC'} + +" Map leader to which_key +nnoremap :silent :silent WhichKey '' +vnoremap :silent :silent WhichKeyVisual '' + +let g:which_key_map = {} +let g:which_key_sep = '→' + +" Not a fan of floating windows for this +let g:which_key_use_floating_win = 0 +let g:which_key_max_size = 0 + +" Hide status line +autocmd! FileType which_key +autocmd FileType which_key set laststatus=0 noshowmode noruler + \| autocmd BufLeave set laststatus=2 noshowmode ruler + +let g:which_key_map['/'] = 'comment toggle' +let g:which_key_map[';'] = [ ':Dashboard' , 'home screen' ] +let g:which_key_map['?'] = [ ':NvimTreeFindFile' , 'find current file' ] +let g:which_key_map['e'] = [ ':NvimTreeToggle' , 'explorer' ] +let g:which_key_map['f'] = [ ':Telescope find_files' , 'find files' ] +let g:which_key_map['h'] = [ 's' , 'split below'] +let g:which_key_map['H'] = [ ':let @/ = ""' , 'no highlight' ] +let g:which_key_map['r'] = [ ':RnvimrToggle' , 'ranger' ] +" TODO create entire treesitter section +let g:which_key_map['v'] = [ 'v' , 'split right'] +" TODO play nice with status line + +" Group mappings + +" b is for buffer +let g:which_key_map.b = { + \ 'name' : '+buffer' , + \ '>' : [':BufferMoveNext' , 'move next'], + \ '<' : [':BufferMovePrevious' , 'move prev'], + \ 'b' : [':BufferPick' , 'pick buffer'], + \ 'd' : [':BufferClose' , 'delete-buffer'], + \ 'n' : ['bnext' , 'next-buffer'], + \ 'p' : ['bprevious' , 'previous-buffer'], + \ '?' : ['Buffers' , 'fzf-buffer'], + \ } + +" d is for debug +let g:which_key_map.d = { + \ 'name' : '+debug' , + \ 'b' : ['DebugToggleBreakpoint ' , 'toggle breakpoint'], + \ 'c' : ['DebugContinue' , 'continue'], + \ 'i' : ['DebugStepInto' , 'step into'], + \ 'o' : ['DebugStepOver' , 'step over'], + \ 'r' : ['DebugToggleRepl' , 'toggle repl'], + \ 's' : ['DebugStart' , 'start'], + \ } + +" F is for fold +let g:which_key_map.F = { + \ 'name': '+fold', + \ 'O' : [':set foldlevel=20' , 'open all'], + \ 'C' : [':set foldlevel=0' , 'close all'], + \ 'c' : [':foldclose' , 'close'], + \ 'o' : [':foldopen' , 'open'], + \ '1' : [':set foldlevel=1' , 'level1'], + \ '2' : [':set foldlevel=2' , 'level2'], + \ '3' : [':set foldlevel=3' , 'level3'], + \ '4' : [':set foldlevel=4' , 'level4'], + \ '5' : [':set foldlevel=5' , 'level5'], + \ '6' : [':set foldlevel=6' , 'level6'] + \ } + +" s is for search powered by telescope +let g:which_key_map.s = { + \ 'name' : '+search' , + \ '.' : [':Telescope filetypes' , 'filetypes'], + \ 'B' : [':Telescope git_branches' , 'git branches'], + \ 'd' : [':Telescope lsp_document_diagnostics' , 'document_diagnostics'], + \ 'D' : [':Telescope lsp_workspace_diagnostics' , 'workspace_diagnostics'], + \ 'f' : [':Telescope find_files' , 'files'], + \ 'h' : [':Telescope command_history' , 'history'], + \ 'i' : [':Telescope media_files' , 'media files'], + \ 'm' : [':Telescope marks' , 'marks'], + \ 'M' : [':Telescope man_pages' , 'man_pages'], + \ 'o' : [':Telescope vim_options' , 'vim_options'], + \ 't' : [':Telescope live_grep' , 'text'], + \ 'r' : [':Telescope registers' , 'registers'], + \ 'w' : [':Telescope file_browser' , 'buf_fuz_find'], + \ 'u' : [':Telescope colorscheme' , 'colorschemes'], + \ } + +" S is for Session +let g:which_key_map.S = { + \ 'name' : '+Session' , + \ 's' : [':SessionSave' , 'save session'], + \ 'l' : [':SessionLoad' , 'load Session'], + \ } + +" g is for git +let g:which_key_map.g = { + \ 'name' : '+git' , + \ 'b' : [':GitBlameToggle' , 'blame'], + \ 'B' : [':GBrowse' , 'browse'], + \ 'd' : [':Git diff' , 'diff'], + \ 'j' : [':NextHunk' , 'next hunk'], + \ 'k' : [':PrevHunk' , 'prev hunk'], + \ 'l' : [':Git log' , 'log'], + \ 'p' : [':PreviewHunk' , 'preview hunk'], + \ 'r' : [':ResetHunk' , 'reset hunk'], + \ 'R' : [':ResetBuffer' , 'reset buffer'], + \ 's' : [':StageHunk' , 'stage hunk'], + \ 'S' : [':Gstatus' , 'status'], + \ 'u' : [':UndoStageHunk' , 'undo stage hunk'], + \ } + +" l is for language server protocol +let g:which_key_map.l = { + \ 'name' : '+lsp' , + \ 'a' : [':Lspsaga code_action' , 'code action'], + \ 'A' : [':Lspsaga range_code_action' , 'selected action'], + \ 'd' : [':Telescope lsp_document_diagnostics' , 'document diagnostics'], + \ 'D' : [':Telescope lsp_workspace_diagnostics', 'workspace diagnostics'], + \ 'f' : [':LspFormatting' , 'format'], + \ 'I' : [':LspInfo' , 'lsp info'], + \ 'v' : [':LspVirtualTextToggle' , 'lsp toggle virtual text'], + \ 'l' : [':Lspsaga lsp_finder' , 'lsp finder'], + \ 'L' : [':Lspsaga show_line_diagnostics' , 'line_diagnostics'], + \ 'p' : [':Lspsaga preview_definition' , 'preview definition'], + \ 'q' : [':Telescope quickfix' , 'quickfix'], + \ 'r' : [':Lspsaga rename' , 'rename'], + \ 'T' : [':LspTypeDefinition' , 'type defintion'], + \ 'x' : [':cclose' , 'close quickfix'], + \ 's' : [':Telescope lsp_document_symbols' , 'document symbols'], + \ 'S' : [':Telescope lsp_workspace_symbols' , 'workspace symbols'], + \ } + +call which_key#register('', "g:which_key_map") diff --git a/vimscript/nv-vscode/init.vim b/vimscript/nv-vscode/init.vim deleted file mode 100644 index a10afc97..00000000 --- a/vimscript/nv-vscode/init.vim +++ /dev/null @@ -1,119 +0,0 @@ -" TODO there is a more contemporary version of this file -" TODO Also some of it is redundant -packadd quickscope - -luafile ~/.config/nvim/lua/settings.lua - -let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] - -highlight QuickScopePrimary guifg='#00C7DF' gui=underline ctermfg=155 cterm=underline -highlight QuickScopeSecondary guifg='#eF5F70' gui=underline ctermfg=81 cterm=underline -let g:qs_max_chars=150 - -"VSCode -function! s:split(...) abort - let direction = a:1 - let file = a:2 - call VSCodeCall(direction == 'h' ? 'workbench.action.splitEditorDown' : 'workbench.action.splitEditorRight') - if file != '' - call VSCodeExtensionNotify('open-file', expand(file), 'all') - endif -endfunction - -function! s:splitNew(...) - let file = a:2 - call s:split(a:1, file == '' ? '__vscode_new__' : file) -endfunction - -function! s:closeOtherEditors() - call VSCodeNotify('workbench.action.closeEditorsInOtherGroups') - call VSCodeNotify('workbench.action.closeOtherEditors') -endfunction - -function! s:manageEditorSize(...) - let count = a:1 - let to = a:2 - for i in range(1, count ? count : 1) - call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize') - endfor -endfunction - -function! s:vscodeCommentary(...) abort - if !a:0 - let &operatorfunc = matchstr(expand(''), '[^. ]*$') - return 'g@' - elseif a:0 > 1 - let [line1, line2] = [a:1, a:2] - else - let [line1, line2] = [line("'["), line("']")] - endif - - call VSCodeCallRange("editor.action.commentLine", line1, line2, 0) -endfunction - -function! s:openVSCodeCommandsInVisualMode() - normal! gv - let visualmode = visualmode() - if visualmode == "V" - let startLine = line("v") - let endLine = line(".") - call VSCodeNotifyRange("workbench.action.showCommands", startLine, endLine, 1) - else - let startPos = getpos("v") - let endPos = getpos(".") - call VSCodeNotifyRangePos("workbench.action.showCommands", startPos[1], endPos[1], startPos[2], endPos[2], 1) - endif -endfunction - -function! s:openWhichKeyInVisualMode() - normal! gv - let visualmode = visualmode() - if visualmode == "V" - let startLine = line("v") - let endLine = line(".") - call VSCodeNotifyRange("whichkey.show", startLine, endLine, 1) - else - let startPos = getpos("v") - let endPos = getpos(".") - call VSCodeNotifyRangePos("whichkey.show", startPos[1], endPos[1], startPos[2], endPos[2], 1) - endif -endfunction - - -command! -complete=file -nargs=? Split call split('h', ) -command! -complete=file -nargs=? Vsplit call split('v', ) -command! -complete=file -nargs=? New call split('h', '__vscode_new__') -command! -complete=file -nargs=? Vnew call split('v', '__vscode_new__') -command! -bang Only if == '!' | call closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif - -" Better Navigation -nnoremap :call VSCodeNotify('workbench.action.navigateDown') -xnoremap :call VSCodeNotify('workbench.action.navigateDown') -nnoremap :call VSCodeNotify('workbench.action.navigateUp') -xnoremap :call VSCodeNotify('workbench.action.navigateUp') -nnoremap :call VSCodeNotify('workbench.action.navigateLeft') -xnoremap :call VSCodeNotify('workbench.action.navigateLeft') -nnoremap :call VSCodeNotify('workbench.action.navigateRight') -xnoremap :call VSCodeNotify('workbench.action.navigateRight') - -nnoremap gr call VSCodeNotify('editor.action.goToReferences') - -" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors -xnoremap vscodeCommentary() -nnoremap vscodeCommentary() . '_' - -nnoremap _ :call VSCodeNotify('workbench.action.toggleEditorWidths') - -nnoremap :call VSCodeNotify('whichkey.show') -xnoremap :call openWhichKeyInVisualMode() - -xnoremap :call openVSCodeCommandsInVisualMode() - -xmap gc VSCodeCommentary -nmap gc VSCodeCommentary -omap gc VSCodeCommentary -nmap gcc VSCodeCommentaryLine - -" Simulate same TAB behavior in VSCode -nmap :Tabnext -nmap :Tabprev diff --git a/vimscript/nv-whichkey/init.vim b/vimscript/nv-whichkey/init.vim deleted file mode 100644 index cd5f255f..00000000 --- a/vimscript/nv-whichkey/init.vim +++ /dev/null @@ -1,242 +0,0 @@ -" Leader Key Maps - -" Timeout -let g:which_key_timeout = 100 - -let g:which_key_display_names = {'': '↵', '': '⇆', " ": 'SPC'} - -" Map leader to which_key -nnoremap :silent :silent WhichKey '' -vnoremap :silent :silent WhichKeyVisual '' - -let g:which_key_map = {} -let g:which_key_sep = '→' - -" Not a fan of floating windows for this -let g:which_key_use_floating_win = 0 -let g:which_key_max_size = 0 - -" Hide status line -autocmd! FileType which_key -autocmd FileType which_key set laststatus=0 noshowmode noruler - \| autocmd BufLeave set laststatus=2 noshowmode ruler - -let g:which_key_map['/'] = 'comment toggle' -let g:which_key_map[';'] = [ ':Dashboard' , 'home screen' ] -let g:which_key_map[','] = [ '(emmet-expand-abbr)' , 'expand tags' ] -let g:which_key_map['"'] = [ 'PeekupOpen' , 'registers' ] -let g:which_key_map['?'] = [ ':NvimTreeFindFile' , 'find current file' ] -let g:which_key_map['e'] = [ ':NvimTreeToggle' , 'explorer' ] -let g:which_key_map['f'] = [ ':Telescope find_files' , 'find files' ] -let g:which_key_map['h'] = [ 's' , 'split below'] -let g:which_key_map['M'] = [ ':MarkdownPreviewToggle' , 'markdown preview'] -let g:which_key_map['H'] = [ ':let @/ = ""' , 'no highlight' ] -let g:which_key_map['r'] = [ ':RnvimrToggle' , 'ranger' ] -let g:which_key_map['*'] = [ ':DogeGenerate' , 'documentation generator' ] -let g:which_key_map['u'] = [ ':UndotreeToggle' , 'undo tree' ] -" TODO create entire treesitter section -let g:which_key_map['T'] = [ ':TSHighlightCapturesUnderCursor' , 'treesitter highlight' ] -let g:which_key_map['v'] = [ 'v' , 'split right'] -" TODO play nice with status line -let g:which_key_map['z'] = [ 'Goyo' , 'zen' ] - -" Group mappings - -" . is for emmet -let g:which_key_map['.'] = { - \ 'name' : '+emmet' , - \ ',' : ['(emmet-expand-abbr)' , 'expand abbr'], - \ ';' : ['(emmet-expand-word)' , 'expand word'], - \ 'u' : ['(emmet-update-tag)' , 'update tag'], - \ 'd' : ['(emmet-balance-tag-inward)' , 'balance tag in'], - \ 'D' : ['(emmet-balance-tag-outward)' , 'balance tag out'], - \ 'n' : ['(emmet-move-next)' , 'move next'], - \ 'N' : ['(emmet-move-prev)' , 'move prev'], - \ 'i' : ['(emmet-image-size)' , 'image size'], - \ '/' : ['(emmet-toggle-comment)' , 'toggle comment'], - \ 'j' : ['(emmet-split-join-tag)' , 'split join tag'], - \ 'k' : ['(emmet-remove-tag)' , 'remove tag'], - \ 'a' : ['(emmet-anchorize-url)' , 'anchorize url'], - \ 'A' : ['(emmet-anchorize-summary)' , 'anchorize summary'], - \ 'm' : ['(emmet-merge-lines)' , 'merge lines'], - \ 'c' : ['(emmet-code-pretty)' , 'code pretty'], - \ } - -" a is for actions -let g:which_key_map.a = { - \ 'name' : '+actions' , - \ 'c' : [':ColorizerToggle' , 'colorizer'], - \ 'h' : [':let @/ = ""' , 'remove search highlight'], - \ 'i' : [':IndentBlanklineToggle' , 'toggle indent lines'], - \ 'n' : [':set nonumber!' , 'line-numbers'], - \ 's' : [':s/\%V\(.*\)\%V/"\1"/' , 'surround'], - \ 'r' : [':set norelativenumber!' , 'relative line nums'], - \ 'v' : [':Codi' , 'virtual repl on'], - \ 'V' : [':Codi!' , 'virtual repl off'], - \ } - " \ 'l' : [':Bracey' , 'start live server'], - " \ 'L' : [':BraceyStop' , 'stop live server'], - -" b is for buffer -let g:which_key_map.b = { - \ 'name' : '+buffer' , - \ '>' : [':BufferMoveNext' , 'move next'], - \ '<' : [':BufferMovePrevious' , 'move prev'], - \ 'b' : [':BufferPick' , 'pick buffer'], - \ 'd' : [':BufferClose' , 'delete-buffer'], - \ 'n' : ['bnext' , 'next-buffer'], - \ 'p' : ['bprevious' , 'previous-buffer'], - \ '?' : ['Buffers' , 'fzf-buffer'], - \ } - -" d is for debug -let g:which_key_map.d = { - \ 'name' : '+debug' , - \ 'b' : ['DebugToggleBreakpoint ' , 'toggle breakpoint'], - \ 'c' : ['DebugContinue' , 'continue'], - \ 'i' : ['DebugStepInto' , 'step into'], - \ 'o' : ['DebugStepOver' , 'step over'], - \ 'r' : ['DebugToggleRepl' , 'toggle repl'], - \ 's' : ['DebugStart' , 'start'], - \ } - " \ 'O' : ['DebugStepOut' , 'next-buffer'], - " \ 'S' : ['DebugGetSession ' , 'fzf-buffer'], - -" D is for database -let g:which_key_map.D = { - \ 'name' : '+database' , - \ 'u' : ['DBUIToggle ' , 'db ui toggle'], - \ 'f' : ['DBUIFindBuffer' , 'db find buffer'], - \ 'r' : ['DBUIRenameBuffer' , 'db rename buffer'], - \ 'l' : ['DBUILastQueryInfo' , 'db last query'], - \ } - -" F is for fold -let g:which_key_map.F = { - \ 'name': '+fold', - \ 'O' : [':set foldlevel=20' , 'open all'], - \ 'C' : [':set foldlevel=0' , 'close all'], - \ 'c' : [':foldclose' , 'close'], - \ 'o' : [':foldopen' , 'open'], - \ '1' : [':set foldlevel=1' , 'level1'], - \ '2' : [':set foldlevel=2' , 'level2'], - \ '3' : [':set foldlevel=3' , 'level3'], - \ '4' : [':set foldlevel=4' , 'level4'], - \ '5' : [':set foldlevel=5' , 'level5'], - \ '6' : [':set foldlevel=6' , 'level6'] - \ } - -" m is for mark -" I'd rather use regular marks but they never clear -let g:which_key_map.m = { -\ 'name': '+mark', - \ 't' : [':BookmarkToggle' , 'toggle'], - \ 'j' : [':BookmarkNext' , 'next mark'], - \ 'k' : [':BookmarkPrev' , 'prev mark'] - \ } - -" s is for search powered by telescope -let g:which_key_map.s = { - \ 'name' : '+search' , - \ '.' : [':Telescope filetypes' , 'filetypes'], - \ 'B' : [':Telescope git_branches' , 'git branches'], - \ 'd' : [':Telescope lsp_document_diagnostics' , 'document_diagnostics'], - \ 'D' : [':Telescope lsp_workspace_diagnostics' , 'workspace_diagnostics'], - \ 'f' : [':Telescope find_files' , 'files'], - \ 'h' : [':Telescope command_history' , 'history'], - \ 'i' : [':Telescope media_files' , 'media files'], - \ 'm' : [':Telescope marks' , 'marks'], - \ 'M' : [':Telescope man_pages' , 'man_pages'], - \ 'o' : [':Telescope vim_options' , 'vim_options'], - \ 't' : [':Telescope live_grep' , 'text'], - \ 'r' : [':Telescope registers' , 'registers'], - \ 'w' : [':Telescope file_browser' , 'buf_fuz_find'], - \ 'u' : [':Telescope colorscheme' , 'colorschemes'], - \ } - -" S is for Session -let g:which_key_map.S = { - \ 'name' : '+Session' , - \ 's' : [':SessionSave' , 'save session'], - \ 'l' : [':SessionLoad' , 'load Session'], - \ } - -" g is for git -let g:which_key_map.g = { - \ 'name' : '+git' , - \ 'b' : [':GitBlameToggle' , 'blame'], - \ 'B' : [':GBrowse' , 'browse'], - \ 'd' : [':Git diff' , 'diff'], - \ 'j' : [':NextHunk' , 'next hunk'], - \ 'k' : [':PrevHunk' , 'prev hunk'], - \ 'l' : [':Git log' , 'log'], - \ 'p' : [':PreviewHunk' , 'preview hunk'], - \ 'r' : [':ResetHunk' , 'reset hunk'], - \ 'R' : [':ResetBuffer' , 'reset buffer'], - \ 's' : [':StageHunk' , 'stage hunk'], - \ 'S' : [':Gstatus' , 'status'], - \ 'u' : [':UndoStageHunk' , 'undo stage hunk'], - \ } - " \ 'n' : [':Neogit' , 'neogit'], - -" G is for gist -let g:which_key_map.G = { - \ 'name' : '+gist' , - \ 'b' : [':Gist -b' , 'post gist browser'], - \ 'd' : [':Gist -d' , 'delete gist'], - \ 'e' : [':Gist -e' , 'edit gist'], - \ 'l' : [':Gist -l' , 'list public gists'], - \ 's' : [':Gist -ls' , 'list starred gists'], - \ 'm' : [':Gist -m' , 'post gist all buffers'], - \ 'p' : [':Gist -P' , 'post public gist '], - \ 'P' : [':Gist -p' , 'post private gist '], - \ } - " \ 'a' : [':Gist -a' , 'post gist anon'], - -" l is for language server protocol -let g:which_key_map.l = { - \ 'name' : '+lsp' , - \ 'a' : [':Lspsaga code_action' , 'code action'], - \ 'A' : [':Lspsaga range_code_action' , 'selected action'], - \ 'd' : [':Telescope lsp_document_diagnostics' , 'document diagnostics'], - \ 'D' : [':Telescope lsp_workspace_diagnostics', 'workspace diagnostics'], - \ 'f' : [':LspFormatting' , 'format'], - \ 'I' : [':LspInfo' , 'lsp info'], - \ 'v' : [':LspVirtualTextToggle' , 'lsp toggle virtual text'], - \ 'l' : [':Lspsaga lsp_finder' , 'lsp finder'], - \ 'L' : [':Lspsaga show_line_diagnostics' , 'line_diagnostics'], - \ 'p' : [':Lspsaga preview_definition' , 'preview definition'], - \ 'q' : [':Telescope quickfix' , 'quickfix'], - \ 'r' : [':Lspsaga rename' , 'rename'], - \ 'T' : [':LspTypeDefinition' , 'type defintion'], - \ 'x' : [':cclose' , 'close quickfix'], - \ 's' : [':Telescope lsp_document_symbols' , 'document symbols'], - \ 'S' : [':Telescope lsp_workspace_symbols' , 'workspace symbols'], - \ } - " \ 'H' : [':Lspsaga signature_help' , 'signature_help'], - " \ 'o' : [':Vista!!' , 'outline'], - -" t is for terminal -let g:which_key_map.t = { - \ 'name' : '+terminal' , - \ ';' : [':FloatermNew --wintype=normal --height=6' , 'terminal'], - \ 'f' : [':FloatermNew fzf' , 'fzf'], - \ 'g' : [':FloatermNew lazygit' , 'git'], - \ 'd' : [':FloatermNew lazydocker' , 'docker'], - \ 'n' : [':FloatermNew node' , 'node'], - \ 'N' : [':FloatermNew nnn' , 'nnn'], - \ 'p' : [':FloatermNew python' , 'python'], - \ 'm' : [':FloatermNew lazynpm' , 'npm'], - \ 't' : [':FloatermToggle' , 'toggle'], - \ 'y' : [':FloatermNew ytop' , 'ytop'], - \ 'u' : [':FloatermNew ncdu' , 'ncdu'], - \ } - " \ 'r' : [':FloatermNew ranger' , 'ranger'], - -" let g:which_key_map.R = { -" \ 'name' : '+Find_Replace' , -" \ 'f' : [':Farr --source=vimgrep' , 'file'], -" \ 'p' : [':Farr --source=rgnvim' , 'project'], -" \ } - -call which_key#register('', "g:which_key_map") -- cgit v1.2.3