upload config
This commit is contained in:
parent
26942ecc56
commit
9a78f2e38c
192
init.lua
192
init.lua
|
@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
|||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed
|
||||
vim.g.have_nerd_font = false
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
|
@ -102,7 +102,9 @@ 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.cmd 'autocmd InsertEnter * :set relativenumber'
|
||||
vim.cmd 'autocmd InsertLeave * :set norelativenumber'
|
||||
vim.opt.cmdheight = 1
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
@ -237,9 +239,6 @@ require('lazy').setup({
|
|||
-- This is equivalent to:
|
||||
-- require('Comment').setup({})
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
{ 'numToStr/Comment.nvim', opts = {} },
|
||||
|
||||
-- Here is a more advanced example where we pass configuration
|
||||
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||
-- require('gitsigns').setup({ ... })
|
||||
|
@ -374,7 +373,7 @@ require('lazy').setup({
|
|||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
|
@ -388,7 +387,7 @@ require('lazy').setup({
|
|||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
vim.keymap.set('n', '<leader>fg', function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
|
@ -396,7 +395,7 @@ require('lazy').setup({
|
|||
end, { desc = '[S]earch [/] in Open Files' })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
vim.keymap.set('n', '<leader>ff', function()
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[S]earch [N]eovim files' })
|
||||
end,
|
||||
|
@ -702,7 +701,7 @@ require('lazy').setup({
|
|||
-- Accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
['<TAB>'] = cmp.mapping.confirm { select = true },
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
|
@ -745,19 +744,173 @@ require('lazy').setup({
|
|||
-- 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',
|
||||
'catppuccin/nvim',
|
||||
name = 'catppuccin',
|
||||
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'
|
||||
vim.cmd.colorscheme 'catppuccin-mocha'
|
||||
|
||||
-- You can configure highlights by doing something like:
|
||||
vim.cmd.hi 'Comment gui=none'
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {
|
||||
toggler = {
|
||||
-- Line-comment toggle keymap
|
||||
line = '<leader>a',
|
||||
-- Block-comment toggle keymap
|
||||
-- block = "<leader>a",
|
||||
},
|
||||
opleader = {
|
||||
---Line-comment keymap
|
||||
line = '<leader>a',
|
||||
-- -Block-comment keymap
|
||||
-- block = "<leader>a",
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = function()
|
||||
return {
|
||||
options = {
|
||||
theme = 'auto',
|
||||
section_separators = { left = '', right = '' },
|
||||
component_separators = { left = '', right = '' },
|
||||
globalstatus = true,
|
||||
-- disabled_filetypes = { statusline = { 'dashboard', 'alpha', 'TelescopePrompt' } },
|
||||
disabled_filestypes = {},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{
|
||||
'mode',
|
||||
icons_enabled = true,
|
||||
-- icon = "/ᐠﹷ ‸ ﹷ ᐟ\\ノ",
|
||||
icon = 'ฅ^•ﻌ•^ฅ',
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{ 'progress', padding = { left = 1, right = 0 }, separator = ' ' },
|
||||
{ 'location', padding = { left = 0, right = 1 } },
|
||||
{
|
||||
function()
|
||||
-- return tostring(vim.fn.wordcount().words) .. " Words" .. ", " .. "%L" .. " Lines"
|
||||
return tostring(vim.fn.wordcount().words) .. '-' .. '%L'
|
||||
end,
|
||||
},
|
||||
{ 'searchcount', maxcount = 999, timeout = 500 },
|
||||
},
|
||||
lualine_z = {
|
||||
-- "os.date('%a (%j/365)')",
|
||||
function()
|
||||
return ' ' .. os.date '%b %d(%a), %Y'
|
||||
end,
|
||||
-- "os.date('%b %d, %Y')",
|
||||
function()
|
||||
return ' ' .. os.date '%T %Z'
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvimdev/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
config = function()
|
||||
require('dashboard').setup {
|
||||
-- config
|
||||
theme = 'doom',
|
||||
hide = {
|
||||
-- this is taken care of by lualine
|
||||
-- enabling this messes up the actual laststatus setting after loading a file
|
||||
statusline = false,
|
||||
},
|
||||
config = {
|
||||
header = vim.split('Viet Do', '\n'),
|
||||
center = {
|
||||
{ action = 'Telescope find_files', desc = ' Find File', icon = ' ', key = 'f' },
|
||||
{ action = 'ene | startinsert', desc = ' New File', icon = ' ', key = 'n' },
|
||||
{ action = 'Telescope oldfiles', desc = ' Recent Files', icon = ' ', key = 'r' },
|
||||
{ action = 'Telescope live_grep', desc = ' Find Text', icon = ' ', key = 'g' },
|
||||
{ action = [[lua LazyVim.telescope.config_files()()]], desc = ' Config', icon = ' ', key = 'c' },
|
||||
{ action = 'lua require("persistence").load()', desc = ' Restore Session', icon = ' ', key = 's' },
|
||||
{ action = 'LazyExtras', desc = ' Lazy Extras', icon = ' ', key = 'x' },
|
||||
{ action = 'Lazy', desc = ' Lazy', icon = ' ', key = 'l' },
|
||||
{ action = 'qa', desc = ' Quit', icon = ' ', key = 'q' },
|
||||
},
|
||||
footer = function()
|
||||
local stats = require('lazy').stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return { '⚡ Neovim loaded ' .. stats.loaded .. '/' .. stats.count .. ' plugins in ' .. ms .. 'ms' }
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
dependencies = { { 'nvim-tree/nvim-web-devicons' } },
|
||||
},
|
||||
|
||||
{
|
||||
'akinsho/bufferline.nvim',
|
||||
event = 'VeryLazy',
|
||||
keys = {
|
||||
{ '<leader>bp', '<Cmd>BufferLineTogglePin<CR>', desc = 'Toggle Pin' },
|
||||
{ '<leader>bP', '<Cmd>BufferLineGroupClose ungrouped<CR>', desc = 'Delete Non-Pinned Buffers' },
|
||||
{ '<leader>bo', '<Cmd>BufferLineCloseOthers<CR>', desc = 'Delete Other Buffers' },
|
||||
{ '<leader>br', '<Cmd>BufferLineCloseRight<CR>', desc = 'Delete Buffers to the Right' },
|
||||
{ '<leader>bl', '<Cmd>BufferLineCloseLeft<CR>', desc = 'Delete Buffers to the Left' },
|
||||
{ '<S-h>', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
|
||||
{ '<S-l>', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
|
||||
{ '[b', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
|
||||
{ ']b', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
-- stylua: ignore
|
||||
close_command = function(n) require("mini.bufremove").delete(n, false) end,
|
||||
-- stylua: ignore
|
||||
right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end,
|
||||
diagnostics = 'nvim_lsp',
|
||||
always_show_bufferline = false,
|
||||
diagnostics_indicator = function(_, _, diag)
|
||||
local icons = require('lazyvim.config').icons.diagnostics
|
||||
local ret = (diag.error and icons.Error .. diag.error .. ' ' or '') .. (diag.warning and icons.Warn .. diag.warning or '')
|
||||
return vim.trim(ret)
|
||||
end,
|
||||
offsets = {
|
||||
{
|
||||
filetype = 'neo-tree',
|
||||
text = 'Neo-tree',
|
||||
highlight = 'Directory',
|
||||
text_align = 'left',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('bufferline').setup(opts)
|
||||
-- Fix bufferline when restoring a session
|
||||
vim.api.nvim_create_autocmd('BufAdd', {
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
pcall(nvim_bufferline)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Highlight todo, notes, etc in comments
|
||||
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||
|
||||
|
@ -779,21 +932,6 @@ require('lazy').setup({
|
|||
-- - sr)' - [S]urround [R]eplace [)] [']
|
||||
require('mini.surround').setup()
|
||||
|
||||
-- Simple and easy statusline.
|
||||
-- You could remove this setup call if you don't like it,
|
||||
-- and try some other statusline plugin
|
||||
local statusline = require 'mini.statusline'
|
||||
-- set use_icons to true if you have a Nerd Font
|
||||
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||
|
||||
-- You can configure sections in the statusline by overriding their
|
||||
-- default behavior. For example, here we set the section for
|
||||
-- cursor location to LINE:COLUMN
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return '%2l:%-2v'
|
||||
end
|
||||
|
||||
-- ... and there is more!
|
||||
-- Check out: https://github.com/echasnovski/mini.nvim
|
||||
end,
|
||||
|
@ -802,7 +940,7 @@ require('lazy').setup({
|
|||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
opts = {
|
||||
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
||||
ensure_installed = { 'bash', 'c', 'cpp', 'python', 'cmake', 'xml', 'yaml', 'json', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
|
|
Loading…
Reference in New Issue