feat!: new config
inspired by https://github.com/BijanVeyssi/nvim-config
This commit is contained in:
		
							parent
							
								
									d50d533dd9
								
							
						
					
					
						commit
						d79e2d5ecb
					
				
							
								
								
									
										10
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								init.lua
									
									
									
									
									
								
							| @ -1,14 +1,14 @@ | ||||
| require 'config.lazy' | ||||
| require 'config.autocmd' | ||||
| require 'config.autocmds' | ||||
| require 'config.mappings' | ||||
| require 'config.options' | ||||
| require 'config.lazy' | ||||
| 
 | ||||
| vim.api.nvim_create_autocmd('User', { | ||||
| 	pattern = 'LazyVimStarted', | ||||
| 	callback = function() | ||||
| 		vim.cmd 'colorscheme neogruber' | ||||
| 		require 'config.mappings' | ||||
| 		vim.cmd 'colorscheme gruber-darker' | ||||
| 		require 'feline' | ||||
| 		require 'dressing' | ||||
| 		-- require 'dressing' | ||||
| 		require 'NeoSwap' | ||||
| 	end, | ||||
| }) | ||||
|  | ||||
| @ -1,3 +1,33 @@ | ||||
| local function augroup(name) | ||||
|     return vim.api.nvim_create_augroup("my_" .. name, { clear = false }) | ||||
| end | ||||
| 
 | ||||
| vim.api.nvim_create_autocmd( | ||||
|     { "BufEnter", "FocusGained", "InsertLeave", "WinEnter", "CmdlineLeave" }, | ||||
|     { | ||||
|         group = augroup("toggle_relative_number"), | ||||
|         callback = function() | ||||
|             if not vim.opt.number:get() and not vim.opt.relativenumber:get() then | ||||
|                 return | ||||
|             end | ||||
|             vim.opt.relativenumber = vim.api.nvim_get_mode().mode ~= "i" | ||||
|         end, | ||||
|     } | ||||
| ) | ||||
| 
 | ||||
| vim.api.nvim_create_autocmd( | ||||
|     { "BufLeave", "FocusLost", "InsertEnter", "WinLeave", "CmdlineEnter" }, | ||||
|     { | ||||
|         group = augroup("toggle_relative_number"), | ||||
|         callback = function(ev) | ||||
|             vim.opt.relativenumber = false | ||||
|             if ev.event == "CmdlineEnter" then | ||||
|                 vim.cmd("redraw") | ||||
|             end | ||||
|         end, | ||||
|     } | ||||
| ) | ||||
| 
 | ||||
| -- close some filetypes with <q> | ||||
| vim.api.nvim_create_autocmd({ 'FileType' }, { | ||||
| 	pattern = { 'qf', 'help', 'man', 'lspinfo', 'spectre_panel', 'lir' }, | ||||
| @ -41,15 +71,6 @@ vim.api.nvim_create_autocmd('FileType', { | ||||
| 	end, | ||||
| }) | ||||
| 
 | ||||
| function _G.set_terminal_keymaps() | ||||
| 	local opts = { buffer = 0 } | ||||
| 	vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts) | ||||
| 	vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts) | ||||
| end | ||||
| 
 | ||||
| -- if you only want these mappings for toggle term use term://*toggleterm#* instead | ||||
| vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') | ||||
| 
 | ||||
| -- go to last loc when opening a buffer | ||||
| vim.api.nvim_create_autocmd("BufReadPost", { | ||||
| 	callback = function(event) | ||||
| @ -75,8 +96,8 @@ vim.cmd [[ | ||||
| ]] | ||||
| 
 | ||||
| -- Fixes Autocomment | ||||
| vim.api.nvim_create_autocmd({ 'BufWinEnter' }, { | ||||
| 	callback = function() | ||||
| 		vim.cmd 'set formatoptions-=cro' | ||||
| 	end, | ||||
| }) | ||||
| -- vim.api.nvim_create_autocmd({ 'BufWinEnter' }, { | ||||
| -- 	callback = function() | ||||
| -- 		vim.cmd 'set formatoptions-=cro' | ||||
| -- 	end, | ||||
| -- }) | ||||
| @ -23,51 +23,13 @@ vnoremap M :m '>+1<CR>gv=gv | ||||
| vnoremap L :m '<-2<CR>gv=gv | ||||
| imap <c-s> <Esc>[s1z=`]a | ||||
| ]]) | ||||
| 
 | ||||
| keymap('n', 'Y', '"+y', opt) | ||||
| keymap('v', 'Y', '"+y', opt) | ||||
| keymap('n', '<c-p>', '"+p', opt) | ||||
| keymap('v', '<c-p>', '"+p', opt) | ||||
| -- }}} | ||||
| -- open/close folds with enter key {{{ | ||||
| keymap('n', '<cr>', "@=(foldlevel('.')?'za':\"<Space>\")<CR>", opt) | ||||
| -- }}} | ||||
| -- terminal {{{ | ||||
| keymap('n', '<home>', '<cmd>ToggleTerm direction=horizontal<cr>', opt) | ||||
| keymap('t', '<home>', '<cmd>ToggleTerm direction=horizontal<cr>', opt) | ||||
| keymap('v', '<home>', '<cmd>ToggleTerm direction=horizontal<cr>', opt) | ||||
| keymap('i', '<home>', '<cmd>ToggleTerm direction=horizontal<cr>', opt) | ||||
| keymap('n', '<end>', '<cmd>ToggleTerm direction=float<cr>', opt) | ||||
| keymap('t', '<end>', '<cmd>ToggleTerm direction=float<cr>', opt) | ||||
| keymap('v', '<end>', '<cmd>ToggleTerm direction=float<cr>', opt) | ||||
| keymap('i', '<end>', '<cmd>ToggleTerm direction=float<cr>', opt) | ||||
| -- }}} | ||||
| 
 | ||||
| keymap('n', '<BS>', ':', { noremap = true }) | ||||
| keymap('n', ';', ':', { noremap = true }) | ||||
| 
 | ||||
| keymap('n', 'D', '"_d', { noremap = true }) | ||||
| 
 | ||||
| keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opt) | ||||
| keymap('n', 'gd', '<cmd>TroubleToggle lsp_definitions<CR>', opt) | ||||
| keymap('n', 'gr', '<cmd>TroubleToggle lsp_references<CR>', opt) | ||||
| keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.hover()<CR>', opt) | ||||
| keymap('n', 'gI', '<cmd>TroubleToggle lsp_implementations<CR>', opt) | ||||
| keymap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<CR>', opt) | ||||
| keymap('n', '<leader>lf', '<cmd>lua vim.lsp.buf.format { async = true }<cr>', opt) | ||||
| keymap('n', '<leader>li', '<cmd>LspInfo<cr>', opt) | ||||
| keymap('n', '<leader>lI', '<cmd>LspInstallInfo<cr>', opt) | ||||
| keymap('n', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<cr>', opt) | ||||
| keymap('n', '<leader>lj', '<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>', opt) | ||||
| keymap('n', '<leader>lk', '<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>', opt) | ||||
| keymap('n', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<cr>', opt) | ||||
| keymap('n', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opt) | ||||
| keymap('n', '<leader>lq', '<cmd>lua vim.diagnostic.setloclist()<CR>', opt) | ||||
| keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opt) | ||||
| 
 | ||||
| -- search and replace {{{ | ||||
| keymap('n', '<leader>rs', ':s///gI<Left><Left><Left><Left><Left><Left>', { noremap = true }) | ||||
| keymap('n', '<leader>rr', ':%s///gI<Left><Left><Left><Left>', { noremap = true }) | ||||
| keymap('v', '<leader>r', ':s///gI<Left><Left><Left><Left>', { noremap = true }) | ||||
| -- }}} | ||||
| 
 | ||||
| function MapDHM() | ||||
| 	keymap('n', 'i', 'l', { noremap = true }) | ||||
| @ -109,206 +71,3 @@ end | ||||
| if file_exists('/tmp/colemak') then | ||||
| 	MapDHM() | ||||
| end | ||||
| 
 | ||||
| local wk = require 'which-key' | ||||
| 
 | ||||
| -- which-key {{{ | ||||
| wk.setup { | ||||
| 	plugins = { | ||||
| 		marks = true, -- shows a list of your marks on ' and ` | ||||
| 		registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode | ||||
| 		-- the presets plugin, adds help for a bunch of default keybindings in Neovim | ||||
| 		-- No actual key bindings are created | ||||
| 		presets = { | ||||
| 			operators = true, -- adds help for operators like d, y, ... | ||||
| 			motions = true, -- adds help for motions | ||||
| 			text_objects = false, -- help for text objects triggered after entering an operator | ||||
| 			windows = true, -- default bindings on <c-w> | ||||
| 			nav = true, -- misc bindings to work with windows | ||||
| 			z = true, -- bindings for folds, spelling and others prefixed with z | ||||
| 			g = true, -- bindings for prefixed with g | ||||
| 		}, | ||||
| 	}, | ||||
| 	icons = { | ||||
| 		breadcrumb = '»', -- symbol used in the command line area that shows your active key combo | ||||
| 		separator = '➜ ', -- symbol used between a key and it's label | ||||
| 		group = '+', -- symbol prepended to a group | ||||
| 	}, | ||||
| 	window = { | ||||
| 		border = 'none', -- none, single, double, shadow | ||||
| 		position = 'bottom', -- bottom, top | ||||
| 		margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] | ||||
| 		padding = { 1, 1, 1, 1 }, -- extra window padding [top, right, bottom, left] | ||||
| 	}, | ||||
| 	layout = { | ||||
| 		height = { min = 4, max = 25 },                                -- min and max height of the columns | ||||
| 		width = { min = 20, max = 50 },                                -- min and max width of the columns | ||||
| 		spacing = 3,                                                   -- spacing between columns | ||||
| 	}, | ||||
| 	hidden = { '<silent>', '<cmd>', '<Cmd>', '<CR>', 'call', 'lua', '^:', '^ ' }, -- hide mapping boilerplate | ||||
| 	show_help = true,                                                      -- show help message on the command line when the popup is visible | ||||
| } | ||||
| 
 | ||||
| local opts = { | ||||
| 	mode = 'n', -- NORMAL mode | ||||
| 	prefix = '<leader>', | ||||
| 	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 = false, -- use `nowait` when creating keymaps | ||||
| } | ||||
| 
 | ||||
| --[[ vim.keymap.set('n', 'L', function() | ||||
| 	local win = vim.api.nvim_get_current_win() | ||||
| 	local qf_winid = vim.fn.getloclist(win, { winid = 0 }).winid | ||||
| 	local action = qf_winid > 0 and 'lclose' or 'lopen' | ||||
| 	vim.cmd(action) | ||||
| end, { noremap = true, silent = true }) | ||||
| 
 | ||||
| vim.keymap.set('n', 'X', function() | ||||
| 	local qf_winid = vim.fn.getqflist({ winid = 0 }).winid | ||||
| 	local action = qf_winid > 0 and 'cclose' or 'copen' | ||||
| 	vim.cmd('botright ' .. action) | ||||
| end, { noremap = true, silent = true }) ]] | ||||
| -- }}} | ||||
| -- leader mappings {{{ | ||||
| local mappings = { | ||||
| 	['<leader>'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').toggle_quick_menu() | ||||
| 		end, | ||||
| 		'Buffers', | ||||
| 	}, | ||||
| 	['s'] = { '<cmd>ASToggle<cr>', 'Auto Save toggle' }, | ||||
| 	['D'] = { '<cmd>Dashboard<cr>', 'Dashboard' }, | ||||
| 	['.'] = { '<cmd>Oil<cr>', 'Oil' }, | ||||
| 	['f'] = { '<cmd>e ~/.config/nvim/ <cr>', 'Neovim config' }, | ||||
| 	['rr'] = 'Search and replace all', | ||||
| 	['rs'] = 'Search and replace', | ||||
| 	['q'] = { '<cmd>lua UnMapDHM()<cr>', 'Qwerty' }, | ||||
| 	['k'] = { '<cmd>bd<cr>', 'Delete buffer' }, | ||||
| 	['b'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').toggle_quick_menu() | ||||
| 		end, | ||||
| 		'List buffers', | ||||
| 	}, | ||||
| 	['n'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').nav_next() | ||||
| 		end, | ||||
| 		'Next buffer', | ||||
| 	}, | ||||
| 	['p'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').nav_prev() | ||||
| 		end, | ||||
| 		'Previous buffer', | ||||
| 	}, | ||||
| 	['h'] = { '<cmd>TSBufToggle highlight<cr>', 'Enable TS highlight' }, | ||||
| 	['1'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').nav_file(1) | ||||
| 		end, | ||||
| 		'Buffer 1', | ||||
| 	}, | ||||
| 	['2'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').nav_file(2) | ||||
| 		end, | ||||
| 		'Buffer 2', | ||||
| 	}, | ||||
| 	['3'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').nav_file(3) | ||||
| 		end, | ||||
| 		'Buffer 3', | ||||
| 	}, | ||||
| 	['4'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').nav_file(4) | ||||
| 		end, | ||||
| 		'Buffer 4', | ||||
| 	}, | ||||
| 	['5'] = { | ||||
| 		function() | ||||
| 			require('buffer_manager.ui').nav_file(5) | ||||
| 		end, | ||||
| 		'Buffer 5', | ||||
| 	}, | ||||
| 	['g'] = { '<cmd>Neogit<cr>', 'Neogit' }, | ||||
| 	d = { | ||||
| 		S = { '<cmd>Lazy load nvim-gdb <cr>', 'Load GDB' }, | ||||
| 		b = { "<cmd>DapToggleBreakpoint<cr>", "Toggle Breakpoint" }, | ||||
| 		c = { "<cmd>DapContinue<cr>", "Continue" }, | ||||
| 		n = { "<cmd>DapStepOver<cr>", "Step Over" }, | ||||
| 		i = { "<cmd>DapStepInto<cr>", "Step Into" }, | ||||
| 		o = { "<cmd>DapStepOut<cr>", "Step Out" }, | ||||
| 		d = { | ||||
| 			function() | ||||
| 				require("dapui").toggle() | ||||
| 			end, | ||||
| 			"Toggle DAP UI" }, | ||||
| 		s = { | ||||
| 			function() | ||||
| 				require("dapui").float_element("scopes", _) | ||||
| 			end, | ||||
| 			"Scopes" | ||||
| 		}, | ||||
| 		r = { | ||||
| 			function() | ||||
| 				require("dapui").float_element("repl", _) | ||||
| 			end, | ||||
| 			"REPL" | ||||
| 		}, | ||||
| 		C = { | ||||
| 			function() | ||||
| 				require("dapui").float_element("console", _) | ||||
| 			end, | ||||
| 			"Console" | ||||
| 		}, | ||||
| 	}, | ||||
| 	l = { | ||||
| 		name = 'LSP', | ||||
| 		l = { '<cmd>Lazy load none-ls.nvim lsp <bar> LspStart <cr>', 'Start LSP' }, | ||||
| 		f = { '<cmd>lua vim.lsp.buf.format { async = true }<cr>', 'Format' }, | ||||
| 		i = 'Lsp Info', | ||||
| 		a = 'Code action', | ||||
| 		j = 'Next diagnostic', | ||||
| 		k = 'Prev diagnostic', | ||||
| 		r = 'Rename', | ||||
| 		s = 'Signature Help', | ||||
| 		q = 'Set LocList', | ||||
| 	}, | ||||
| 	['<TAB>'] = { | ||||
| 		name = 'Tab', | ||||
| 		n = { '<cmd>tabnew<cr>', 'New' }, | ||||
| 		p = { '<cmd>tabp<cr>', 'Previous' }, | ||||
| 		d = { '<cmd>tabclose<cr>', 'Close' }, | ||||
| 		['<TAB>'] = { '<cmd>tabnext<cr>', 'Next' }, | ||||
| 		['1'] = { '1gt', 'Go to tab 1' }, | ||||
| 		['2'] = { '2gt', 'Go to tab 2' }, | ||||
| 		['3'] = { '3gt', 'Go to tab 3' }, | ||||
| 		['4'] = { '4gt', 'Go to tab 4' }, | ||||
| 		['5'] = { '5gt', 'Go to tab 5' }, | ||||
| 		['6'] = { '6gt', 'Go to tab 6' }, | ||||
| 		['7'] = { '7gt', 'Go to tab 7' }, | ||||
| 		['8'] = { '8gt', 'Go to tab 8' }, | ||||
| 		['9'] = { '9gt', 'Go to tab 9' }, | ||||
| 	}, | ||||
| 	w = { | ||||
| 		name = 'Window', | ||||
| 		v = { '<C-w>v', 'Vertical split' }, | ||||
| 		h = { '<C-w>s', 'Horizontal split' }, | ||||
| 	}, | ||||
| 	x = { | ||||
| 		name = 'Trouble', | ||||
| 		l = { '<cmd>TroubleToggle loclist<cr>', 'Loclist' }, | ||||
| 		q = { '<cmd>TroubleToggle quickfix<cr>', 'Quickfix' }, | ||||
| 		x = { '<cmd>TroubleToggle<cr>', 'Toggle' }, | ||||
| 		w = { '<cmd>TroubleToggle workspace_diagnostics<cr>', 'Workspace' }, | ||||
| 		d = { '<cmd>TroubleToggle document_diagnostics<cr>', 'Document' }, | ||||
| 	}, | ||||
| } | ||||
| -- }}} | ||||
| wk.register(mappings, opts) | ||||
|  | ||||
| @ -57,9 +57,14 @@ opt.fillchars = 'eob: ' | ||||
| opt.cmdheight = 1 | ||||
| opt.grepprg = 'rg --vimgrep --no-heading --smart-case --hidden' | ||||
| opt.grepformat = '%f:%l:%c:%m' | ||||
| opt.completeopt= 'menu,preview,menuone,noselect' | ||||
| opt.cursorline = true | ||||
| opt.cursorlineopt = 'number' | ||||
| opt.signcolumn = "yes:1" | ||||
| -- opt.cursorlineopt = 'number' | ||||
| vim.opt.formatoptions:remove("c") | ||||
| 
 | ||||
| vim.api.nvim_create_user_command('Cd', 'lcd %:p:h', { nargs = 0 }) | ||||
| vim.api.nvim_create_user_command('Grep', 'silent grep! <args> | TroubleToggle quickfix', { nargs = '+' }) | ||||
| vim.cmd([[ | ||||
| hi NotifyBackground guibg = #000000 | ||||
| ]]) | ||||
|  | ||||
| @ -1,30 +0,0 @@ | ||||
| return { | ||||
| 	'okuuva/auto-save.nvim', | ||||
| 	cmd = 'ASToggle', | ||||
| 	opts = { | ||||
| 		enabled = false, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it) | ||||
| 		execution_message = { | ||||
| 			enabled = true, | ||||
| 			message = function() -- message to print on save | ||||
| 				return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S")) | ||||
| 			end, | ||||
| 			dim = 0.18,               -- dim the color of `message` | ||||
| 			cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea | ||||
| 		}, | ||||
| 		trigger_events = {                -- See :h events | ||||
| 			immediate_save = { "BufLeave", "FocusLost" }, -- vim events that trigger an immediate save | ||||
| 			defer_save = { "InsertLeave", "TextChanged" }, -- vim events that trigger a deferred save (saves after `debounce_delay`) | ||||
| 			cancel_defered_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save | ||||
| 		}, | ||||
| 		-- function that takes the buffer handle and determines whether to save the current buffer or not | ||||
| 		-- return true: if buffer is ok to be saved | ||||
| 		-- return false: if it's not ok to be saved | ||||
| 		-- if set to `nil` then no specific condition is applied | ||||
| 		condition = nil, | ||||
| 		write_all_buffers = false, -- write all buffers when the current one meets `condition` | ||||
| 		noautocmd = false, -- do not execute autocmds when saving | ||||
| 		debounce_delay = 100, -- delay after which a pending save is executed | ||||
| 		-- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable | ||||
| 		debug = false, | ||||
| 	} | ||||
| } | ||||
| @ -1,5 +1,10 @@ | ||||
| return { | ||||
| 	'j-morano/buffer_manager.nvim', | ||||
| 	keys = { | ||||
| 		{ '<leader><leader>', "<cmd> lua require('buffer_manager.ui').toggle_quick_menu()<cr>", desc = 'buffers' }, | ||||
| 		{ 'gn', "<cmd> lua require('buffer_manager.ui').nav_next()<cr>", desc = 'next buffer' }, | ||||
| 		{ 'gp', "<cmd> lua require('buffer_manager.ui').nav_prev()<cr>", desc = 'next buffer' }, | ||||
| 	}, | ||||
| 	opts = { | ||||
| 		-- line_keys = '', -- deactivate line keybindings | ||||
| 
 | ||||
| @ -20,6 +25,6 @@ return { | ||||
| 			}, | ||||
| 		}, | ||||
| 		width = 0.6, | ||||
| 		highlight = "Normal:Normal", | ||||
| 		highlight = 'Normal:Normal', | ||||
| 	}, | ||||
| } | ||||
|  | ||||
| @ -1,142 +1,108 @@ | ||||
| return { | ||||
| 	'hrsh7th/nvim-cmp', | ||||
| 	-- lazy = false, | ||||
| 	dependencies = { | ||||
| 		{ 'honza/vim-snippets' }, | ||||
| 		{ 'dcampos/nvim-snippy' }, | ||||
| 		{ 'dcampos/cmp-snippy' }, | ||||
| 		'hrsh7th/cmp-nvim-lsp', | ||||
| 		'hrsh7th/cmp-buffer', | ||||
| 		'hrsh7th/cmp-cmdline', | ||||
| 		'hrsh7th/cmp-path', | ||||
| 		'windwp/nvim-autopairs', | ||||
| 		'hrsh7th/cmp-buffer', | ||||
| 		'hrsh7th/cmp-calc', | ||||
| 		'hrsh7th/cmp-cmdline', | ||||
| 		'hrsh7th/cmp-nvim-lsp-signature-help', | ||||
| 		'saadparwaiz1/cmp_luasnip', | ||||
| 		'onsails/lspkind.nvim', | ||||
| 	}, | ||||
| 	event = { 'InsertEnter', 'CmdlineEnter' }, | ||||
| 	version = false, | ||||
| 	config = function() | ||||
| 		local cmp = require 'cmp' | ||||
| 		local utils = require 'config.utils' | ||||
| 		local lspkind = require 'lspkind' | ||||
| 
 | ||||
| 		cmp.setup { | ||||
| 			-- enabled = function() | ||||
| 			-- 	return vim.api.nvim_buf_get_option(0, 'buftype') ~= 'prompt' or require('cmp_dap').is_dap_buffer() | ||||
| 			-- end, | ||||
| 			snippet = { | ||||
| 				expand = function(args) | ||||
| 					require('luasnip').lsp_expand(args.body) | ||||
| 				end, | ||||
| 			}, | ||||
| 			view = { | ||||
| 				entries = { | ||||
| 					name = 'custom', -- can be "custom", "wildmenu" or "native" | ||||
| 					-- separator = ' | ', | ||||
| 					selection_order = 'near_cursor', | ||||
| 				}, | ||||
| 			}, | ||||
| 			completion = { | ||||
| 				-- autocomplete = { 'TextChanged', 'CmdlineChanged', 'TextChangedP' }, | ||||
| 				autocomplete = false, | ||||
| 			}, | ||||
| 			snippet = { | ||||
| 				expand = function(args) | ||||
| 					require('snippy').expand_snippet(args.body) | ||||
| 				end, | ||||
| 			}, | ||||
| 			-- completion = { | ||||
| 			-- 	autocomplete = { 'TextChanged', 'CmdlineChanged', 'TextChangedP' }, | ||||
| 			-- 	-- autocomplete = false, | ||||
| 			-- }, | ||||
| 			window = { | ||||
| 				completion = cmp.config.window.bordered(), | ||||
| 				documentation = cmp.config.window.bordered(), | ||||
| 			}, | ||||
| 			experimental = { | ||||
| 				ghost_text = true, | ||||
| 			}, | ||||
| 			formatting = { | ||||
| 				fields = { 'abbr', 'kind', 'menu' }, | ||||
| 				format = function(_, item) | ||||
| 					local ELLIPSIS_CHAR = '…' | ||||
| 					local MAX_LABEL_WIDTH = 25 | ||||
| 					item.kind = string.format('%s', item.kind) -- This concatonates the icons with the name of the item kind | ||||
| 
 | ||||
| 					local label = item.abbr | ||||
| 					local truncated_label = vim.fn.strcharpart(label, 0, MAX_LABEL_WIDTH) | ||||
| 					if truncated_label ~= label then | ||||
| 						item.abbr = truncated_label .. ELLIPSIS_CHAR | ||||
| 					end | ||||
| 					return item | ||||
| 				end, | ||||
| 			}, | ||||
| 			mapping = { | ||||
| 				['<C-k>'] = cmp.mapping.select_prev_item(), | ||||
| 				['<C-j>'] = cmp.mapping.select_next_item(), | ||||
| 				['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), | ||||
| 				['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), | ||||
| 				['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), | ||||
| 				['<C-e>'] = cmp.mapping { | ||||
| 					i = cmp.mapping.abort(), | ||||
| 					c = cmp.mapping.close(), | ||||
| 				ghost_text = { | ||||
| 					hl_group = { "Comment" }, | ||||
| 				}, | ||||
| 				['<CR>'] = cmp.mapping.confirm { select = true }, | ||||
| 			}, | ||||
| 			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(), | ||||
| 				['<Tab>'] = cmp.mapping(function(fallback) | ||||
| 					if cmp.visible() then | ||||
| 						cmp.select_next_item { behavior = cmp.SelectBehavior.Select } | ||||
| 					elseif require('snippy').can_expand_or_advance() then | ||||
| 						require('snippy').expand_or_advance() | ||||
| 					elseif utils.has_words_before() then | ||||
| 						cmp.complete() | ||||
| 						cmp.select_next_item() | ||||
| 					else | ||||
| 						fallback() | ||||
| 					end | ||||
| 				end, { 'i', 's' }), | ||||
| 
 | ||||
| 				['<S-Tab>'] = cmp.mapping(function(fallback) | ||||
| 					if cmp.visible() then | ||||
| 						cmp.select_prev_item { behavior = cmp.SelectBehavior.Insert } | ||||
| 					elseif require('snippy').can_jump(-1) then | ||||
| 						require('snippy').previous() | ||||
| 						cmp.select_prev_item() | ||||
| 					else | ||||
| 						fallback() | ||||
| 					end | ||||
| 				end, { 'i', 's' }), | ||||
| 				['<CR>'] = cmp.mapping.confirm { select = false }, | ||||
| 			}, | ||||
| 			sources = { | ||||
| 			sources = cmp.config.sources({ | ||||
| 				{ name = 'luasnip' }, | ||||
| 				{ name = 'nvim_lsp' }, | ||||
| 				{ name = 'nvim_lsp_signature_help' }, | ||||
| 			}, { | ||||
| 				{ name = 'path' }, | ||||
| 				{ name = 'snippy' }, | ||||
| 				{ name = 'calc' }, | ||||
| 				{ name = 'buffer' }, | ||||
| 			}), | ||||
| 			formatting = { | ||||
| 				format = require 'lspkind'.cmp_format({ | ||||
| 					mode = 'symbol_text', -- show only symbol annotations | ||||
| 					maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) | ||||
| 					-- can also be a function to dynamically calculate max width such as | ||||
| 					-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, | ||||
| 					ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) | ||||
| 					show_labelDetails = true, -- show labelDetails in menu. Disabled by default | ||||
| 
 | ||||
| 					-- The function below will be called before any actual modifications from lspkind | ||||
| 					-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) | ||||
| 					before = function(entry, vim_item) | ||||
| 						return vim_item | ||||
| 					end | ||||
| 				}) | ||||
| 			}, | ||||
| 		} | ||||
| 		cmp.setup.cmdline(':', { | ||||
| 			completion = { autocomplete = { 'TextChanged', 'CmdlineChanged', 'TextChanged' } }, | ||||
| 
 | ||||
| 		cmp.setup.cmdline({ '/', '?' }, { | ||||
| 			mapping = cmp.mapping.preset.cmdline(), | ||||
| 			sources = { | ||||
| 				{ name = 'cmdline' }, | ||||
| 				{ name = 'buffer' }, | ||||
| 			}, | ||||
| 			-- view = { | ||||
| 			-- 	entries = { name = 'wildmenu', separator = ' · ' }, | ||||
| 			-- }, | ||||
| 		}) | ||||
| 
 | ||||
| 		-- cmp.setup.cmdline('/', { | ||||
| 		-- 	sources = { | ||||
| 		-- 		{ name = 'buffer' }, | ||||
| 		-- 	}, | ||||
| 		-- view = { | ||||
| 		-- 	entries = { name = 'wildmenu', separator = ' · ' }, | ||||
| 		-- }, | ||||
| 		-- }) | ||||
| 
 | ||||
| 		-- cmp.setup.filetype({ 'dap-repl', 'dapui_watches', 'dapui_hover' }, { | ||||
| 		-- 	sources = { | ||||
| 		-- 		{ name = 'dap' }, | ||||
| 		-- 	}, | ||||
| 		-- }) | ||||
| 
 | ||||
| 		local npairs = require 'nvim-autopairs' | ||||
| 		npairs.setup { | ||||
| 			check_ts = true, -- treesitter integration | ||||
| 			fast_wrap = { | ||||
| 				map = '<C-e>', | ||||
| 				highlight = 'Search', | ||||
| 				highlight_grey = 'Comment', | ||||
| 			}, | ||||
| 			map_c_w = true, | ||||
| 			-- disable_filetype = { "TelescopePrompt" }, | ||||
| 		} | ||||
| 
 | ||||
| 		local cmp_autopairs = require 'nvim-autopairs.completion.cmp' | ||||
| 		cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done {}) | ||||
| 		cmp.setup.cmdline(':', { | ||||
| 			mapping = cmp.mapping.preset.cmdline(), | ||||
| 			sources = cmp.config.sources({ | ||||
| 				{ name = 'path' }, | ||||
| 			}, { | ||||
| 				{ name = 'cmdline' }, | ||||
| 			}), | ||||
| 		}) | ||||
| 	end, | ||||
| } | ||||
|  | ||||
| @ -42,8 +42,7 @@ return { | ||||
| 				if ctx.ctype == U.ctype.blockwise then | ||||
| 					location = require('ts_context_commentstring.utils').get_cursor_location() | ||||
| 				elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then | ||||
| 					location = require('ts_context_commentstring.utils') | ||||
| 					    .get_visual_start_location() | ||||
| 					location = require('ts_context_commentstring.utils').get_visual_start_location() | ||||
| 				end | ||||
| 
 | ||||
| 				return require('ts_context_commentstring.internal').calculate_commentstring { | ||||
|  | ||||
| @ -1,82 +1,118 @@ | ||||
| return { | ||||
| 	{ 'mfussenegger/nvim-dap', }, | ||||
| 	{ | ||||
| 		'mfussenegger/nvim-dap', | ||||
| 		keys = function() | ||||
| 			local function dap(name) | ||||
| 				return function() | ||||
| 					require('dap')[name]() | ||||
| 				end | ||||
| 			end | ||||
| 
 | ||||
| 			return { | ||||
| 				{ '<leader>dc', dap 'continue', desc = 'continue' }, | ||||
| 				{ '<leader>ds', dap 'step_into', desc = 'step into' }, | ||||
| 				{ '<leader>dn', dap 'step_over', desc = 'step over (next)' }, | ||||
| 				{ '<leader>df', dap 'step_out', desc = 'step out (finish)' }, | ||||
| 				{ '<leader>db', dap 'toggle_breakpoint', desc = 'toggle breakpoint' }, | ||||
| 				{ | ||||
| 					'<leader>do', | ||||
| 					function() | ||||
| 						vim.ui.input({ prompt = 'Condition: ' }, function(input) | ||||
| 							if input == nil then | ||||
| 								return | ||||
| 							end | ||||
| 							require('dap').set_breakpoint(input) | ||||
| 						end) | ||||
| 					end, | ||||
| 					desc = 'set conditional breakpoint', | ||||
| 				}, | ||||
| 				{ '<leader>dl', dap 'clear_breakpoints', desc = 'clear breakpoints' }, | ||||
| 				{ '<leader>dq', dap 'terminate', desc = 'quit' }, | ||||
| 			} | ||||
| 		end, | ||||
| 	}, | ||||
| 	{ | ||||
| 		'rcarriga/nvim-dap-ui', | ||||
| 		opts = { | ||||
| 			controls = { | ||||
| 				element = "repl", | ||||
| 				element = 'repl', | ||||
| 				enabled = true, | ||||
| 				icons = { | ||||
| 					disconnect = "", | ||||
| 					pause = "", | ||||
| 					play = "", | ||||
| 					run_last = "", | ||||
| 					step_back = "", | ||||
| 					step_into = "", | ||||
| 					step_out = "", | ||||
| 					step_over = "", | ||||
| 					terminate = "" | ||||
| 				} | ||||
| 					disconnect = '', | ||||
| 					pause = '', | ||||
| 					play = '', | ||||
| 					run_last = '', | ||||
| 					step_back = '', | ||||
| 					step_into = '', | ||||
| 					step_out = '', | ||||
| 					step_over = '', | ||||
| 					terminate = '', | ||||
| 				}, | ||||
| 			}, | ||||
| 			element_mappings = {}, | ||||
| 			expand_lines = true, | ||||
| 			floating = { | ||||
| 				border = "single", | ||||
| 				border = 'single', | ||||
| 				mappings = { | ||||
| 					close = { "q", "<Esc>" } | ||||
| 				} | ||||
| 					close = { 'q', '<Esc>' }, | ||||
| 				}, | ||||
| 			}, | ||||
| 			force_buffers = true, | ||||
| 			icons = { | ||||
| 				collapsed = "", | ||||
| 				current_frame = "", | ||||
| 				expanded = "" | ||||
| 				collapsed = '', | ||||
| 				current_frame = '', | ||||
| 				expanded = '', | ||||
| 			}, | ||||
| 			layouts = { { | ||||
| 				elements = { | ||||
| 					{ | ||||
| 						id = "scopes", | ||||
| 						size = 0.5 | ||||
| 			layouts = { | ||||
| 				{ | ||||
| 					elements = { | ||||
| 						{ | ||||
| 							id = 'scopes', | ||||
| 							size = 0.5, | ||||
| 						}, | ||||
| 						-- { | ||||
| 						-- 	id = "breakpoints", | ||||
| 						-- 	size = 0.25 | ||||
| 						-- }, | ||||
| 						{ | ||||
| 							id = 'stacks', | ||||
| 							size = 0.25, | ||||
| 						}, | ||||
| 						{ | ||||
| 							id = 'watches', | ||||
| 							size = 0.25, | ||||
| 						}, | ||||
| 					}, | ||||
| 					-- { | ||||
| 					-- 	id = "breakpoints", | ||||
| 					-- 	size = 0.25 | ||||
| 					-- }, | ||||
| 					{ | ||||
| 						id = "stacks", | ||||
| 						size = 0.25 | ||||
| 					}, | ||||
| 					{ | ||||
| 						id = "watches", | ||||
| 						size = 0.25 | ||||
| 					} | ||||
| 					position = 'right', | ||||
| 					size = 40, | ||||
| 				}, | ||||
| 				position = "right", | ||||
| 				size = 40 | ||||
| 			}, { | ||||
| 				elements = { { | ||||
| 					id = "repl", | ||||
| 					size = 0.5 | ||||
| 				}, { | ||||
| 					id = "console", | ||||
| 					size = 0.5 | ||||
| 				} }, | ||||
| 				position = "bottom", | ||||
| 				size = 10 | ||||
| 			} }, | ||||
| 				{ | ||||
| 					elements = { | ||||
| 						{ | ||||
| 							id = 'repl', | ||||
| 							size = 0.5, | ||||
| 						}, | ||||
| 						{ | ||||
| 							id = 'console', | ||||
| 							size = 0.5, | ||||
| 						}, | ||||
| 					}, | ||||
| 					position = 'bottom', | ||||
| 					size = 10, | ||||
| 				}, | ||||
| 			}, | ||||
| 			mappings = { | ||||
| 				edit = "e", | ||||
| 				expand = { "<CR>", "<2-LeftMouse>" }, | ||||
| 				open = "o", | ||||
| 				remove = "d", | ||||
| 				repl = "r", | ||||
| 				toggle = "t" | ||||
| 				edit = 'e', | ||||
| 				expand = { '<CR>', '<2-LeftMouse>' }, | ||||
| 				open = 'o', | ||||
| 				remove = 'd', | ||||
| 				repl = 'r', | ||||
| 				toggle = 't', | ||||
| 			}, | ||||
| 			render = { | ||||
| 				indent = 1, | ||||
| 				max_value_lines = 100 | ||||
| 			} | ||||
| 
 | ||||
| 				max_value_lines = 100, | ||||
| 			}, | ||||
| 		}, | ||||
| 	}, | ||||
| } | ||||
|  | ||||
							
								
								
									
										27
									
								
								lua/plugins/editing.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								lua/plugins/editing.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| return { | ||||
| 	{ 'mg979/vim-visual-multi', event = 'VeryLazy' }, | ||||
| 	{ | ||||
| 		'ecthelionvi/NeoSwap.nvim', | ||||
| 		opts = {}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		'windwp/nvim-autopairs', | ||||
| 		event = 'InsertEnter', | ||||
| 		config = function() | ||||
| 			require('nvim-autopairs').setup { | ||||
| 				check_ts = true, -- treesitter integration | ||||
| 				fast_wrap = { | ||||
| 					map = '<C-e>', | ||||
| 					highlight = 'Search', | ||||
| 					highlight_grey = 'Comment', | ||||
| 				}, | ||||
| 				map_c_w = true, | ||||
| 				disable_filetype = { 'TelescopePrompt' }, | ||||
| 			} | ||||
| 
 | ||||
| 			local cmp_autopairs = require 'nvim-autopairs.completion.cmp' | ||||
| 			local cmp = require 'cmp' | ||||
| 			cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done { map_char = { tex = '' } }) | ||||
| 		end, | ||||
| 	}, | ||||
| } | ||||
							
								
								
									
										113
									
								
								lua/plugins/editor.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								lua/plugins/editor.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,113 @@ | ||||
| return { | ||||
| 	{ | ||||
| 		'echasnovski/mini.diff', | ||||
| 		version = false, | ||||
| 		event = "VeryLazy", | ||||
| 		opts = { | ||||
| 			-- Options for how hunks are visualized | ||||
| 			view = { | ||||
| 				-- Visualization style. Possible values are 'sign' and 'number'. | ||||
| 				-- Default: 'number' if line numbers are enabled, 'sign' otherwise. | ||||
| 				style = 'sign', | ||||
| 
 | ||||
| 				-- Signs used for hunks with 'sign' view | ||||
| 				signs = { add = '▒', change = '▒', delete = '▒' }, | ||||
| 
 | ||||
| 				-- Priority of used visualization extmarks | ||||
| 				priority = 199, | ||||
| 			}, | ||||
| 
 | ||||
| 			-- Source for how reference text is computed/updated/etc | ||||
| 			-- Uses content from Git index by default | ||||
| 			source = nil, | ||||
| 
 | ||||
| 			-- Delays (in ms) defining asynchronous processes | ||||
| 			delay = { | ||||
| 				-- How much to wait before update following every text change | ||||
| 				text_change = 200, | ||||
| 			}, | ||||
| 
 | ||||
| 			-- Module mappings. Use `''` (empty string) to disable one. | ||||
| 			mappings = { | ||||
| 				-- Apply hunks inside a visual/operator region | ||||
| 				apply = 'gh', | ||||
| 
 | ||||
| 				-- Reset hunks inside a visual/operator region | ||||
| 				reset = 'gH', | ||||
| 
 | ||||
| 				-- Hunk range textobject to be used inside operator | ||||
| 				textobject = 'gh', | ||||
| 
 | ||||
| 				-- Go to hunk range in corresponding direction | ||||
| 				goto_first = '[H', | ||||
| 				goto_prev = '[h', | ||||
| 				goto_next = ']h', | ||||
| 				goto_last = ']H', | ||||
| 			}, | ||||
| 
 | ||||
| 			-- Various options | ||||
| 			options = { | ||||
| 				-- Diff algorithm. See `:h vim.diff()`. | ||||
| 				algorithm = 'histogram', | ||||
| 
 | ||||
| 				-- Whether to use "indent heuristic". See `:h vim.diff()`. | ||||
| 				indent_heuristic = true, | ||||
| 
 | ||||
| 				-- The amount of second-stage diff to align lines (in Neovim>=0.9) | ||||
| 				linematch = 60, | ||||
| 
 | ||||
| 				-- Whether to wrap around edges during hunk navigation | ||||
| 				wrap_goto = false, | ||||
| 			}, | ||||
| 		} | ||||
| 	}, | ||||
| 	{ | ||||
| 		'nvim-telescope/telescope.nvim', | ||||
| 		dependencies = { | ||||
| 			{ 'nvim-lua/plenary.nvim' }, | ||||
| 			{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, | ||||
| 			{ 'nvim-tree/nvim-web-devicons' }, | ||||
| 		}, | ||||
| 		cmd = 'Telescope', | ||||
| 		keys = function() | ||||
| 			local telescope = require('utils').telescope | ||||
| 
 | ||||
| 			return { | ||||
| 				{ '<leader>ff', telescope 'find_files',  desc = 'files' }, | ||||
| 				{ '<leader>fg', telescope 'git_files',   desc = 'git files' }, | ||||
| 				{ '<leader>fr', telescope 'live_grep',   desc = 'grep' }, | ||||
| 				{ '<leader>fb', telescope 'buffers',     desc = 'buffers' }, | ||||
| 				{ '<leader>fc', telescope 'colorscheme', desc = 'colorscheme' }, | ||||
| 				{ '<leader>fh', telescope 'oldfiles',    desc = 'history' }, | ||||
| 			} | ||||
| 		end, | ||||
| 		config = function() | ||||
| 			local telescope = require 'telescope' | ||||
| 			telescope.setup { | ||||
| 				defaults = { | ||||
| 					mappings = { | ||||
| 						i = { | ||||
| 							["<Esc>"] = require('telescope.actions').close | ||||
| 						} | ||||
| 					}, | ||||
| 				} | ||||
| 			} | ||||
| 			telescope.load_extension 'fzf' | ||||
| 		end, | ||||
| 	}, | ||||
| 	{ | ||||
| 		'f-person/git-blame.nvim', | ||||
| 		dependencies = {}, | ||||
| 		keys = { | ||||
| 			{ '<leader>bt', '<Cmd>GitBlameToggle<CR>',        desc = 'Blame toggle' }, | ||||
| 			{ '<leader>bo', '<Cmd>GitBlameOpenCommitURL<CR>', desc = 'Open in browser' }, | ||||
| 			{ '<leader>bc', '<Cmd>GitBlameCopySHA<CR>',       desc = 'Copy SHA1' }, | ||||
| 		}, | ||||
| 		config = function() | ||||
| 			require('gitblame').setup { | ||||
| 				enabled = false, | ||||
| 				message_template = '  <author> • <date> • <summary>', | ||||
| 			} | ||||
| 		end, | ||||
| 	}, | ||||
| } | ||||
| @ -1,42 +0,0 @@ | ||||
| return { | ||||
| 
 | ||||
| 	'folke/which-key.nvim', | ||||
| 	'nvim-lua/plenary.nvim', | ||||
| 	'mfussenegger/nvim-jdtls', | ||||
| 	'simrat39/rust-tools.nvim', | ||||
| 	'sakhnik/nvim-gdb', | ||||
| 	{ 'mg979/vim-visual-multi',  event = 'VeryLazy' }, | ||||
| 	{ 'rush-rs/tree-sitter-asm', ft = 'asm' }, | ||||
| 	{ 'jghauser/mkdir.nvim',     lazy = false }, | ||||
| 	-- { | ||||
| 	-- 	'jakewvincent/mkdnflow.nvim', | ||||
| 	-- 	dependencies = 'nvim-lua/plenary.nvim', | ||||
| 	-- 	ft = 'markdown', | ||||
| 	-- 	opts = {}, | ||||
| 	-- }, | ||||
| 	{ | ||||
| 		'glepnir/dbsession.nvim', | ||||
| 		cmd = { 'SessionSave', 'SessionDelete', 'SessionLoad' }, | ||||
| 		opts = {}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		"stevearc/dressing.nvim", | ||||
| 		lazy = true, | ||||
| 		init = function() | ||||
| 			---@diagnostic disable-next-line: duplicate-set-field | ||||
| 			vim.ui.select = function(...) | ||||
| 				require("lazy").load({ plugins = { "dressing.nvim" } }) | ||||
| 				return vim.ui.select(...) | ||||
| 			end | ||||
| 			---@diagnostic disable-next-line: duplicate-set-field | ||||
| 			vim.ui.input = function(...) | ||||
| 				require("lazy").load({ plugins = { "dressing.nvim" } }) | ||||
| 				return vim.ui.input(...) | ||||
| 			end | ||||
| 		end, | ||||
| 	}, | ||||
| 	{ | ||||
| 		"ecthelionvi/NeoSwap.nvim", | ||||
| 		opts = {} | ||||
| 	}, | ||||
| } | ||||
| @ -1,44 +0,0 @@ | ||||
| return { | ||||
| 	'neovim/nvim-lspconfig', | ||||
| 	name = 'lsp', | ||||
| 	ft = 'java', | ||||
| 	dependencies = { 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim' }, | ||||
| 	opts = { | ||||
| 		-- options for vim.diagnostic.config() | ||||
| 		diagnostics = { | ||||
| 			underline = true, | ||||
| 			update_in_insert = false, | ||||
| 			signs = false, | ||||
| 			virtual_text = { | ||||
| 				source = "if_many", | ||||
| 				prefix = "●", | ||||
| 				-- this will set set the prefix to a function that returns the diagnostics icon based on the severity | ||||
| 				-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported | ||||
| 				-- prefix = "icons", | ||||
| 			}, | ||||
| 			float = { | ||||
| 				focusable = false, | ||||
| 				-- style = 'minimal', | ||||
| 				border = 'rounded', | ||||
| 				source = 'always', | ||||
| 				header = '', | ||||
| 				prefix = '', | ||||
| 			}, | ||||
| 			severity_sort = true, | ||||
| 		}, | ||||
| 	}, | ||||
| 	config = function(_, opts) | ||||
| 		vim.diagnostic.config(vim.deepcopy(opts.diagnostics)) | ||||
| 		-- vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { | ||||
| 		-- 	border = 'rounded', | ||||
| 		-- }) | ||||
| 		-- vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { | ||||
| 		-- 	border = 'rounded', | ||||
| 		-- }) | ||||
| 		local on_references = vim.lsp.handlers['textDocument/references'] | ||||
| 		vim.lsp.handlers['textDocument/references'] = vim.lsp.with(on_references, { | ||||
| 			-- Use location list instead of quickfix list | ||||
| 			loclist = true, | ||||
| 		}) | ||||
| 	end | ||||
| } | ||||
| @ -1,4 +1,45 @@ | ||||
| return { | ||||
| 	{ | ||||
| 		'neovim/nvim-lspconfig', | ||||
| 		event = { 'BufReadPre', 'BufNewFile' }, | ||||
| 		dependencies = { | ||||
| 			{ 'williamboman/mason.nvim' }, | ||||
| 			{ 'williamboman/mason-lspconfig.nvim' }, | ||||
| 			{ 'hrsh7th/cmp-nvim-lsp' }, | ||||
| 			{ 'mfussenegger/nvim-dap' }, | ||||
| 			{ 'simrat39/rust-tools.nvim' }, | ||||
| 			{ | ||||
| 				'j-hui/fidget.nvim', | ||||
| 				opts = { | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		config = function() | ||||
| 			require('plugins.lsp.ui').setup() | ||||
| 			vim.diagnostic.config { | ||||
| 				underline = true, | ||||
| 				update_in_insert = true, | ||||
| 				signs = false, | ||||
| 				virtual_text = { | ||||
| 					source = 'if_many', | ||||
| 					prefix = '●', | ||||
| 					spacing = 5, | ||||
| 					-- this will set set the prefix to a function that returns the diagnostics icon based on the severity | ||||
| 					-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported | ||||
| 					-- prefix = "icons", | ||||
| 				}, | ||||
| 				float = { | ||||
| 					focusable = true, | ||||
| 					-- style = 'minimal', | ||||
| 					border = 'rounded', | ||||
| 					source = 'always', | ||||
| 					header = '', | ||||
| 					prefix = '', | ||||
| 				}, | ||||
| 				severity_sort = true, | ||||
| 			} | ||||
| 		end, | ||||
| 	}, | ||||
| 	{ | ||||
| 		'williamboman/mason.nvim', | ||||
| 		cmd = 'Mason', | ||||
| @ -18,9 +59,12 @@ return { | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		"jay-babu/mason-nvim-dap.nvim", | ||||
| 		'jay-babu/mason-nvim-dap.nvim', | ||||
| 		dependencies = 'nvim-neotest/nvim-nio', | ||||
| 		opts = { | ||||
| 			ensure_installed = { 'javatest', 'javadbg', 'codelldb' }, | ||||
| 			ensure_installed = { --[[ 'javatest', 'javadbg', ]] | ||||
| 				'codelldb', | ||||
| 			}, | ||||
| 			handlers = { | ||||
| 				function(config) | ||||
| 					-- all sources with no handler get passed here | ||||
| @ -40,17 +84,18 @@ return { | ||||
| 				-- 	require('mason-nvim-dap').default_setup(config) -- don't forget this! | ||||
| 				-- end, | ||||
| 			}, | ||||
| 		} | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		'williamboman/mason-lspconfig.nvim', | ||||
| 		dependencies = { 'jay-babu/mason-nvim-dap.nvim', 'rcarriga/nvim-dap-ui' }, | ||||
| 		dependencies = { 'jay-babu/mason-nvim-dap.nvim', 'rcarriga/nvim-dap-ui', 'Issafalcon/lsp-overloads.nvim' }, | ||||
| 		config = function() | ||||
| 			require('mason').setup() | ||||
| 			local cmp_nvim_lsp = require 'cmp_nvim_lsp' | ||||
| 			local capabilities = cmp_nvim_lsp.default_capabilities() | ||||
| 			local lspconfig = require 'lspconfig' | ||||
| 			capabilities.textDocument.completion.completionItem = { | ||||
| 				documentationFormat = { "markdown", "plaintext" }, | ||||
| 				documentationFormat = { 'markdown', 'plaintext' }, | ||||
| 				snippetSupport = true, | ||||
| 				preselectSupport = true, | ||||
| 				insertReplaceSupport = true, | ||||
| @ -60,15 +105,27 @@ return { | ||||
| 				tagSupport = { valueSet = { 1 } }, | ||||
| 				resolveSupport = { | ||||
| 					properties = { | ||||
| 						"documentation", | ||||
| 						"detail", | ||||
| 						"additionalTextEdits", | ||||
| 						'documentation', | ||||
| 						'detail', | ||||
| 						'additionalTextEdits', | ||||
| 					}, | ||||
| 				}, | ||||
| 			} | ||||
| 
 | ||||
| 			local function on_attach(client, bufnr) | ||||
| 				--[[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]] | ||||
| 				require('plugins.lsp.keymaps').on_attach(bufnr) | ||||
| 				require('plugins.lsp.ui').on_attach(client, bufnr) | ||||
| 				-- [[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]] | ||||
| 				if client.server_capabilities.signatureHelpProvider then | ||||
| 					require('lsp-overloads').setup(client, { | ||||
| 						ui = { | ||||
| 							max_width = 60, | ||||
| 							max_height = 8, | ||||
| 							floating_window_above_cur_line = true, | ||||
| 						}, | ||||
| 						display_automatically = true, -- Uses trigger characters to automatically display the signature overloads when typing a method signature | ||||
| 					}) | ||||
| 				end | ||||
| 				if client.name == 'jdtls' or client.name == 'jdt.ls' then | ||||
| 					-- client.server_capabilities.documentFormattingProvider = false | ||||
| 					vim.lsp.codelens.refresh() | ||||
| @ -80,7 +137,6 @@ return { | ||||
| 				end | ||||
| 				-- -- util.info(client.name .. " " .. (enable and "yes" or "no"), "format") | ||||
| 				client.server_capabilities.documentFormattingProvider = true | ||||
| 				-- client.server_capabilities.documentFormattingProvider = true | ||||
| 				client.server_capabilities.semanticTokensProvider = nil | ||||
| 			end | ||||
| 
 | ||||
| @ -88,7 +144,7 @@ return { | ||||
| 				function(server_name) -- default handler (optional) | ||||
| 					lspconfig[server_name].setup { | ||||
| 						on_attach = on_attach, | ||||
| 						capabilities = capabilities, | ||||
| 						capabilities = vim.deepcopy(capabilities), | ||||
| 					} | ||||
| 				end, | ||||
| 				['clangd'] = function() | ||||
| @ -112,15 +168,15 @@ return { | ||||
| 						on_attach = on_attach, | ||||
| 						capabilities = capabilities, | ||||
| 						arg = { | ||||
| 							unpack(clangd_flags) | ||||
| 						} | ||||
| 							unpack(clangd_flags), | ||||
| 						}, | ||||
| 					} | ||||
| 				end, | ||||
| 				['html'] = function() | ||||
| 					lspconfig.html.setup { | ||||
| 						on_attach = on_attach, | ||||
| 						capabilities = capabilities, | ||||
| 						filetypes = { "html", "jsp" }, | ||||
| 						filetypes = { 'html', 'jsp' }, | ||||
| 					} | ||||
| 				end, | ||||
| 				['lua_ls'] = function() | ||||
| @ -148,17 +204,58 @@ return { | ||||
| 						}, | ||||
| 					} | ||||
| 				end, | ||||
| 				['jdtls'] = function() | ||||
| 				end, | ||||
| 				['jdtls'] = function() end, | ||||
| 				['rust_analyzer'] = function() | ||||
| 					require('rust-tools').setup { | ||||
| 					local rt = require 'rust-tools' | ||||
| 					rt.setup { | ||||
| 						server = { | ||||
| 							on_attach = on_attach, | ||||
| 							standalone = false, | ||||
| 							on_attach = function(client, bufnr) | ||||
| 								require('plugins.lsp.keymaps').on_attach(bufnr) | ||||
| 								require('plugins.lsp.ui').on_attach(client, bufnr) | ||||
| 								client.server_capabilities.semanticTokensProvider = nil | ||||
| 								if client.server_capabilities.signatureHelpProvider then | ||||
| 									require('lsp-overloads').setup(client, { | ||||
| 										ui = { | ||||
| 											max_width = 60, | ||||
| 											max_height = 8, | ||||
| 											floating_window_above_cur_line = true, | ||||
| 										}, | ||||
| 										display_automatically = true, -- Uses trigger characters to automatically display the signature overloads when typing a method signature | ||||
| 									}) | ||||
| 								end | ||||
| 								-- Hover actions | ||||
| 								vim.keymap.set('n', '<C-space>', | ||||
| 									rt.hover_actions.hover_actions, | ||||
| 									{ buffer = bufnr }) | ||||
| 								-- Code action groups | ||||
| 								vim.keymap.set( | ||||
| 									'n', | ||||
| 									'<Leader>a', | ||||
| 									rt.code_action_group.code_action_group, | ||||
| 									{ buffer = bufnr } | ||||
| 								) | ||||
| 							end, | ||||
| 							settings = { | ||||
| 								['rust-analyzer'] = { | ||||
| 									cargo = { features = 'all' }, | ||||
| 									check = { allTargets = true }, | ||||
| 								}, | ||||
| 								procMacro = { | ||||
| 									enable = true, | ||||
| 								}, | ||||
| 							}, | ||||
| 						}, | ||||
| 						-- debugging stuff | ||||
| 						dap = { | ||||
| 							adapter = { | ||||
| 								type = 'executable', | ||||
| 								command = 'lldb-vscode', | ||||
| 								name = 'rt_lldb', | ||||
| 							}, | ||||
| 						}, | ||||
| 					} | ||||
| 				end, | ||||
| 			} | ||||
| 		end | ||||
| 	} | ||||
| 		end, | ||||
| 	}, | ||||
| } | ||||
							
								
								
									
										38
									
								
								lua/plugins/lsp/keymaps.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								lua/plugins/lsp/keymaps.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | ||||
| local M = {} | ||||
| 
 | ||||
| function M.on_attach(bufnr) | ||||
| 	local telescope = require('utils').telescope | ||||
| 
 | ||||
| 	local function map(key, rhs, desc) | ||||
| 		vim.keymap.set('n', key, rhs, { | ||||
| 			silent = true, | ||||
| 			buffer = bufnr, | ||||
| 			desc = desc, | ||||
| 		}) | ||||
| 	end | ||||
| 
 | ||||
| 	map('K', vim.lsp.buf.hover, 'hover') | ||||
| 
 | ||||
| 	map('<leader>lf', vim.lsp.buf.format, 'format') | ||||
| 	map('<leader>lD', vim.lsp.buf.declaration, 'declaration') | ||||
| 	map('<leader>ld', telescope 'lsp_definitions', 'definition') | ||||
| 	map('<leader>li', telescope 'lsp_implementations', 'implementation') | ||||
| 	map('<leader>lt', telescope 'lsp_type_definitions', 'type defintion') | ||||
| 	map('<leader>lr', telescope 'lsp_references', 'references') | ||||
| 	map('<leader>ly', telescope 'lsp_document_symbols', 'LSP symbols') | ||||
| 
 | ||||
| 	map('<leader>ln', vim.lsp.buf.rename, 'rename') | ||||
| 	map('<leader>la', vim.lsp.buf.code_action, 'action') | ||||
| 
 | ||||
| 	map('<leader>lp', vim.diagnostic.goto_prev, 'previous diagnostic') | ||||
| 	map('<leader>ll', vim.diagnostic.goto_next, 'next diagnostic') | ||||
| 	map('<leader>lw', telescope 'diagnostics', 'diagnostics list') | ||||
| 	map('<leader>ls', function() | ||||
| 		vim.diagnostic.open_float { scope = 'cursor' } | ||||
| 	end, 'cursor diagnostic') | ||||
| 	map('<leader>lS', function() | ||||
| 		vim.diagnostic.open_float { scope = 'line' } | ||||
| 	end, 'line diagnostics') | ||||
| end | ||||
| 
 | ||||
| return M | ||||
							
								
								
									
										53
									
								
								lua/plugins/lsp/ui.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								lua/plugins/lsp/ui.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | ||||
| local M = {} | ||||
| 
 | ||||
| function M.setup() | ||||
|     -- Signs | ||||
|     local signs = { Error = "", Warn = "", Hint = "", Info = "" } | ||||
|     for type, icon in pairs(signs) do | ||||
|         local hl = "DiagnosticSign" .. type | ||||
|         vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) | ||||
|     end | ||||
| 
 | ||||
|     -- Floating window borders | ||||
|     local border = { | ||||
|         { "╭", "FloatBorder" }, | ||||
|         { "─", "FloatBorder" }, | ||||
|         { "╮", "FloatBorder" }, | ||||
|         { "│", "FloatBorder" }, | ||||
|         { "╯", "FloatBorder" }, | ||||
|         { "─", "FloatBorder" }, | ||||
|         { "╰", "FloatBorder" }, | ||||
|         { "│", "FloatBorder" }, | ||||
|     } | ||||
|     local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview | ||||
|     function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) | ||||
|         opts = opts or {} | ||||
|         opts.border = opts.border or border | ||||
|         return orig_util_open_floating_preview(contents, syntax, opts, ...) | ||||
|     end | ||||
| end | ||||
| 
 | ||||
| function M.on_attach(client, bufnr) | ||||
|     -- Highlight references | ||||
|     if client.server_capabilities.documentHighlightProvider then | ||||
|         vim.api.nvim_create_augroup("lsp_document_highlight", { | ||||
|             clear = false, | ||||
|         }) | ||||
|         vim.api.nvim_clear_autocmds({ | ||||
|             group = "lsp_document_highlight", | ||||
|             buffer = bufnr, | ||||
|         }) | ||||
|         -- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { | ||||
|         --     group = "lsp_document_highlight", | ||||
|         --     buffer = bufnr, | ||||
|         --     callback = vim.lsp.buf.document_highlight, | ||||
|         -- }) | ||||
|         -- vim.api.nvim_create_autocmd("CursorMoved", { | ||||
|         --     group = "lsp_document_highlight", | ||||
|         --     buffer = bufnr, | ||||
|         --     callback = vim.lsp.buf.clear_references, | ||||
|         -- }) | ||||
|     end | ||||
| end | ||||
| 
 | ||||
| return M | ||||
							
								
								
									
										8
									
								
								lua/plugins/misc.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								lua/plugins/misc.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| return { | ||||
| 	{ 'jghauser/mkdir.nvim', lazy = false }, | ||||
| 	{ | ||||
| 		'glepnir/dbsession.nvim', | ||||
| 		cmd = { 'SessionSave', 'SessionDelete', 'SessionLoad' }, | ||||
| 		opts = {}, | ||||
| 	}, | ||||
| } | ||||
| @ -1,7 +1,14 @@ | ||||
| return { | ||||
| 	'NeogitOrg/neogit', | ||||
| 	dependencies = 'sindrets/diffview.nvim', | ||||
| 	dependencies = { | ||||
| 		'nvim-lua/plenary.nvim', | ||||
| 		'sindrets/diffview.nvim', -- optional | ||||
| 		'ibhagwan/fzf-lua', -- optional | ||||
| 	}, | ||||
| 	cmd = 'Neogit', | ||||
| 	keys = { | ||||
| 		{ '<leader>g', '<Cmd>Neogit<CR>', desc = 'neogit' }, | ||||
| 	}, | ||||
| 	opts = { | ||||
| 		disable_signs = false, | ||||
| 		disable_hint = false, | ||||
|  | ||||
| @ -2,12 +2,15 @@ return { | ||||
| 	'stevearc/oil.nvim', | ||||
| 	-- lazy = false, | ||||
| 	event = 'VeryLazy', | ||||
| 	keys = { | ||||
| 		{ '<leader>.', '<cmd>Oil<cr>', desc = 'oil' }, | ||||
| 	}, | ||||
| 	opts = { | ||||
| 		columns = { | ||||
| 			"mtime", | ||||
| 			"size", | ||||
| 			"permissions", | ||||
| 			"icon", | ||||
| 			'mtime', | ||||
| 			'size', | ||||
| 			'permissions', | ||||
| 			'icon', | ||||
| 		}, | ||||
| 		-- Buffer-local options to use for oil buffers | ||||
| 		buf_options = { | ||||
| @ -16,9 +19,9 @@ return { | ||||
| 		-- Window-local options to use for oil buffers | ||||
| 		win_options = { | ||||
| 			wrap = false, | ||||
| 			signcolumn = "no", | ||||
| 			signcolumn = 'no', | ||||
| 			cursorcolumn = false, | ||||
| 			foldcolumn = "0", | ||||
| 			foldcolumn = '0', | ||||
| 			spell = false, | ||||
| 			list = false, | ||||
| 			conceallevel = 3, | ||||
|  | ||||
							
								
								
									
										53
									
								
								lua/plugins/snippets/init.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								lua/plugins/snippets/init.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | ||||
| return { | ||||
|     "L3MON4D3/LuaSnip", | ||||
|     keys = { | ||||
|         { | ||||
|             "<C-k>", | ||||
|             function() | ||||
|                 if require("luasnip").jumpable(1) then | ||||
|                     require("luasnip").jump(1) | ||||
|                 end | ||||
|             end, | ||||
|             mode = { "i", "s" }, | ||||
|         }, | ||||
|         { | ||||
|             "<C-l>", | ||||
|             function() | ||||
|                 if require("luasnip").jumpable(-1) then | ||||
|                     require("luasnip").jump(-1) | ||||
|                 end | ||||
|             end, | ||||
|             mode = { "i", "s" }, | ||||
|         }, | ||||
|         { | ||||
|             "<C-;>", | ||||
|             function() | ||||
|                 if require("luasnip").choice_active() then | ||||
|                     require("luasnip").change_choice(1) | ||||
|                 end | ||||
|             end, | ||||
|             mode = { "i", "s" }, | ||||
|         }, | ||||
|         { | ||||
|             "<C-j>", | ||||
|             function() | ||||
|                 if require("luasnip").choice_active() then | ||||
|                     require("luasnip").change_choice(-1) | ||||
|                 end | ||||
|             end, | ||||
|             mode = { "i", "s" }, | ||||
|         }, | ||||
|     }, | ||||
|     opts = { | ||||
|         history = true, | ||||
|         update_events = { "TextChanged", "TextChangedI" }, | ||||
|     }, | ||||
|     config = function(_, opts) | ||||
|         local ls = require("luasnip") | ||||
|         ls.setup(opts) | ||||
|         -- for _, lang in pairs({ "c", "make", "markdown", "tiger", "sh", "nix" }) do | ||||
|         --     ls.add_snippets(lang, require("plugins.snippets." .. lang)) | ||||
|         -- end | ||||
|         -- ls.add_snippets("cpp", require("plugins.snippets.c")) | ||||
|     end, | ||||
| } | ||||
| @ -1,159 +0,0 @@ | ||||
| local l = false | ||||
| return { | ||||
| 	{ | ||||
| 		-- url = 'https://git.filnar.com/fiplox/neogruber.git', | ||||
| 		dir = '~/dev/home/neogruber.nvim/', | ||||
| 		lazy = false, | ||||
| 		opts = { | ||||
| 			transparent = true, | ||||
| 			light = l, | ||||
| 		} | ||||
| 		-- event = 'VeryLazy' | ||||
| 	}, | ||||
| 	-- { | ||||
| 	-- 	"Mofiqul/adwaita.nvim", | ||||
| 	-- 	lazy = false, | ||||
| 	-- 	priority = 1000, | ||||
| 	-- 	-- configure and set on startup | ||||
| 	-- 	config = function() | ||||
| 	-- 		vim.g.adwaita_darker = false -- for darker version | ||||
| 	-- 		vim.g.adwaita_disable_cursorline = false -- to disable cursorline | ||||
| 	-- 		vim.g.adwaita_transparent = true -- makes the background transparent | ||||
| 	-- 		-- vim.cmd('colorscheme adwaita') | ||||
| 	-- 	end | ||||
| 	-- }, | ||||
| 	{ | ||||
| 		'freddiehaddad/feline.nvim', | ||||
| 		dependencies = { | ||||
| 			'nvim-tree/nvim-web-devicons', | ||||
| 		}, | ||||
| 		config = function() | ||||
| 			local feline = require 'feline' | ||||
| 			local utils = require 'config.utils' | ||||
| 			local c = utils.feline_c | ||||
| 			local theme | ||||
| 			if l then | ||||
| 				theme = utils.feline_theme_light | ||||
| 			else | ||||
| 				theme = utils.feline_theme_dark | ||||
| 			end | ||||
| 			local vi_mode_colors = utils.feline_vi_mode_colors | ||||
| 
 | ||||
| 			local left = { | ||||
| 				c.vim_mode, | ||||
| 				-- c.gitBranch, | ||||
| 				-- c.gitDiffAdded, | ||||
| 				-- c.gitDiffRemoved, | ||||
| 				-- c.gitDiffChanged, | ||||
| 				c.file_info, | ||||
| 				c.right_separator, | ||||
| 				c.lsp_client_names, | ||||
| 				c.diagnostic_errors, | ||||
| 				c.diagnostic_warnings, | ||||
| 				c.diagnostic_info, | ||||
| 				c.diagnostic_hints, | ||||
| 			} | ||||
| 
 | ||||
| 			-- local middle = { | ||||
| 			-- 	c.separator, | ||||
| 			-- } | ||||
| 
 | ||||
| 			local right = { | ||||
| 				c.file_type, | ||||
| 				c.search_count, | ||||
| 				c.macro, | ||||
| 				c.file_encoding, | ||||
| 				-- c.startup, | ||||
| 				c.line_percentage, | ||||
| 				c.select_count, | ||||
| 				c.position, | ||||
| 			} | ||||
| 
 | ||||
| 			local components = { | ||||
| 				active = { | ||||
| 					left, | ||||
| 					-- middle, | ||||
| 					right, | ||||
| 				}, | ||||
| 				inactive = { | ||||
| 					left, | ||||
| 					-- middle, | ||||
| 					right, | ||||
| 				}, | ||||
| 			} | ||||
| 
 | ||||
| 			feline.setup { | ||||
| 				components = components, | ||||
| 				theme = theme, | ||||
| 				vi_mode_colors = vi_mode_colors, | ||||
| 			} | ||||
| 		end, | ||||
| 	}, | ||||
| 	-- { | ||||
| 	-- 	'nvim-lualine/lualine.nvim', | ||||
| 	-- 	dependencies = { 'nvim-tree/nvim-web-devicons', 'nvim-lua/lsp-status.nvim' }, | ||||
| 	-- 	opts = { | ||||
| 	-- 		options = { | ||||
| 	-- 			theme = "adwaita" | ||||
| 	-- 		}, | ||||
| 	-- 		sections = { | ||||
| 	-- 			lualine_a = { 'mode' }, | ||||
| 	-- 			lualine_b = { 'branch', 'diff', 'diagnostics' }, | ||||
| 	-- 			lualine_c = { 'filename', "require'lsp-status'.status()" }, | ||||
| 	-- 			lualine_x = { 'encoding', 'fileformat', 'filetype' }, | ||||
| 	-- 			lualine_y = { 'progress' }, | ||||
| 	-- 			lualine_z = { 'location' } | ||||
| 	-- 		}, | ||||
| 	-- 		inactive_sections = { | ||||
| 	-- 			lualine_a = {}, | ||||
| 	-- 			lualine_b = {}, | ||||
| 	-- 			lualine_c = { 'filename', "require'lsp-status'.status()" }, | ||||
| 	-- 			lualine_x = { 'location' }, | ||||
| 	-- 			lualine_y = {}, | ||||
| 	-- 			lualine_z = {} | ||||
| 	-- 		}, | ||||
| 	-- 		tabline = {}, | ||||
| 	-- 		winbar = {}, | ||||
| 	-- 		inactive_winbar = {}, | ||||
| 	-- 		extensions = {} | ||||
| 	-- 	}, | ||||
| 	-- }, | ||||
| 	-- { | ||||
| 	-- 	'nvimdev/dashboard-nvim', | ||||
| 	-- 	event = 'VimEnter', | ||||
| 	-- 	opts = { | ||||
| 	-- 		-- theme = 'doom', | ||||
| 	-- 		theme = 'hyper', | ||||
| 	-- 		shortcut_type = 'number', | ||||
| 	-- 		config = { | ||||
| 	-- 			shortcut = { | ||||
| 	-- 				-- action can be a function type | ||||
| 	-- 				{ | ||||
| 	-- 					desc = "Files", | ||||
| 	-- 					group = '', | ||||
| 	-- 					key = 'f', | ||||
| 	-- 					action = 'edit .' | ||||
| 	-- 				}, | ||||
| 	-- 			}, | ||||
| 	-- 			packages = { enable = false }, -- show how many plugins neovim loaded | ||||
| 	-- 			-- limit how many projects list, action when you press key or enter it will run this action. | ||||
| 	-- 			-- action can be a functino type, e.g. | ||||
| 	-- 			-- action = func(path) vim.cmd('Telescope find_files cwd=' .. path) end | ||||
| 	-- 			project = { | ||||
| 	-- 				enable = true, | ||||
| 	-- 				limit = 8, | ||||
| 	-- 				-- icon = ' ', | ||||
| 	-- 				label = '', | ||||
| 	-- 				action = 'edit' | ||||
| 	-- 			}, | ||||
| 	-- 			mru = { | ||||
| 	-- 				limit = 10, | ||||
| 	-- 				-- icon = 'your icon', | ||||
| 	-- 				label = '', | ||||
| 	-- 			}, | ||||
| 	-- 			footer = {}, -- footer | ||||
| 	-- 		} | ||||
| 	-- 	}, | ||||
| 	-- 	dependencies = { { 'nvim-tree/nvim-web-devicons' } } | ||||
| 	-- }, | ||||
| } | ||||
| @ -1,6 +1,10 @@ | ||||
| return { | ||||
| 	'akinsho/toggleterm.nvim', | ||||
| 	cmd = 'ToggleTerm', | ||||
| 	keys = { | ||||
| 		{ "<home>", '<cmd>ToggleTerm direction=horizontal<cr>', mode = { 'n', 't', 'v', 'i' }, desc = "Toggle Terminal" }, | ||||
| 		{ "<end>",  '<cmd>ToggleTerm direction=float<cr>',      mode = { 'n', 't', 'v', 'i' }, desc = "Toggle Terminal floating" }, | ||||
| 	}, | ||||
| 	opts = { | ||||
| 		-- size can be a number or function which is passed the current terminal | ||||
| 		-- size = function(term) | ||||
|  | ||||
| @ -1,13 +1,17 @@ | ||||
| return { | ||||
| 	'nvim-treesitter/nvim-treesitter', | ||||
| 	-- lazy = false, | ||||
| 	-- dependencies = { 'nvim-treesitter/playground' }, | ||||
| 	dependencies = { 'rush-rs/tree-sitter-asm' }, | ||||
| 	-- dependencies = 'windwp/nvim-ts-autotag', | ||||
| 	event = 'VeryLazy', | ||||
| 	init = function(plugin) | ||||
| 		require("lazy.core.loader").add_to_rtp(plugin) | ||||
| 		require("nvim-treesitter.query_predicates") | ||||
| 	end, | ||||
| 	keys = { | ||||
| 		{ '<leader>s', desc = 'start incremental selection' }, | ||||
| 		{ '<leader>h', '<cmd>TSBufToggle highlight<cr>', desc = 'toggle TS highlight' }, | ||||
| 	}, | ||||
| 	-- init = function(plugin) | ||||
| 	-- 	require('lazy.core.loader').add_to_rtp(plugin) | ||||
| 	-- 	require 'nvim-treesitter.query_predicates' | ||||
| 	-- end, | ||||
| 	config = function() | ||||
| 		require('nvim-treesitter.parsers').get_parser_configs().asm = { | ||||
| 			install_info = { | ||||
| @ -20,14 +24,30 @@ return { | ||||
| 
 | ||||
| 		configs.setup { | ||||
| 			ignore_install = { 'haskell' }, | ||||
| 			ensure_installed = { 'c', 'rust', 'lua', 'vim', 'vimdoc', 'cpp', 'go' }, | ||||
| 			auto_install = true, | ||||
| 			highlight = { | ||||
| 				enable = true, -- false will disable the whole extension | ||||
| 				disable = { 'html' }, | ||||
| 			}, | ||||
| 			incremental_selection = { | ||||
| 				enable = true, | ||||
| 				keymaps = { | ||||
| 					init_selection = '<leader>s', | ||||
| 					node_incremental = '<Space>', | ||||
| 					scope_incremental = false, | ||||
| 					node_decremental = '<S-Space>', | ||||
| 				}, | ||||
| 			}, | ||||
| 			-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files | ||||
| 			disable = function(_, buf) | ||||
| 				local max_filesize = 300 * 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, | ||||
| 			-- context_commentstring = { enable = true, config = { css = '// %s' } }, | ||||
| 			-- indent = {enable = true, disable = {"python", "html", "javascript"}}, | ||||
| 			-- TODO seems to be broken | ||||
| 			indent = { enable = true, disable = { 'python', 'css' } }, | ||||
| 			indent = { enable = true }, | ||||
| 			-- autotag = { enable = true }, | ||||
| 		} | ||||
| 	end, | ||||
|  | ||||
							
								
								
									
										152
									
								
								lua/plugins/ui.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								lua/plugins/ui.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,152 @@ | ||||
| return { | ||||
| 	{ | ||||
| 		'blazkowolf/gruber-darker.nvim', | ||||
| 		lazy = false, | ||||
| 		opts = { | ||||
| 			-- invert = { | ||||
| 			-- 	signs = true, | ||||
| 			-- 	tabline = true, | ||||
| 			-- 	visual = true, | ||||
| 			-- }, | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		'freddiehaddad/feline.nvim', | ||||
| 		dependencies = { | ||||
| 			'nvim-tree/nvim-web-devicons', | ||||
| 		}, | ||||
| 		config = function() | ||||
| 			local feline = require 'feline' | ||||
| 			local utils = require 'config.utils' | ||||
| 			local c = utils.feline_c | ||||
| 			local theme = utils.feline_theme_dark | ||||
| 			-- if l then | ||||
| 			-- 	theme = utils.feline_theme_light | ||||
| 			-- else | ||||
| 			-- 	theme = utils.feline_theme_dark | ||||
| 			-- end | ||||
| 			local vi_mode_colors = utils.feline_vi_mode_colors | ||||
| 
 | ||||
| 			local left = { | ||||
| 				c.vim_mode, | ||||
| 				-- c.gitBranch, | ||||
| 				-- c.gitDiffAdded, | ||||
| 				-- c.gitDiffRemoved, | ||||
| 				-- c.gitDiffChanged, | ||||
| 				c.file_info, | ||||
| 				c.right_separator, | ||||
| 				c.lsp_client_names, | ||||
| 				c.diagnostic_errors, | ||||
| 				c.diagnostic_warnings, | ||||
| 				c.diagnostic_info, | ||||
| 				c.diagnostic_hints, | ||||
| 			} | ||||
| 
 | ||||
| 			-- local middle = { | ||||
| 			-- 	c.separator, | ||||
| 			-- } | ||||
| 
 | ||||
| 			local right = { | ||||
| 				c.file_type, | ||||
| 				c.search_count, | ||||
| 				c.macro, | ||||
| 				c.file_encoding, | ||||
| 				-- c.startup, | ||||
| 				c.line_percentage, | ||||
| 				c.select_count, | ||||
| 				c.position, | ||||
| 			} | ||||
| 
 | ||||
| 			local components = { | ||||
| 				active = { | ||||
| 					left, | ||||
| 					-- middle, | ||||
| 					right, | ||||
| 				}, | ||||
| 				inactive = { | ||||
| 					left, | ||||
| 					-- middle, | ||||
| 					right, | ||||
| 				}, | ||||
| 			} | ||||
| 
 | ||||
| 			feline.setup { | ||||
| 				components = components, | ||||
| 				theme = theme, | ||||
| 				vi_mode_colors = vi_mode_colors, | ||||
| 			} | ||||
| 		end, | ||||
| 	}, | ||||
| 	{ | ||||
| 		'rcarriga/nvim-notify', | ||||
| 		lazy = true, | ||||
| 		keys = { | ||||
| 			{ | ||||
| 				'<leader>k', | ||||
| 				function() | ||||
| 					require('notify').dismiss() | ||||
| 				end, | ||||
| 				desc = 'dismiss notifications', | ||||
| 			}, | ||||
| 		}, | ||||
| 		init = function() | ||||
| 			vim.notify = function(...) | ||||
| 				return require 'notify' (...) | ||||
| 			end | ||||
| 		end, | ||||
| 	}, | ||||
| 	{ | ||||
| 		'stevearc/dressing.nvim', | ||||
| 		lazy = true, | ||||
| 		opts = { | ||||
| 			input = { | ||||
| 				win_options = { winblend = 0 }, | ||||
| 			}, | ||||
| 		}, | ||||
| 		init = function() | ||||
| 			---@diagnostic disable-next-line: duplicate-set-field | ||||
| 			vim.ui.select = function(...) | ||||
| 				require('lazy').load { plugins = { 'dressing.nvim' } } | ||||
| 				return vim.ui.select(...) | ||||
| 			end | ||||
| 			---@diagnostic disable-next-line: duplicate-set-field | ||||
| 			vim.ui.input = function(...) | ||||
| 				require('lazy').load { plugins = { 'dressing.nvim' } } | ||||
| 				return vim.ui.input(...) | ||||
| 			end | ||||
| 		end, | ||||
| 	}, | ||||
| 	{ | ||||
| 		"lukas-reineke/indent-blankline.nvim", | ||||
| 		event = { "BufReadPost", "BufNewFile" }, | ||||
| 		main = "ibl", | ||||
| 		config = function() | ||||
| 			local highlight = { | ||||
| 				"RainbowRed", | ||||
| 				"RainbowYellow", | ||||
| 				"RainbowBlue", | ||||
| 				"RainbowOrange", | ||||
| 				"RainbowGreen", | ||||
| 				"RainbowViolet", | ||||
| 				"RainbowCyan", | ||||
| 			} | ||||
| 			local hooks = require "ibl.hooks" | ||||
| 			-- create the highlight groups in the highlight setup hook, so they are reset | ||||
| 			-- every time the colorscheme changes | ||||
| 			hooks.register(hooks.type.HIGHLIGHT_SETUP, function() | ||||
| 				vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) | ||||
| 				vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) | ||||
| 				vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) | ||||
| 				vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) | ||||
| 				vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) | ||||
| 				vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) | ||||
| 				vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) | ||||
| 			end) | ||||
| 
 | ||||
| 			vim.g.rainbow_delimiters = { highlight = highlight } | ||||
| 			require("ibl").setup { scope = { highlight = highlight, show_start = false } } | ||||
| 
 | ||||
| 			hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) | ||||
| 		end | ||||
| 	} | ||||
| } | ||||
| @ -29,8 +29,8 @@ return { | ||||
| 				-- 		'google', | ||||
| 				-- 	}, | ||||
| 				-- }, | ||||
| 				formatting.beautysh, | ||||
| 				formatting.latexindent, | ||||
| 				-- formatting.beautysh, | ||||
| 				-- formatting.latexindent, | ||||
| 				formatting.goimports, | ||||
| 				formatting.gofumpt, | ||||
| 				formatting.sql_formatter, | ||||
							
								
								
									
										80
									
								
								lua/plugins/which-key.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								lua/plugins/which-key.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,80 @@ | ||||
| return { | ||||
| 	'folke/which-key.nvim', | ||||
| 	event = 'VeryLazy', | ||||
| 	config = function() | ||||
| 		local wk = require 'which-key' | ||||
| 		wk.setup { | ||||
| 			plugins = { | ||||
| 				marks = true, -- shows a list of your marks on ' and ` | ||||
| 				registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode | ||||
| 				-- the presets plugin, adds help for a bunch of default keybindings in Neovim | ||||
| 				-- No actual key bindings are created | ||||
| 				presets = { | ||||
| 					operators = true, -- adds help for operators like d, y, ... | ||||
| 					motions = true, -- adds help for motions | ||||
| 					text_objects = false, -- help for text objects triggered after entering an operator | ||||
| 					windows = true, -- default bindings on <c-w> | ||||
| 					nav = true, -- misc bindings to work with windows | ||||
| 					z = true, -- bindings for folds, spelling and others prefixed with z | ||||
| 					g = true, -- bindings for prefixed with g | ||||
| 				}, | ||||
| 			}, | ||||
| 			icons = { | ||||
| 				breadcrumb = '»', -- symbol used in the command line area that shows your active key combo | ||||
| 				separator = '➜ ', -- symbol used between a key and it's label | ||||
| 				group = '+', -- symbol prepended to a group | ||||
| 			}, | ||||
| 			window = { | ||||
| 				border = 'none', -- none, single, double, shadow | ||||
| 				position = 'bottom', -- bottom, top | ||||
| 				margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] | ||||
| 				padding = { 1, 1, 1, 1 }, -- extra window padding [top, right, bottom, left] | ||||
| 			}, | ||||
| 			layout = { | ||||
| 				height = { min = 4, max = 25 }, -- min and max height of the columns | ||||
| 				width = { min = 20, max = 50 }, -- min and max width of the columns | ||||
| 				spacing = 3, -- spacing between columns | ||||
| 			}, | ||||
| 			hidden = { '<silent>', '<cmd>', '<Cmd>', '<CR>', 'call', 'lua', '^:', '^ ' }, -- hide mapping boilerplate | ||||
| 			show_help = true, -- show help message on the command line when the popup is visible | ||||
| 		} | ||||
| 		local opts = { | ||||
| 			mode = 'n', -- NORMAL mode | ||||
| 			prefix = '<leader>', | ||||
| 			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 = false, -- use `nowait` when creating keymaps | ||||
| 		} | ||||
| 		local mappings = { | ||||
| 			['o'] = { '<cmd>e ~/.config/nvim/ <cr>', 'Neovim config' }, | ||||
| 			['rr'] = 'Search and replace all', | ||||
| 			['rs'] = 'Search and replace', | ||||
| 			['q'] = { '<cmd>lua UnMapDHM()<cr>', 'qwerty' }, | ||||
| 			['c'] = { '<cmd>lua MapDHM()<cr>', 'colemak' }, | ||||
| 			[';'] = { '<cmd>bd<cr>', 'Delete buffer' }, | ||||
| 			['<TAB>'] = { | ||||
| 				name = 'Tab', | ||||
| 				n = { '<cmd>tabnew<cr>', 'New' }, | ||||
| 				p = { '<cmd>tabp<cr>', 'Previous' }, | ||||
| 				d = { '<cmd>tabclose<cr>', 'Close' }, | ||||
| 				['<TAB>'] = { '<cmd>tabnext<cr>', 'Next' }, | ||||
| 				['1'] = { '1gt', 'Go to tab 1' }, | ||||
| 				['2'] = { '2gt', 'Go to tab 2' }, | ||||
| 				['3'] = { '3gt', 'Go to tab 3' }, | ||||
| 				['4'] = { '4gt', 'Go to tab 4' }, | ||||
| 				['5'] = { '5gt', 'Go to tab 5' }, | ||||
| 				['6'] = { '6gt', 'Go to tab 6' }, | ||||
| 				['7'] = { '7gt', 'Go to tab 7' }, | ||||
| 				['8'] = { '8gt', 'Go to tab 8' }, | ||||
| 				['9'] = { '9gt', 'Go to tab 9' }, | ||||
| 			}, | ||||
| 			w = { | ||||
| 				name = 'Window', | ||||
| 				v = { '<C-w>v', 'Vertical split' }, | ||||
| 				h = { '<C-w>s', 'Horizontal split' }, | ||||
| 			}, | ||||
| 		} | ||||
| 		wk.register(mappings, opts) | ||||
| 	end, | ||||
| } | ||||
| @ -1,13 +0,0 @@ | ||||
| return { | ||||
| 	'javiorfo/nvim-wildcat', | ||||
| 	lazy = true, | ||||
| 	cmd = { "WildcatRun" }, | ||||
| 	dependencies = { 'javiorfo/nvim-popcorn' }, | ||||
| 	opts = { | ||||
| 		tomcat = { | ||||
| 			home = "/home/fiplox/Software/apache-tomcat-10.1.13/", | ||||
| 			app_base = "webapps", | ||||
| 			default = true | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										17
									
								
								lua/utils.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								lua/utils.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| local M = {} | ||||
| 
 | ||||
| function M.telescope(builtin) | ||||
|     return function() | ||||
|         require("telescope.builtin")[builtin]() | ||||
|     end | ||||
| end | ||||
| 
 | ||||
| function M.get_or_default(value, default) | ||||
|     if value ~= nil then | ||||
|         return value | ||||
|     else | ||||
|         return default | ||||
|     end | ||||
| end | ||||
| 
 | ||||
| return M | ||||
							
								
								
									
										
											BIN
										
									
								
								spell/fr.utf-8.spl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								spell/fr.utf-8.spl
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								spell/fr.utf-8.sug
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								spell/fr.utf-8.sug
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Volodymyr Patuta
						Volodymyr Patuta