mirror of
				https://github.com/halfdan/dotfiles.git
				synced 2025-10-31 12:36:12 +00:00 
			
		
		
		
	Egrepify and some keybindings
This commit is contained in:
		| @@ -118,3 +118,12 @@ vim.api.nvim_create_autocmd('User', { | ||||
|     deps_job:start() | ||||
|   end, | ||||
| }) | ||||
|  | ||||
| vim.api.nvim_create_autocmd('User', { | ||||
|   pattern = 'NeogitBranchCheckout', | ||||
|   group = group, | ||||
|   callback = function () | ||||
|     deps_job:and_then(compile_job) | ||||
|     deps_job:start() | ||||
|   end, | ||||
| }) | ||||
|   | ||||
| @@ -40,6 +40,12 @@ nnoremap('<leader>tk', '<C-w>t<C-w>K') | ||||
|  | ||||
| -- Keybindings below this are neovim cli only | ||||
| if vim.g.vscode then | ||||
|   -- Toggle Comment | ||||
|   vim.keymap.set('x', 'gc', '<Plug>VSCodeCommentary', {}) | ||||
|   vim.keymap.set('n', 'gc', '<Plug>VSCodeCommentary', {}) | ||||
|   vim.keymap.set('o', 'gc', '<Plug>VSCodeCommentary', {}) | ||||
|   vim.keymap.set('n', 'gcc', '<Plug>VSCodeCommentaryLine', {}) | ||||
|  | ||||
|   return | ||||
| end | ||||
|  | ||||
| @@ -65,6 +71,16 @@ nnoremap('<S-TAB>', ':bprevious<CR>') | ||||
| nnoremap('[q', ':cprev<CR>') | ||||
| nnoremap(']q', ':cnext<CR>') | ||||
|  | ||||
| -- no arrow keys | ||||
| nnoremap("<up>", "<nop>") | ||||
| nnoremap("<down>", "<nop>") | ||||
| nnoremap("<left>", "<nop>") | ||||
| nnoremap("<right>", "<nop>") | ||||
|  | ||||
| inoremap("<up>", "<nop>") | ||||
| inoremap("<down>", "<nop>") | ||||
| inoremap("<left>", "<nop>") | ||||
| inoremap("<right>", "<nop>") | ||||
|  | ||||
| -- Tagbar | ||||
| nnoremap('<Leader>hl', ':nohl<CR>') | ||||
|   | ||||
| @@ -7,7 +7,8 @@ local nnoremap = Remap.nnoremap | ||||
| local builtin = require("telescope.builtin") | ||||
|  | ||||
| nnoremap("<leader>gg", function() | ||||
|   builtin.live_grep() | ||||
|   -- builtin.live_grep() | ||||
|   require "telescope".extensions.egrepify.egrepify { sorting_strategy = 'ascending' } | ||||
| end) | ||||
| nnoremap("<C-p>", function() | ||||
|   builtin.commands() | ||||
|   | ||||
| @@ -1 +1,10 @@ | ||||
| local vim = vim | ||||
| local api = vim.api | ||||
|  | ||||
| vim.cmd([[autocmd TermOpen * setlocal nonumber norelativenumber]]) | ||||
|  | ||||
| local format_group = api.nvim_create_augroup("FormatGroup", { clear = true }) | ||||
| api.nvim_create_autocmd( | ||||
| 	{ "BufWinEnter", "BufReadPost" }, | ||||
| 	{ pattern = "*", command = "normal zR", group = format_group } | ||||
| ) | ||||
|   | ||||
| @@ -4,8 +4,8 @@ if vim.g.vscode then | ||||
|     -- VSCode extension | ||||
| else | ||||
|     -- ordinary Neovim | ||||
|   vim.notify = require("notify") | ||||
|   require("halfdan.lazy") | ||||
|   vim.notify = require("notify") | ||||
|  | ||||
|   require("halfdan.neogit") | ||||
|   -- require("halfdan.neorg") | ||||
|   | ||||
| @@ -11,8 +11,21 @@ if not vim.loop.fs_stat(lazypath) then | ||||
| end | ||||
| vim.opt.rtp:prepend(lazypath) | ||||
|  | ||||
| if vim.g.vscode then | ||||
|   return | ||||
| end | ||||
|  | ||||
| require("lazy").setup({ | ||||
|     {'TimUntersberger/neogit', dependencies = {'sindrets/diffview.nvim' } }, | ||||
|     { | ||||
|       "NeogitOrg/neogit", | ||||
|       dependencies = { | ||||
|         "nvim-lua/plenary.nvim",         -- required | ||||
|         "nvim-telescope/telescope.nvim", -- optional | ||||
|         "sindrets/diffview.nvim",        -- optional | ||||
|         "ibhagwan/fzf-lua",              -- optional | ||||
|       }, | ||||
|       config = true | ||||
|     }, | ||||
|     {'airblade/vim-gitgutter'}, | ||||
|  | ||||
|     -- Load .editorconfig files | ||||
| @@ -50,7 +63,7 @@ require("lazy").setup({ | ||||
|  | ||||
|  | ||||
|     {'preservim/tagbar'}, | ||||
|      | ||||
|  | ||||
|     -- Status Line and Bufferline | ||||
|     { | ||||
|       'nvim-lualine/lualine.nvim', | ||||
| @@ -65,7 +78,7 @@ require("lazy").setup({ | ||||
|     {'justinmk/vim-sneak'}, | ||||
|  | ||||
|     {'machakann/vim-highlightedyank'}, | ||||
|      | ||||
|  | ||||
|     -- LSP / Language Server Protocol | ||||
|     { | ||||
|       'neovim/nvim-lspconfig', | ||||
| @@ -108,17 +121,21 @@ require("lazy").setup({ | ||||
|         dependencies = { "nvim-lua/plenary.nvim" }, | ||||
|     }, | ||||
|  | ||||
|     {'simrat39/symbols-outline.nvim'}, | ||||
|     {'simrat39/symbols-outline.nvim', config=true}, | ||||
|     { | ||||
|       'numToStr/Comment.nvim', | ||||
|       config = function() | ||||
|         require('Comment').setup() | ||||
|       end | ||||
|     }, | ||||
|      | ||||
|  | ||||
|     -- Telescope fuzzy find files/grep | ||||
|     {'nvim-lua/popup.nvim'}, | ||||
|     {'nvim-lua/plenary.nvim'}, | ||||
|     { | ||||
|         "fdschmidt93/telescope-egrepify.nvim", | ||||
|         dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" } | ||||
|     }, | ||||
|     {'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, | ||||
|     {'nvim-telescope/telescope.nvim'}, | ||||
|     {'nvim-telescope/telescope-dap.nvim'}, | ||||
| @@ -144,27 +161,27 @@ require("lazy").setup({ | ||||
|       "elixir-tools/elixir-tools.nvim", | ||||
|       version = "*", | ||||
|       event = { "BufReadPre", "BufNewFile" }, | ||||
|       -- config = function() | ||||
|       --   local elixir = require("elixir") | ||||
|       --   local elixirls = require("elixir.elixirls") | ||||
|  | ||||
|       --   elixir.setup { | ||||
|       --     nextls = {enable = true}, | ||||
|       --     credo = {}, | ||||
|       --     elixirls = { | ||||
|       --       enable = false, | ||||
|       --       settings = elixirls.settings { | ||||
|       --         dialyzerEnabled = false, | ||||
|       --         enableTestLenses = false, | ||||
|       --       }, | ||||
|       --       on_attach = function(client, bufnr) | ||||
|       --         vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true }) | ||||
|       --         vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true }) | ||||
|       --         vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true }) | ||||
|       --       end, | ||||
|       --     } | ||||
|       --   } | ||||
|       -- end, | ||||
|       config = function() | ||||
|         local elixir = require("elixir") | ||||
|         local elixirls = require("elixir.elixirls") | ||||
| -- | ||||
|         elixir.setup { | ||||
|           nextls = {enable = false}, | ||||
|           credo = {}, | ||||
|           elixirls = { | ||||
|             enable = true, | ||||
|             settings = elixirls.settings { | ||||
|               dialyzerEnabled = false, | ||||
|               enableTestLenses = false, | ||||
|             }, | ||||
|             on_attach = function() | ||||
|               vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true }) | ||||
|               vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true }) | ||||
|               vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true }) | ||||
|             end, | ||||
|           } | ||||
|         } | ||||
|       end, | ||||
|       dependencies = { | ||||
|         "nvim-lua/plenary.nvim", | ||||
|       }, | ||||
|   | ||||
| @@ -8,5 +8,5 @@ neogit.setup { | ||||
| } | ||||
|  | ||||
| nnoremap("<leader>gs", function() | ||||
|     neogit.open({ }) | ||||
|     neogit.open({kind='split'}) | ||||
| end) | ||||
|   | ||||
| @@ -7,6 +7,26 @@ vim.o.titlestring="%<%F%=%l/%L - nvim" | ||||
| vim.wo.wrap = false -- Display long lines as just one line | ||||
| -- vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys | ||||
| -- vim.cmd('syntax on') -- syntax highlighting | ||||
| vim.o.foldmethod = "expr" | ||||
| vim.o.foldexpr = "nvim_treesitter#foldexpr()" | ||||
| vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] | ||||
| local fcs = vim.opt.fillchars:get() | ||||
|  | ||||
| -- Stolen from Akinsho | ||||
| local function get_fold(lnum) | ||||
| 	if vim.fn.foldlevel(lnum) <= vim.fn.foldlevel(lnum - 1) then return ' ' end | ||||
| 	return vim.fn.foldclosed(lnum) == -1 and fcs.foldopen or fcs.foldclose | ||||
| end  | ||||
|  | ||||
| _G.get_statuscol = function() | ||||
| 	return "%s%=" .. get_fold(vim.v.lnum) .. " %l  " | ||||
| end | ||||
|  | ||||
|  | ||||
| vim.o.statuscolumn = "%!v:lua.get_statuscol()" | ||||
| vim.o.foldcolumn = '0' | ||||
| vim.o.foldlevelstart = 99 | ||||
| vim.o.foldlevel = 99 -- Keep folds open by default | ||||
| vim.o.pumheight = 10 -- Makes popup menu smaller | ||||
| vim.o.fileencoding = "utf-8" -- The encoding written to file | ||||
| vim.o.cmdheight = 1 -- More space for displaying messages | ||||
| @@ -21,7 +41,7 @@ vim.o.shiftwidth = 2 -- Change the number of space characters inserted for inden | ||||
| vim.o.expandtab = true -- Converts tabs to spaces | ||||
| vim.bo.smartindent = false -- Makes indenting smart | ||||
| vim.wo.number = true -- set numbered lines | ||||
| vim.wo.relativenumber = true -- set relative number | ||||
| -- vim.wo.relativenumber = true -- set relative number | ||||
| vim.wo.cursorline = true -- Enable highlighting of the current line | ||||
| vim.o.showtabline = 1 -- Always show tabs | ||||
| vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore | ||||
|   | ||||
| @@ -64,3 +64,4 @@ require("telescope").load_extension("git_worktree") | ||||
| require('telescope').load_extension("fzf") | ||||
| require('telescope').load_extension("dap") | ||||
| require('telescope').load_extension("smart_open") | ||||
| require('telescope').load_extension("egrepify") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user