new config!
This commit is contained in:
parent
f197d22a76
commit
2dae124a49
4 changed files with 254 additions and 19 deletions
147
init.lua
147
init.lua
|
|
@ -1,23 +1,38 @@
|
|||
local vim = vim
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
vim.o.showmode = true
|
||||
vim.o.hlsearch = false
|
||||
vim.o.wrap = true
|
||||
vim.o.tabstop = 4
|
||||
|
||||
vim.o.swapfile = false
|
||||
vim.g.have_nerd_font = true
|
||||
vim.o.mouse = 'a'
|
||||
vim.o.undofile = true
|
||||
vim.o.scrolloff = 10
|
||||
vim.o.cursorline = true
|
||||
vim.g.border = "rounded"
|
||||
vim.o.termguicolors = true
|
||||
vim.o.cursorline = true
|
||||
|
||||
vim.o.swapfile = false
|
||||
vim.o.mouse = 'a'
|
||||
vim.o.undofile = true
|
||||
|
||||
-- KEYMAPS ------------------------------------------------------
|
||||
-- diagnostic config
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
float = { source = 'always', border = 'rounded' }
|
||||
})
|
||||
|
||||
-- Highlight On Yank
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.hl.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
-- unset space so it can be used as leader
|
||||
vim.keymap.set("n", " ", "", { silent = true, remap = false })
|
||||
|
|
@ -42,17 +57,10 @@ vim.keymap.set("n", "<A-h>", ":BufferPrevious<CR>")
|
|||
vim.keymap.set("n", "<A-l>", ":BufferNext<CR>")
|
||||
vim.keymap.set("n", "<leader>x", ":BufferClose<CR>")
|
||||
|
||||
-- END KEYMAPS ------------------------------------------------------
|
||||
|
||||
|
||||
-- Highlight On Yank
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.hl.on_yank()
|
||||
end,
|
||||
})
|
||||
-- diagnostics
|
||||
vim.keymap.set("n", "<leader>ds", ":lua vim.diagnostic.open_float()<CR>")
|
||||
vim.keymap.set("n", "<leader>dn", function() vim.diagnostic.jump({ count = 1 }) end)
|
||||
vim.keymap.set("n", "<leader>dp", function() vim.diagnostic.jump({ count = -1 }) end)
|
||||
|
||||
-- VIM PACKS
|
||||
vim.pack.add({
|
||||
|
|
@ -65,6 +73,9 @@ vim.pack.add({
|
|||
{ src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
|
||||
{ src = 'https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim' },
|
||||
|
||||
-- treesitter
|
||||
{ src = 'https://github.com/nvim-treesitter/nvim-treesitter', branch = "main", build = ":TSUpdate", lazy = false},
|
||||
|
||||
-- bar and icons at the top
|
||||
{ src = 'https://github.com/nvim-tree/nvim-web-devicons' },
|
||||
{ src = 'https://github.com/romgrk/barbar.nvim' },
|
||||
|
|
@ -78,9 +89,42 @@ vim.pack.add({
|
|||
-- completion
|
||||
{ src = 'https://github.com/saghen/blink.cmp' },
|
||||
|
||||
-- lualine
|
||||
{ src = 'https://github.com/nvim-lualine/lualine.nvim' },
|
||||
|
||||
-- surround
|
||||
{ src = 'https://github.com/echasnovski/nvim-mini/mini.nvim' },
|
||||
|
||||
-- telescope
|
||||
{ src = 'https://github.com/nvim-lua/plenary.nvim' },
|
||||
{ src = 'https://github.com/nvim-telescope/telescope.nvim' },
|
||||
})
|
||||
|
||||
-- telescope (sadly these configs need to be after vimpack)
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = {},
|
||||
modules = {},
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
ignore_install = {},
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
vim.cmd("colorscheme everforest")
|
||||
|
||||
require "barbar".setup()
|
||||
require "mini.ai".setup()
|
||||
require "mini.surround".setup()
|
||||
require "mini.pairs".setup()
|
||||
require "nvim-tree".setup()
|
||||
require "auto-save".setup()
|
||||
require "blink.cmp".setup({
|
||||
|
|
@ -90,13 +134,78 @@ require "blink.cmp".setup({
|
|||
},
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme everforest")
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'everforest',
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
always_show_tabline = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
refresh_time = 16, -- ~60fps
|
||||
events = {
|
||||
'WinEnter',
|
||||
'BufEnter',
|
||||
'BufWritePost',
|
||||
'SessionLoadPost',
|
||||
'FileChangedShellPost', 'VimResized', 'Filetype',
|
||||
'CursorMoved',
|
||||
'CursorMovedI',
|
||||
'ModeChanged',
|
||||
},
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup()
|
||||
require('mason-tool-installer').setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"biome",
|
||||
"djlint",
|
||||
"emmet-language-server",
|
||||
"html-lsp",
|
||||
"lua-language-server",
|
||||
"lwc-language-server",
|
||||
"omnisharp",
|
||||
"prettier",
|
||||
"prettierd",
|
||||
"python-lsp-server",
|
||||
"roslyn",
|
||||
"ruff",
|
||||
"selene",
|
||||
"stylua",
|
||||
"typescript-language-server",
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
40
lua/custom/plugins/tabs.lua
Normal file
40
lua/custom/plugins/tabs.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
-- Tab display settings
|
||||
vim.opt.showtabline = 1 -- Always show tabline (0=never, 1=when multiple tabs, 2=always)
|
||||
vim.opt.tabline = '' -- Use default tabline (empty string uses built-in)
|
||||
|
||||
-- Transparent tabline appearance
|
||||
vim.cmd([[
|
||||
hi TabLineFill guibg=NONE ctermfg=242 ctermbg=NONE
|
||||
]])
|
||||
|
||||
-- Alternative navigation (more intuitive)
|
||||
vim.keymap.set('n', '<leader>tn', ':tabnew<CR>', { desc = 'New tab' })
|
||||
|
||||
-- Tab moving
|
||||
vim.keymap.set('n', '<leader>tm', ':tabmove<CR>', { desc = 'Move tab' })
|
||||
vim.keymap.set('n', '<leader>t>', ':tabmove +1<CR>', { desc = 'Move tab right' })
|
||||
vim.keymap.set('n', '<leader>t<', ':tabmove -1<CR>', { desc = 'Move tab left' })
|
||||
|
||||
-- Function to open file in new tab
|
||||
local function open_file_in_tab()
|
||||
vim.ui.input({ prompt = 'File to open in new tab: ', completion = 'file' }, function(input)
|
||||
if input and input ~= '' then
|
||||
vim.cmd('tabnew ' .. input)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Enhanced keybindings
|
||||
vim.keymap.set('n', '<leader>tO', open_file_in_tab, { desc = 'Open file in new tab' })
|
||||
|
||||
-- Function to close buffer but keep tab if it's the only buffer in tab
|
||||
local function smart_close_buffer()
|
||||
local buffers_in_tab = #vim.fn.tabpagebuflist()
|
||||
if buffers_in_tab > 1 then
|
||||
vim.cmd('bdelete')
|
||||
else
|
||||
-- If it's the only buffer in tab, close the tab
|
||||
vim.cmd('tabclose')
|
||||
end
|
||||
end
|
||||
vim.keymap.set('n', '<leader>x', smart_close_buffer, { desc = 'Smart close buffer/tab' })
|
||||
|
|
@ -28,6 +28,10 @@
|
|||
"rev": "557bce922401e247a596583679bc181d4d688554",
|
||||
"src": "https://github.com/neanias/everforest-nvim.git"
|
||||
},
|
||||
"lualine.nvim": {
|
||||
"rev": "3946f0122255bc377d14a59b27b609fb3ab25768",
|
||||
"src": "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
"mason-lspconfig.nvim": {
|
||||
"rev": "b1d9a914b02ba5660f1e272a03314b31d4576fe2",
|
||||
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
||||
|
|
@ -40,18 +44,42 @@
|
|||
"rev": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800",
|
||||
"src": "https://github.com/mason-org/mason.nvim"
|
||||
},
|
||||
"mini.nvim": {
|
||||
"rev": "6e885e4c27743ae6bf5957ea78ce86c032835f09",
|
||||
"src": "https://github.com/echasnovski/mini.nvim"
|
||||
},
|
||||
"nvim-lspconfig": {
|
||||
"rev": "abf6d190f2c06818489c0bd4b926e7e3a06c5e51",
|
||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
"nvim-surround": {
|
||||
"rev": "fcfa7e02323d57bfacc3a141f8a74498e1522064",
|
||||
"src": "https://github.com/kylechui/nvim-surround"
|
||||
},
|
||||
"nvim-tree.lua": {
|
||||
"rev": "1eda2569394f866360e61f590f1796877388cb8a",
|
||||
"src": "https://github.com/nvim-tree/nvim-tree.lua"
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"rev": "42fc28ba918343ebfd5565147a42a26580579482",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
"nvim-treesitter-textobjects": {
|
||||
"rev": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
|
||||
},
|
||||
"nvim-web-devicons": {
|
||||
"rev": "8dcb311b0c92d460fac00eac706abd43d94d68af",
|
||||
"src": "https://github.com/nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
"plenary.nvim": {
|
||||
"rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
|
||||
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
"telescope.nvim": {
|
||||
"rev": "83a3a713d6b2d2a408491a1b959e55a7fa8678e8",
|
||||
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
"vim-lsp-settings": {
|
||||
"rev": "139d4adf61f0699cc97744d4e6dfb8a6317397f5",
|
||||
"src": "https://github.com/mattn/vim-lsp-settings"
|
||||
|
|
|
|||
58
plugin/floaterminal.lua
Normal file
58
plugin/floaterminal.lua
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
||||
|
||||
local state = {
|
||||
floating = {
|
||||
buf = -1,
|
||||
win = -1,
|
||||
}
|
||||
}
|
||||
|
||||
local function create_floating_window(opts)
|
||||
opts = opts or {}
|
||||
local width = opts.width or math.floor(vim.o.columns * 0.8)
|
||||
local height = opts.height or math.floor(vim.o.lines * 0.8)
|
||||
|
||||
-- Calculate the position to center the window
|
||||
local col = math.floor((vim.o.columns - width) / 2)
|
||||
local row = math.floor((vim.o.lines - height) / 2)
|
||||
|
||||
-- Create a buffer
|
||||
local buf = nil
|
||||
if vim.api.nvim_buf_is_valid(opts.buf) then
|
||||
buf = opts.buf
|
||||
else
|
||||
buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer
|
||||
end
|
||||
|
||||
-- Define window configuration
|
||||
local win_config = {
|
||||
relative = "editor",
|
||||
width = width,
|
||||
height = height,
|
||||
col = col,
|
||||
row = row,
|
||||
style = "minimal", -- No borders or extra UI elements
|
||||
border = "rounded",
|
||||
}
|
||||
|
||||
-- Create the floating window
|
||||
local win = vim.api.nvim_open_win(buf, true, win_config)
|
||||
|
||||
return { buf = buf, win = win }
|
||||
end
|
||||
|
||||
local toggle_terminal = function()
|
||||
if not vim.api.nvim_win_is_valid(state.floating.win) then
|
||||
state.floating = create_floating_window { buf = state.floating.buf }
|
||||
if vim.bo[state.floating.buf].buftype ~= "terminal" then
|
||||
vim.cmd.terminal()
|
||||
end
|
||||
else
|
||||
vim.api.nvim_win_hide(state.floating.win)
|
||||
end
|
||||
end
|
||||
|
||||
-- Example usage:
|
||||
-- Create a floating window with default dimensions
|
||||
vim.api.nvim_create_user_command("Floaterminal", toggle_terminal, {})
|
||||
vim.keymap.set({ "n", "t" }, "<space>tt", toggle_terminal)
|
||||
Loading…
Reference in a new issue