diff options
author | ame <[email protected]> | 2023-09-29 19:49:11 -0500 |
---|---|---|
committer | ame <[email protected]> | 2023-09-29 19:49:11 -0500 |
commit | 9818f56002f34190b393951cc0118fd8435b0fe3 (patch) | |
tree | 9987d23bde9bfa6beee9697526af8c8fd5258e05 |
init
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | ftplugin/java.lua | 5 | ||||
-rw-r--r-- | init.lua | 109 | ||||
-rw-r--r-- | lua/config/smoothcursor.lua | 30 | ||||
-rw-r--r-- | lua/config/whichkey.lua | 64 | ||||
-rw-r--r-- | lua/keybinds.lua | 20 | ||||
-rw-r--r-- | lua/lsp.lua | 130 | ||||
-rw-r--r-- | lua/opt.lua | 99 | ||||
-rw-r--r-- | lua/speed.lua | 11 | ||||
-rw-r--r-- | readme.md | 3 |
10 files changed, 472 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..47ad858 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +plugin/* diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 0000000..4c7dcfe --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,5 @@ +local config = { + cmd = {'/usr/bin/jdtls'}, + root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]), +} +require('jdtls').start_or_attach(config) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..ce1d978 --- /dev/null +++ b/init.lua @@ -0,0 +1,109 @@ +----]] +local ensure_packer = function() + local fn = vim.fn + local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.cmd [[packadd packer.nvim]] + return true + end + return false +end + +if not (vim.fn.getenv("NVIM_DEBUG") == "1") then + require('speed') + require('keybinds') + require('lsp') + require('opt') +end + +local packer_bootstrap = ensure_packer() + + +return require('packer').startup(function(use) + use 'mfussenegger/nvim-jdtls' + use 'nvim-lua/completion-nvim' + use 'ziglang/zig.vim' + use 'p00f/clangd_extensions.nvim' + use 'nvim-lua/popup.nvim' + use 'sudormrfbin/cheatsheet.nvim' + use 'folke/todo-comments.nvim' + use 'MunifTanjim/nui.nvim' + use 'nvim-neo-tree/neo-tree.nvim' + use 'nvim-tree/nvim-tree.lua' + use 'jim-fx/sudoku.nvim' + use 'alanfortlink/blackjack.nvim' + use 'rktjmp/shenzhen-solitaire.nvim' + use 'alec-gibson/nvim-tetris' + use 'jbyuki/nabla.nvim' + use 'Eandrju/cellular-automaton.nvim' + use 'rcarriga/nvim-notify' + use 'echasnovski/mini.nvim' + use 'lewis6991/gitsigns.nvim' + use 'folke/trouble.nvim' + use 'wuelnerdotexe/vim-enfocado' + use 'cappyzawa/trim.nvim' + use 'seandewar/nvimesweeper' + use 'seandewar/killersheep.nvim' + use 'nanotech/jellybeans.vim' + use 'ThePrimeagen/harpoon' + use 'ray-x/lsp_signature.nvim' + use 'rktjmp/lush.nvim' + use 'DNLHC/glance.nvim' + use 'marko-cerovac/material.nvim' + use 'Abstract-IDE/Abstract-cs' + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.1', + requires = { {'nvim-lua/plenary.nvim'} } + } + use 'ggandor/flit.nvim' + use 'RRethy/nvim-base16' + use 'lewis6991/impatient.nvim' + use 'danilamihailov/beacon.nvim' + use 'tiagovla/tokyodark.nvim' + use 'cpea2506/one_monokai.nvim' + use 'ramojus/mellifluous.nvim' + use 'olivercederborg/poimandres.nvim' + use 'RRethy/vim-illuminate' + use 'EdenEast/nightfox.nvim' + use 'frenzyexists/aquarium-vim' + use 'kdheepak/monochrome.nvim' + use 'junegunn/fzf' + use 'ray-x/aurora' + use 'crusoexia/vim-monokai' + use 'wbthomason/packer.nvim' + use 'rebelot/kanagawa.nvim' + use 'williamboman/mason.nvim' + use 'williamboman/mason-lspconfig.nvim' + use 'mfussenegger/nvim-dap' + use 'jose-elias-alvarez/null-ls.nvim' + use 'neovim/nvim-lspconfig' + use 'nvim-lua/plenary.nvim' + use 'hrsh7th/nvim-cmp' + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/cmp-buffer' + use 'hrsh7th/cmp-path' + use 'hrsh7th/cmp-cmdline' + use 'hrsh7th/cmp-vsnip' + use 'hrsh7th/vim-vsnip' + use 'farmergreg/vim-lastplace' + use {'akinsho/bufferline.nvim', tag = 'v3.*', requires = 'nvim-tree/nvim-web-devicons'} + use 'gen740/SmoothCursor.nvim' + use 'gennaro-tedesco/nvim-peekup' + use 'gelguy/wilder.nvim' + use 'bluz71/vim-nightfly-colors' + use 'catppuccin/nvim' + use 'nyoom-engineering/oxocarbon.nvim' + use 'folke/which-key.nvim' + use 'mbbill/undotree' + use 'startup-nvim/startup.nvim' + use 'jiangmiao/auto-pairs' + use 'nvim-treesitter/nvim-treesitter' + use 'akinsho/toggleterm.nvim' + + if packer_bootstrap then + require('packer').sync() + end +end) + + diff --git a/lua/config/smoothcursor.lua b/lua/config/smoothcursor.lua new file mode 100644 index 0000000..9c8927e --- /dev/null +++ b/lua/config/smoothcursor.lua @@ -0,0 +1,30 @@ +require('smoothcursor').setup({ + autostart = true, + cursor = "", -- cursor shape (need nerd font) + texthl = "SmoothCursor", -- highlight group, default is { bg = nil, fg = "#FFD400" } + linehl = nil, -- highlight sub-cursor line like 'cursorline', "CursorLine" recommended + type = "default", -- define cursor movement calculate function, "default" or "exp" (exponential). + fancy = { + enable = false, -- enable fancy mode + head = { cursor = "▷", texthl = "SmoothCursor", linehl = nil }, + body = { + { cursor = "", texthl = "SmoothCursorRed" }, + { cursor = "", texthl = "SmoothCursorOrange" }, + { cursor = "●", texthl = "SmoothCursorYellow" }, + { cursor = "●", texthl = "SmoothCursorGreen" }, + { cursor = "•", texthl = "SmoothCursorAqua" }, + { cursor = ".", texthl = "SmoothCursorBlue" }, + { cursor = ".", texthl = "SmoothCursorPurple" }, + }, + tail = { cursor = nil, texthl = "SmoothCursor" } + }, + flyin_effect = nil, -- "bottom" or "top" + speed = 25, -- max is 100 to stick to your current position + intervals = 35, -- tick interval + priority = 10, -- set marker priority + timeout = 3000, -- timout for animation + threshold = 3, -- animate if threshold lines jump + disable_float_win = false, -- disable on float window + enabled_filetypes = nil, -- example: { "lua", "vim" } + disabled_filetypes = nil, -- this option will be skipped if enabled_filetypes is set. example: { "TelescopePrompt", "NvimTree" } +}) diff --git a/lua/config/whichkey.lua b/lua/config/whichkey.lua new file mode 100644 index 0000000..2fb572f --- /dev/null +++ b/lua/config/whichkey.lua @@ -0,0 +1,64 @@ +local M = {} + +function M.setup() + local whichkey = require "which-key" + + local conf = { + window = { + border = "single", -- none, single, double, shadow + position = "bottom", -- bottom, top + }, + } + + local opts = { + mode = {"n", "v"}, -- Normal mode + prefix = " ", + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = true, -- use `nowait` when creating keymaps + } + + local mappings = { + --["w"] = { "<cmd>update!<CR>", "Save" }, + ["f"] = { "<cmd>Neotree<CR>", "fs"}, + ["t"] = { "<cmd>UndotreeToggle<CR>", "clip tree"}, + ["e"] = { "<cmd>TroubleToggle<CR>", "errors" }, + ["g"] = { + name = "'games'", + ["q"] = { "<cmd>KillKillKill<CR>", "killer sheep" }, + ["w"] = { "<cmd>Nvimesweeper<CR>", "minesweeper" }, + ["e"] = { "<cmd>CellularAutomaton make_it_rain<CR>", "c_a make it rain" }, + ["r"] = { "<cmd>CellularAutomaton game_of_life<CR>", "c_a conway gol" }, + ["t"] = { "<cmd>Tetris<CR>", "tetris" }, + ["y"] = { "<cmd>ShenzhenSolitaireNewGame<CR>", "solitaire" }, + ["u"] = { "<cmd>BlackJackNewGame<CR>", "blackjack" }, + ["i"] = { "<cmd>lua require('sudoku').setup{}<CR><cmd>Sudoku<CR>", "sudoku" }, + }, + ["n"] = { + name = "sci", + ["i"] = { "<cmd>lua require('nabla').toggle_virt({autogen=true})<CR>", "toggle" }, + }, + ["q"] = { + name = "quick chords", + ["l"] = { "0v$", "line" }, + ["s"] = { "\"+y", "system grab" }, + }, + ["z"] = { + name = "packer", + c = { "<cmd>PackerCompile<cr>", "compile" }, + i = { "<cmd>PackerInstall<cr>", "install" }, + s = { "<cmd>PackerSync<cr>", "sync" }, + S = { "<cmd>PackerStatus<cr>", "status" }, + u = { "<cmd>PackerUpdate<cr>", "update" }, + }, + + } + + whichkey.setup(conf) + whichkey.register(mappings, opts) +end + +return M + + diff --git a/lua/keybinds.lua b/lua/keybinds.lua new file mode 100644 index 0000000..dc82a08 --- /dev/null +++ b/lua/keybinds.lua @@ -0,0 +1,20 @@ +vim.opt.whichwrap:append { + ['<'] = true, + ['>'] = true, + ['['] = true, + [']'] = true, + h = true, + l = true, +} +vim.keymap.set('n', '<c-k>', '<cmd>:wincmd k<CR>',m_opts) +vim.keymap.set('n', '<c-j>', '<cmd>:wincmd j<CR>',m_opts) +vim.keymap.set('n', '<c-h>', '<cmd>:wincmd h<CR>',m_opts) +vim.keymap.set('n', '<c-l>', '<cmd>:wincmd l<CR>',m_opts) + + +vim.keymap.set('n', '<S-Tab>', '<cmd>:bnext<CR>',m_opts) +vim.keymap.set('n', '<S-Tab>', '<cmd>:bprev<CR>',m_opts) +vim.keymap.set('n', '<S-q>', '<cmd>:bprev<CR>:bd #<CR>',m_opts) +vim.keymap.set('n', '<c-y>', vim.cmd.UndotreeToggle) + + diff --git a/lua/lsp.lua b/lua/lsp.lua new file mode 100644 index 0000000..8cc2902 --- /dev/null +++ b/lua/lsp.lua @@ -0,0 +1,130 @@ +require('mason').setup() +--require('mason-lspconfig').setup() +local lspconfig = require('lspconfig') +lspconfig.pyright.setup {} +lspconfig.eslint.setup{} +lspconfig.clangd.setup{ + capabilities = { offsetEncoding = 'utf-8' }, -- = capabilities +} +lspconfig.zls.setup {} +lspconfig.lua_ls.setup {} +--[[ +require('clangd_extensions').setup{ + server = { + capabilities = { offsetEncoding = 'utf-8' }, -- = capabilities + }, + extensions = { + inlay_hints = { + show_parameter_hints = false, + }, + }, +} +--]] +local null_ls = require('null-ls') + +null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + --null_ls.builtins.diagnostics.eslint, + --null_ls.builtins.completion.spell, + --null_ls.builtins.diagnostics.codespell, + --null_ls.builtins.diagnostics.clang_check, + }, +}) + +require('illuminate').configure({ + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + delay = 100, + filetype_overrides = {}, + filetypes_denylist = { + 'dirvish', + 'fugitive', + }, + filetypes_allowlist = {}, + modes_denylist = {}, + modes_allowlist = {}, + providers_regex_syntax_denylist = {}, + providers_regex_syntax_allowlist = {}, + under_cursor = true, + large_file_cutoff = nil, + large_file_overrides = nil, + min_count_to_highlight = 1, +}) + +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { 'c', 'lua', 'cpp', 'python', 'java', 'javascript'}, + + sync_install = false, + + auto_install = true, + + highlight = { + enable = true, + + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + additional_vim_regex_highlighting = false, + + }, + rainbow = { + enable = true, + extented_mod = true, + colors = { + '#74d7ec', '#96cde2', '#b9c3d9', '#dcb9d0', '#ffafc7', '#ffafc7', '#fec1d2', '#fdd4de', '#fce6e9', '#fbf9f5', '#fbf9f5', '#fce8ea', '#fdd7e0', '#fec6d5', '#ffb5cb', '#ffb5cb', '#dcbdd2', '#b9c5da', '#96cde2', '#73d5ea' + }, + }, +} +local cmp = require'cmp' + + cmp.setup({ + --[[ + sorting = { + comparators = { + require('clangd_extensions.cmp_scores'), + }, + }, + --]] + snippet = { + expand = function(args) + vim.fn['vsnip#anonymous'](args.body) -- For `vsnip` users. + -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + -- { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, { + { name = 'buffer' }, + }) + }) + + + +require 'lsp_signature'.setup() diff --git a/lua/opt.lua b/lua/opt.lua new file mode 100644 index 0000000..6e0e75f --- /dev/null +++ b/lua/opt.lua @@ -0,0 +1,99 @@ +local wilder = require('wilder') +wilder.setup({modes = {':', '/', '?'}}) +require('bufferline').setup{} +require('smoothcursor').setup() +require('config.whichkey').setup() +require('startup').setup({theme = 'evil'}) +require('gitsigns').setup() +--require("nvim-tree").setup() +require("todo-comments").setup{} +require('toggleterm').setup({ + direction = 'float', + close_on_exit = true, + active = true, + insert_mappings = true, + start_in_insert = true, + terminal_mappings = true, + open_mapping = [[<c-\>]], +}) +require('neo-tree').setup({ + close_if_last_window = true, + default_component_configs = { + name = { + --use_git_status_colors = false, + }, + git_status = { + symbols = { + added = '+', + modified = '~', + deleted = 'x', + renamed = '->', + + untracked = ' ', + ignored = ' ', + unstaged = '!', + staged = ' ', + conflict = ':(', + }, + }, +}, + window = { + position = "left", + width = 30, + }, + filesystem = { + use_libuv_file_watcher = true, + }, +}) +require('flit').setup { + keys = { f = 'f', F = 'F', t = 't', T = 'T' }, + labeled_modes = 'v', + multiline = true, + opts = {} +} + +local chadtree_settings = { ['view.width'] = 31 } +local gradient = { + '#74d7ec', '#96cde2', '#b9c3d9', '#dcb9d0', '#ffafc7', '#ffafc7', '#fec1d2', '#fdd4de', '#fce6e9', '#fbf9f5', '#fbf9f5', '#fce8ea', '#fdd7e0', '#fec6d5', '#ffb5cb', '#ffb5cb', '#dcbdd2', '#b9c5da', '#96cde2', '#73d5ea' +} + +vim.api.nvim_set_var('chadtree_settings', chadtree_settings) +vim.notify = require('notify') +vim.opt.linebreak=false +vim.opt.wrap=false +vim.opt.tabstop=2 +vim.opt.termguicolors = true +vim.opt.number = true +vim.cmd('colorscheme oxocarbon') +vim.opt.shiftwidth = 2 +vim.opt.tabstop = 2 +vim.o.undofile = true +vim.o.timeout = true +vim.o.timeoutlen = 300 + +if vim.fn.has('persistent_undo') == 1 then + local target_path = vim.fn.expand('~/.undodir') + if vim.fn.isdirectory(target_path) ~= 1 then + vim.fn.mkdir(target_path, "p", 0777) + end + + vim.o.undodir = target_path + vim.o.undofile = true +end + +for i, fg in ipairs(gradient) do + gradient[i] = wilder.make_hl('WilderGradient' .. i, 'Pmenu', {{a = 1}, {a = 1}, {foreground = fg}}) +end + +wilder.set_option('renderer', wilder.wildmenu_renderer({ + + separator = ' · ', + left = {' '}, + right = {' ', wilder.wildmenu_index()}, + highlights = { + gradient = gradient, + }, + highlighter = wilder.highlighter_with_gradient({ + wilder.basic_highlighter(), + }), +})) diff --git a/lua/speed.lua b/lua/speed.lua new file mode 100644 index 0000000..9a6b5d8 --- /dev/null +++ b/lua/speed.lua @@ -0,0 +1,11 @@ +_G.__luacache_config = { + chunks = { + enable = true, + path = vim.fn.stdpath('cache')..'/luacache_chunks', + }, + modpaths = { + enable = true, + path = vim.fn.stdpath('cache')..'/luacache_modpaths', + } +} +require('impatient') diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..6dfed9f --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +my neovim config:3 + +use `NVIM_DEBUG=1 nvim +PackerInstall` |