finish config
This commit is contained in:
parent
1a971cbdcf
commit
c131687240
57
init.lua
57
init.lua
|
@ -124,7 +124,8 @@ require('lazy').setup({
|
||||||
changedelete = { text = '~' },
|
changedelete = { text = '~' },
|
||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
|
||||||
|
{ buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
||||||
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
|
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
|
||||||
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
||||||
end,
|
end,
|
||||||
|
@ -132,11 +133,12 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
-- Theme inspired by Atom
|
'projekt0n/github-nvim-theme',
|
||||||
'navarasu/onedark.nvim',
|
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd.colorscheme 'onedark'
|
vim.cmd.colorscheme 'github_dark_high_contrast'
|
||||||
|
vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter', { fg = "green" })
|
||||||
|
vim.api.nvim_set_hl(0, 'VertSplit', { fg = "#212327" })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -147,7 +149,7 @@ require('lazy').setup({
|
||||||
opts = {
|
opts = {
|
||||||
options = {
|
options = {
|
||||||
icons_enabled = false,
|
icons_enabled = false,
|
||||||
theme = 'onedark',
|
theme = 'github_dark_high_contrast',
|
||||||
component_separators = '|',
|
component_separators = '|',
|
||||||
section_separators = '',
|
section_separators = '',
|
||||||
},
|
},
|
||||||
|
@ -201,8 +203,8 @@ require('lazy').setup({
|
||||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||||
-- These are some example plugins that I've included in the kickstart repository.
|
-- These are some example plugins that I've included in the kickstart repository.
|
||||||
-- Uncomment any of the lines below to enable them.
|
-- Uncomment any of the lines below to enable them.
|
||||||
-- require 'kickstart.plugins.autoformat',
|
require 'kickstart.plugins.autoformat',
|
||||||
-- require 'kickstart.plugins.debug',
|
require 'kickstart.plugins.debug',
|
||||||
|
|
||||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
||||||
|
@ -210,7 +212,7 @@ require('lazy').setup({
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||||
--
|
--
|
||||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||||
-- { import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
|
@ -218,7 +220,7 @@ require('lazy').setup({
|
||||||
-- NOTE: You can change these options as you wish!
|
-- NOTE: You can change these options as you wish!
|
||||||
|
|
||||||
-- Set highlight on search
|
-- Set highlight on search
|
||||||
vim.o.hlsearch = false
|
-- vim.o.hlsearch = false
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
|
@ -254,6 +256,9 @@ vim.o.completeopt = 'menuone,noselect'
|
||||||
-- NOTE: You should make sure your terminal supports this
|
-- NOTE: You should make sure your terminal supports this
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
|
|
||||||
|
-- remove cmd line height
|
||||||
|
vim.o.cmdheight = 0
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
|
|
||||||
-- Keymaps for better default experience
|
-- Keymaps for better default experience
|
||||||
|
@ -300,14 +305,14 @@ vim.keymap.set('n', '<leader>/', function()
|
||||||
winblend = 10,
|
winblend = 10,
|
||||||
previewer = false,
|
previewer = false,
|
||||||
})
|
})
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
end, { desc = 'Fuzzily search in current buffer' })
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
vim.keymap.set('n', '<leader>fg', require('telescope.builtin').git_files, { desc = '[F]ind [G]it files' })
|
||||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
vim.keymap.set('n', '<leader>ff', require('telescope.builtin').find_files, { desc = '[F]ind [F]iles' })
|
||||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
vim.keymap.set('n', '<leader>fh', require('telescope.builtin').help_tags, { desc = '[F]ind [H]elp' })
|
||||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
vim.keymap.set('n', '<leader>fcw', require('telescope.builtin').grep_string, { desc = '[F]earch [C]urrent [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>fw', require('telescope.builtin').live_grep, { desc = '[F]ind [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
vim.keymap.set('n', '<leader>fd', require('telescope.builtin').diagnostics, { desc = '[F]earch [D]iagnostics' })
|
||||||
|
|
||||||
-- [[ Configure Treesitter ]]
|
-- [[ Configure Treesitter ]]
|
||||||
-- See `:help nvim-treesitter`
|
-- See `:help nvim-treesitter`
|
||||||
|
@ -398,19 +403,19 @@ local on_attach = function(_, bufnr)
|
||||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
nmap('<leader>lr', vim.lsp.buf.rename, '[L]sp [R]ename')
|
||||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
nmap('<leader>la', vim.lsp.buf.code_action, '[L]sp code [A]ction')
|
||||||
|
|
||||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
nmap('gy', vim.lsp.buf.type_definition, '[G]oto T[y]pe Definition')
|
||||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
-- See `:help K` for why this keymap
|
||||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
nmap('<leader>k', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
-- Lesser used LSP functionality
|
||||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
@ -525,3 +530,15 @@ cmp.setup {
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|
||||||
|
-- bufferline keymaps
|
||||||
|
vim.keymap.set("n", "<C-,>", "<cmd>BufferLineCyclePrev<cr>", { desc = "Prev Buffer" })
|
||||||
|
vim.keymap.set("n", "<C-.>", "<cmd>BufferLineCycleNext<cr>", { desc = "Next Buffer" })
|
||||||
|
vim.keymap.set("n", "<C-A-,>", "<cmd>BufferLineMovePrev<cr>", { desc = "Move Buffer Prev" })
|
||||||
|
vim.keymap.set("n", "<C-A-.>", "<cmd>BufferLineMoveNext<cr>", { desc = "Move Buffer Next" })
|
||||||
|
|
||||||
|
|
||||||
|
local bufremove = require("mini.bufremove")
|
||||||
|
vim.keymap.set("n", "<leader>c", function() bufremove.delete(nil, false) end, { desc = "Close Buffer" })
|
||||||
|
vim.keymap.set("n", "<leader>C", function() bufremove.delete(nil, true) end, { desc = "Force Close Buffer" })
|
||||||
|
vim.keymap.set("n", "<leader>n", "<cmd>enew<cr>", { desc = "New Buffer" })
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
return {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
-- Optional dependency
|
||||||
|
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||||
|
config = function()
|
||||||
|
require("nvim-autopairs").setup {}
|
||||||
|
-- If you want to automatically add `(` after selecting a function or method
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
local cmp = require('cmp')
|
||||||
|
cmp.event:on(
|
||||||
|
'confirm_done',
|
||||||
|
cmp_autopairs.on_confirm_done()
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
return {
|
||||||
|
'akinsho/bufferline.nvim',
|
||||||
|
version = "*",
|
||||||
|
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||||
|
config = function()
|
||||||
|
local bufferline = require("bufferline")
|
||||||
|
bufferline.setup {
|
||||||
|
options = {
|
||||||
|
style_preset = bufferline.style_preset.minimal,
|
||||||
|
indicator = {
|
||||||
|
style = 'underline',
|
||||||
|
},
|
||||||
|
offsets = {
|
||||||
|
{
|
||||||
|
filetype = "NvimTree",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
show_buffer_close_icons = false,
|
||||||
|
show_close_icon = false,
|
||||||
|
separator_style = "thin",
|
||||||
|
diagnostics = "nvim_lsp",
|
||||||
|
diagnostics_update_in_insert = false,
|
||||||
|
-- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting
|
||||||
|
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||||
|
return "(" .. count .. ")"
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
-- vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||||
|
-- return {
|
||||||
|
-- "nvim-neo-tree/neo-tree.nvim",
|
||||||
|
-- version = "*",
|
||||||
|
-- dependencies = {
|
||||||
|
-- "nvim-lua/plenary.nvim",
|
||||||
|
-- "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
|
-- "MunifTanjim/nui.nvim",
|
||||||
|
-- },
|
||||||
|
-- config = function ()
|
||||||
|
-- require('neo-tree').setup {}
|
||||||
|
-- end,
|
||||||
|
-- }
|
||||||
|
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
|
return {
|
||||||
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
version = "*",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-tree/nvim-web-devicons"
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("nvim-tree").setup({
|
||||||
|
view = {
|
||||||
|
width = 36,
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
group_empty = true,
|
||||||
|
},
|
||||||
|
-- filters = {
|
||||||
|
-- dotfiles = true,
|
||||||
|
-- },
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local api = require "nvim-tree.api"
|
||||||
|
local function opts(desc)
|
||||||
|
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||||
|
end
|
||||||
|
api.config.mappings.default_on_attach(bufnr)
|
||||||
|
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
|
||||||
|
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('Close Parent'))
|
||||||
|
vim.keymap.set('n', 'l', api.node.open.edit, opts('Open'))
|
||||||
|
|
||||||
|
vim.cmd [[highlight link NvimTreeWinSeparator EndOfBuffer]]
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{ "<leader>o", "<cmd>:NvimTreeFocus<cr>", desc = "Focus NvimTree" }
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
return {
|
||||||
|
"echasnovski/mini.nvim",
|
||||||
|
version = "*",
|
||||||
|
config = function()
|
||||||
|
local bufremove = require("mini.bufremove")
|
||||||
|
bufremove.setup()
|
||||||
|
local cursorword = require("mini.cursorword")
|
||||||
|
cursorword.setup()
|
||||||
|
end
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
return {
|
||||||
|
'rmagatti/auto-session',
|
||||||
|
config = function()
|
||||||
|
require("auto-session").setup {
|
||||||
|
log_level = "error",
|
||||||
|
post_restore_cmds = {
|
||||||
|
function()
|
||||||
|
require('nvim-tree.api').tree.toggle(false, true)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
Loading…
Reference in New Issue