This commit is contained in:
parent
a22976111e
commit
d106be5558
243
init.lua
243
init.lua
|
@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
|||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = false
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
|
@ -102,10 +102,10 @@ vim.g.have_nerd_font = false
|
|||
vim.opt.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
-- vim.opt.relativenumber = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
vim.opt.mouse = 'i'
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.opt.showmode = false
|
||||
|
@ -123,6 +123,7 @@ vim.opt.breakindent = true
|
|||
|
||||
-- Save undo history
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir'
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
|
@ -154,12 +155,54 @@ vim.opt.inccommand = 'split'
|
|||
-- Show which line your cursor is on
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
-- Minimal number of screen lines tExo keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Personnal Keymaps
|
||||
-- normal mode
|
||||
vim.keymap.set('n', '<leader>e', '<cmd>Ex<CR>')
|
||||
|
||||
vim.keymap.set('n', '<leader>ra', ':%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>', { desc = 'Replace the word under the cursor in the file' })
|
||||
|
||||
vim.keymap.set('n', '<leader>v', '<cmd>vsplit<CR>', { desc = 'Vertical split' })
|
||||
|
||||
vim.keymap.set('n', '<leader>x', '<cmd>!chmod +x %<CR>', { desc = 'Make the current buffer/file executable' })
|
||||
|
||||
vim.keymap.set('n', ';', ':', { desc = 'Replace : by ;' })
|
||||
|
||||
vim.keymap.set('n', 'Q', ':noh<CR>')
|
||||
|
||||
vim.keymap.set('n', '<leader>w', ':w<CR>')
|
||||
|
||||
-- insert mode
|
||||
vim.keymap.set('i', '<C-h>', '<left>')
|
||||
vim.keymap.set('i', '<C-j>', '<down>')
|
||||
vim.keymap.set('i', '<C-k>', '<up>')
|
||||
vim.keymap.set('i', '<C-l>', '<right>')
|
||||
|
||||
-- while in insert mode, go to the start of line
|
||||
vim.keymap.set('i', '<C-b>', '<ESC>^i')
|
||||
|
||||
-- while in insert mode, go to end of line
|
||||
vim.keymap.set('i', '<C-e>', '<End>')
|
||||
|
||||
-- better escape insert mode
|
||||
vim.keymap.set('i', 'jk', '<Esc>')
|
||||
|
||||
-- visual mode
|
||||
|
||||
-- better escape visual mode
|
||||
vim.keymap.set('v', 'sd', '<Esc>')
|
||||
|
||||
-- move the highlighted line(s) up and indent if needed
|
||||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'make the selected hightlighted line and go up one line, indent if possible and highlight it again' })
|
||||
|
||||
-- move te highlighted line(s) down and indent if needed
|
||||
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'make the selected hightlighted line and go down one line, indent if possible and highlight it again' })
|
||||
-- end personnal keymaps
|
||||
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
-- See `:help hlsearch`
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
@ -204,6 +247,16 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
end,
|
||||
})
|
||||
|
||||
-- [[ Configure and install plugins ]]
|
||||
--
|
||||
-- To check the current status of your plugins, run
|
||||
-- :Lazy
|
||||
--
|
||||
-- You can press `?` in this menu for help. Use `:q` to close the window
|
||||
--
|
||||
-- To update plugins you can run
|
||||
-- :Lazy update
|
||||
--
|
||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
|
@ -215,17 +268,6 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|||
end
|
||||
end ---@diagnostic disable-next-line: undefined-field
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- [[ Configure and install plugins ]]
|
||||
--
|
||||
-- To check the current status of your plugins, run
|
||||
-- :Lazy
|
||||
--
|
||||
-- You can press `?` in this menu for help. Use `:q` to close the window
|
||||
--
|
||||
-- To update plugins you can run
|
||||
-- :Lazy update
|
||||
--
|
||||
-- NOTE: Here is where you install your plugins.
|
||||
require('lazy').setup({
|
||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||
|
@ -238,6 +280,45 @@ require('lazy').setup({
|
|||
-- Use `opts = {}` to force a plugin to be loaded.
|
||||
--
|
||||
|
||||
{
|
||||
'ThePrimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
|
||||
init = function()
|
||||
local harpoon = require 'harpoon'
|
||||
|
||||
-- REQUIRED
|
||||
harpoon:setup()
|
||||
-- REQUIRED
|
||||
|
||||
local map = vim.keymap.set
|
||||
|
||||
map('n', '<leader>a', function()
|
||||
harpoon:list():add()
|
||||
end)
|
||||
map('n', '<C-h>', function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end)
|
||||
|
||||
map('n', '<leader>1', function()
|
||||
harpoon:list():select(1)
|
||||
end, { desc = '[Harpoon] Go to first buffer saved' })
|
||||
map('n', '<leader>2', function()
|
||||
harpoon:list():select(2)
|
||||
end, { desc = '[Harpoon] Go to second buffer saved' })
|
||||
map('n', '<leader>3', function()
|
||||
harpoon:list():select(3)
|
||||
end, { desc = '[Harpoon] Go to third buffer saved' })
|
||||
map('n', '<leader>4', function()
|
||||
harpoon:list():select(4)
|
||||
end, { desc = '[Harpoon] Go to forth buffer saved' })
|
||||
map('n', '<leader>5', function()
|
||||
harpoon:list():select(5)
|
||||
end, { desc = '[Harpoon] Go to forth buffer saved' })
|
||||
end,
|
||||
},
|
||||
|
||||
-- Here is a more advanced example where we pass configuration
|
||||
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||
-- require('gitsigns').setup({ ... })
|
||||
|
@ -245,15 +326,6 @@ require('lazy').setup({
|
|||
-- See `:help gitsigns` to understand what the configuration keys do
|
||||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
||||
|
@ -318,7 +390,7 @@ require('lazy').setup({
|
|||
{ '<leader>d', group = '[D]ocument' },
|
||||
{ '<leader>r', group = '[R]ename' },
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>w', group = '[W]orkspace' },
|
||||
-- { '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
},
|
||||
|
@ -386,8 +458,12 @@ require('lazy').setup({
|
|||
-- mappings = {
|
||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
||||
-- },
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
-- },
|
||||
-- pickers = {}
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
|
@ -413,13 +489,13 @@ require('lazy').setup({
|
|||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
-- vim.keymap.set('n', '<leader>/', function()
|
||||
-- -- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
-- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
-- winblend = 10,
|
||||
-- previewer = false,
|
||||
-- })
|
||||
-- end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
|
@ -533,7 +609,7 @@ require('lazy').setup({
|
|||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
-- map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
|
@ -605,8 +681,29 @@ require('lazy').setup({
|
|||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
clangd = {
|
||||
cmd = { 'clangd' },
|
||||
filetypes = { 'c', 'cpp' },
|
||||
root_dir = function(fname)
|
||||
return require('lspconfig.util').root_pattern '.clang.format'(fname)
|
||||
end,
|
||||
},
|
||||
|
||||
gopls = {
|
||||
settings = {
|
||||
gopls = {
|
||||
experimentalPostfixCompletions = true,
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
shadow = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
init_options = {
|
||||
usePlaceholders = true,
|
||||
},
|
||||
},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
|
@ -685,7 +782,7 @@ require('lazy').setup({
|
|||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
local disable_filetypes = {}
|
||||
local lsp_format_opt
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
lsp_format_opt = 'never'
|
||||
|
@ -699,6 +796,7 @@ require('lazy').setup({
|
|||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
c = { 'clangd' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
|
@ -796,16 +894,16 @@ require('lazy').setup({
|
|||
--
|
||||
-- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- <c-h> is similar, except moving you backwards.
|
||||
['<C-l>'] = cmp.mapping(function()
|
||||
['<Tab>'] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-h>'] = cmp.mapping(function()
|
||||
end, { 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
end, { 's' }),
|
||||
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
|
@ -824,21 +922,50 @@ require('lazy').setup({
|
|||
end,
|
||||
},
|
||||
|
||||
{ -- You can easily change to a different colorscheme.
|
||||
-- { -- You can easily change to a different colorscheme.
|
||||
-- Change the name of the colorscheme plugin below, and then
|
||||
-- change the command in the config to whatever the name of that colorscheme is.
|
||||
--
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
init = function()
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
-- 'folke/tokyonight.nvim',
|
||||
-- priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
-- init = function()
|
||||
-- -- Load the colorscheme here.
|
||||
-- -- Like many other themes, this one has different styles, and you could load
|
||||
-- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
-- vim.cmd.colorscheme 'tokyonight-night'
|
||||
--
|
||||
-- -- You can configure highlights by doing something like:
|
||||
-- vim.cmd.hi 'Comment gui=none'
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- You can configure highlights by doing something like:
|
||||
vim.cmd.hi 'Comment gui=none'
|
||||
{ -- Modified gruvbox
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
|
||||
priority = 1000,
|
||||
init = function()
|
||||
require('gruvbox').setup {
|
||||
contrast = 'hard',
|
||||
bold = false,
|
||||
palette_overrides = {
|
||||
-- 6th shade from default
|
||||
dark0_hard = '#0e1010',
|
||||
|
||||
-- 4th shade from the default (See color-hex.com)
|
||||
bright_purple = '#935d6c',
|
||||
dark1 = '#2a2725',
|
||||
bright_red = '#af3324',
|
||||
bright_yellow = '#af8420',
|
||||
bright_orange = '#b15911',
|
||||
bright_green = '#80821a',
|
||||
bright_aqua = '#638656',
|
||||
light1 = '#a4997c',
|
||||
},
|
||||
}
|
||||
|
||||
vim.o.background = 'dark'
|
||||
vim.cmd.colorscheme 'gruvbox'
|
||||
end,
|
||||
},
|
||||
|
||||
|
@ -888,7 +1015,7 @@ require('lazy').setup({
|
|||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
opts = {
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'go', 'javascript', 'css' },
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
|
@ -898,7 +1025,7 @@ require('lazy').setup({
|
|||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
-- indent = { enable = true, disable = { 'ruby', 'c' } },
|
||||
},
|
||||
-- There are additional nvim-treesitter modules that you can use to interact
|
||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||
|
@ -919,17 +1046,17 @@ require('lazy').setup({
|
|||
--
|
||||
-- require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
-- require 'kickstart.plugins.autopairs',
|
||||
require 'kickstart.plugins.lint',
|
||||
require 'kickstart.plugins.autopairs',
|
||||
-- require 'kickstart.plugins.neo-tree',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
-- 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' },
|
||||
}, {
|
||||
ui = {
|
||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||
|
|
|
@ -2,4 +2,12 @@
|
|||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
return {
|
||||
{
|
||||
'brenoprata10/nvim-highlight-colors',
|
||||
|
||||
config = function()
|
||||
require('nvim-highlight-colors').setup {}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue