diff options
Diffstat (limited to 'lua')
| -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 | 
6 files changed, 354 insertions, 0 deletions
| 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') | 
