203 lines
7.0 KiB
Diff
203 lines
7.0 KiB
Diff
diff --git a/init.lua b/init.lua
|
|
index 292ec07..19075db 100644
|
|
--- a/init.lua
|
|
+++ b/init.lua
|
|
@@ -101,8 +101,12 @@ vim.opt.number = true
|
|
-- Experiment for yourself to see if you like it!
|
|
-- vim.opt.relativenumber = true
|
|
|
|
+-- Make relative line numbers default
|
|
+vim.wo.number = true
|
|
+vim.wo.relativenumber = true
|
|
+
|
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
|
-vim.opt.mouse = 'a'
|
|
+vim.opt.mouse = ''
|
|
|
|
-- Don't show the mode, since it's already in status line
|
|
vim.opt.showmode = false
|
|
@@ -148,6 +152,14 @@ vim.opt.cursorline = true
|
|
-- Minimal number of screen lines to keep above and below the cursor.
|
|
vim.opt.scrolloff = 10
|
|
|
|
+-- Set foldmethod
|
|
+-- See `:help foldmethod`
|
|
+vim.opt.foldcolumn = '1'
|
|
+vim.opt.foldlevel = 99
|
|
+vim.opt.foldlevelstart = 99
|
|
+vim.opt.foldenable = true
|
|
+vim.opt.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
|
+
|
|
-- [[ Basic Keymaps ]]
|
|
-- See `:help vim.keymap.set()`
|
|
|
|
@@ -250,6 +262,66 @@ require('lazy').setup {
|
|
changedelete = { text = '~' },
|
|
},
|
|
},
|
|
+ on_attach = function(bufnr)
|
|
+ local gs = package.loaded.gitsigns
|
|
+
|
|
+ local function map(mode, l, r, opts)
|
|
+ opts = opts or {}
|
|
+ opts.buffer = bufnr
|
|
+ vim.keymap.set(mode, l, r, opts)
|
|
+ end
|
|
+
|
|
+ -- Navigation
|
|
+ map({ 'n', 'v' }, ']c', function()
|
|
+ if vim.wo.diff then
|
|
+ return ']c'
|
|
+ end
|
|
+ vim.schedule(function()
|
|
+ gs.next_hunk()
|
|
+ end)
|
|
+ return '<Ignore>'
|
|
+ end, { expr = true, desc = 'Jump to next hunk' })
|
|
+
|
|
+ map({ 'n', 'v' }, '[c', function()
|
|
+ if vim.wo.diff then
|
|
+ return '[c'
|
|
+ end
|
|
+ vim.schedule(function()
|
|
+ gs.prev_hunk()
|
|
+ end)
|
|
+ return '<Ignore>'
|
|
+ end, { expr = true, desc = 'Jump to previous hunk' })
|
|
+
|
|
+ -- Actions
|
|
+ -- visual mode
|
|
+ map('v', '<leader>hs', function()
|
|
+ gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
+ end, { desc = 'stage git hunk' })
|
|
+ map('v', '<leader>hr', function()
|
|
+ gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
+ end, { desc = 'reset git hunk' })
|
|
+ -- normal mode
|
|
+ map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
|
|
+ map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
|
|
+ map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
|
|
+ map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
|
|
+ map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
|
|
+ map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
|
|
+ map('n', '<leader>hb', function()
|
|
+ gs.blame_line { full = false }
|
|
+ end, { desc = 'git blame line' })
|
|
+ map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
|
|
+ map('n', '<leader>hD', function()
|
|
+ gs.diffthis '~'
|
|
+ end, { desc = 'git diff against last commit' })
|
|
+
|
|
+ -- Toggles
|
|
+ map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
|
|
+ map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
|
|
+
|
|
+ -- Text object
|
|
+ map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
|
|
+ end,
|
|
},
|
|
|
|
-- NOTE: Plugins can also be configured to run lua code when they are loaded.
|
|
@@ -544,6 +616,18 @@ require('lazy').setup {
|
|
-- tsserver = {},
|
|
--
|
|
|
|
+ elixirls = {
|
|
+ elixirLS = {
|
|
+ dialyzerEnabled = true,
|
|
+ dialyzerFormat = 'dialyxir_long',
|
|
+ fetchDeps = false,
|
|
+ mixEnv = 'test',
|
|
+ },
|
|
+ },
|
|
+ gopls = {},
|
|
+ helm_ls = {},
|
|
+ html = { filetypes = { 'html', 'twig', 'hbs' } },
|
|
+ htmx = {},
|
|
lua_ls = {
|
|
-- cmd = {...},
|
|
-- filetypes { ...},
|
|
@@ -570,6 +654,10 @@ require('lazy').setup {
|
|
},
|
|
},
|
|
},
|
|
+ pyright = {},
|
|
+ templ = {},
|
|
+ terraformls = {},
|
|
+ tsserver = {},
|
|
}
|
|
|
|
-- Ensure the servers and tools above are installed
|
|
@@ -596,6 +684,21 @@ require('lazy').setup {
|
|
-- by the server configuration above. Useful when disabling
|
|
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
|
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
|
+ -- overwrite elixirls for older versions of elixir
|
|
+ -- * elixir 1.11 use version 0.12.0
|
|
+ -- * elixir 1.12 use verions 0.14.6
|
|
+ if server_name == 'elixirls' then
|
|
+ local version = vim.fn.system('mise current elixir') or ''
|
|
+ local elixir_servers = {
|
|
+ { version = '^1.11', path = '/elixir-ls/release/v0.12.0/language_server.sh' },
|
|
+ { version = '^1.12', path = '/elixir-ls/release/v0.14.6/language_server.sh' },
|
|
+ }
|
|
+ for _, ex_server in ipairs(elixir_servers) do
|
|
+ if string.match(version, ex_server.version) == nil then goto continue end
|
|
+ server = vim.tbl_extend('keep', server, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. ex_server.path } })
|
|
+ ::continue::
|
|
+ end
|
|
+ end
|
|
require('lspconfig')[server_name].setup(server)
|
|
end,
|
|
},
|
|
@@ -781,7 +884,31 @@ require('lazy').setup {
|
|
|
|
---@diagnostic disable-next-line: missing-fields
|
|
require('nvim-treesitter.configs').setup {
|
|
- ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
|
|
+ ensure_installed = {
|
|
+ 'css',
|
|
+ 'dockerfile',
|
|
+ 'eex',
|
|
+ 'elixir',
|
|
+ 'erlang',
|
|
+ 'gitcommit',
|
|
+ 'go',
|
|
+ 'heex',
|
|
+ 'html',
|
|
+ 'http',
|
|
+ 'javascript',
|
|
+ 'json',
|
|
+ 'lua',
|
|
+ 'markdown',
|
|
+ 'markdown_inline',
|
|
+ 'python',
|
|
+ 'sql',
|
|
+ 'toml',
|
|
+ 'tsx',
|
|
+ 'typescript',
|
|
+ 'vim',
|
|
+ 'vimdoc',
|
|
+ 'yaml',
|
|
+ },
|
|
-- Autoinstall languages that are not installed
|
|
auto_install = true,
|
|
highlight = { enable = true },
|
|
@@ -807,14 +934,14 @@ require('lazy').setup {
|
|
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
|
--
|
|
-- require 'kickstart.plugins.debug',
|
|
- -- require 'kickstart.plugins.indent_line',
|
|
+ require 'kickstart.plugins.indent_line',
|
|
|
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
|
-- This is the easiest way to modularize your config.
|
|
--
|
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
|
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
|
- -- { import = 'custom.plugins' },
|
|
+ { import = 'custom.plugins' },
|
|
}
|
|
|
|
-- The line beneath this is called `modeline`. See `:help modeline`
|