Merge changes from work
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-------------------------
|
||||
-------- OPTIONS --------
|
||||
-------------------------
|
||||
@ -46,14 +49,15 @@ vim.opt.autoread = true
|
||||
vim.opt.syntax = 'on'
|
||||
vim.opt.encoding = 'utf-8'
|
||||
vim.opt.completeopt = 'menu,menuone,noselect'
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
|
||||
----------------------------
|
||||
-------- CLIPBOARD ---------
|
||||
----------------------------
|
||||
-- if vim.fn.has("wsl") == 1 then
|
||||
vim.opt.clipboard:append('unnamedplus')
|
||||
-- end
|
||||
if vim.fn.has("wsl") == 1 then
|
||||
vim.opt.clipboard = vim.opt.clipboard + 'unnamedplus'
|
||||
end
|
||||
|
||||
|
||||
----------------------------
|
||||
@ -84,6 +88,40 @@ vim.api.nvim_create_autocmd('BufEnter', {
|
||||
command = 'silent! lcd %:p:h'
|
||||
})
|
||||
|
||||
-- Open nvim-tree when starting Neovim in a specific directory or any of its subdirectories
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
local args = vim.fn.argv()
|
||||
|
||||
if #args > 0 then
|
||||
local current_dir = vim.fn.fnamemodify(args[1], ":p:h")
|
||||
local dir_name = vim.fn.fnamemodify(current_dir, ":t")
|
||||
|
||||
-- Check if in a "notes" directory or its subdirectory
|
||||
local in_notes = dir_name == "notes"
|
||||
if not in_notes then
|
||||
-- Check if any parent directory is named "notes"
|
||||
local path_parts = vim.split(current_dir, "/", {plain = true})
|
||||
for i, part in ipairs(path_parts) do
|
||||
if part == "notes" then
|
||||
in_notes = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If in a notes directory or subdirectory, open the tree
|
||||
if in_notes then
|
||||
require("nvim-tree.api").tree.open()
|
||||
vim.defer_fn(function()
|
||||
require("nvim-tree.api").tree.expand_all()
|
||||
-- After expanding, return focus to the main window/buffer
|
||||
vim.cmd("wincmd p")
|
||||
end, 100) -- Small delay to ensure tree is fully loaded before expanding
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
---------------------------
|
||||
-------- FUNCTIONS --------
|
||||
@ -92,3 +130,4 @@ vim.api.nvim_create_autocmd('BufEnter', {
|
||||
vim.api.nvim_create_user_command('TrimWhiteSpace', function()
|
||||
vim.cmd('%s/\\s\\+$//e')
|
||||
end, {})
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ vim.keymap.set('n', '<leader>s', ':call WindowSwap#EasyWindowSwap()<CR>', {})
|
||||
|
||||
-- Convenience
|
||||
vim.keymap.set('n', '<leader>w', ':w<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<leader>F', ':e.<CR>', {})
|
||||
vim.keymap.set('n', '<leader>F', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', 'Y', 'y$', {})
|
||||
|
||||
-- Telescope
|
||||
|
||||
@ -27,7 +27,7 @@ cmp.setup({
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
['<Tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
|
||||
sources = cmp.config.sources({
|
||||
@ -97,7 +97,6 @@ lspconfig.dockerls.setup({ capabilities = capabilities })
|
||||
lspconfig.docker_compose_language_service.setup({ capabilities = capabilities })
|
||||
lspconfig.flow.setup({ capabilities = capabilities })
|
||||
lspconfig.marksman.setup({ capabilities = capabilities })
|
||||
lspconfig.als.setup({ capabilities = capabilities })
|
||||
lspconfig.sqls.setup({ capabilities = capabilities })
|
||||
lspconfig.yamlls.setup({ capabilities = capabilities })
|
||||
lspconfig.nil_ls.setup({ capabilities = capabilities })
|
||||
@ -188,3 +187,26 @@ require("copilot").setup({
|
||||
panel = { enabled = false },
|
||||
})
|
||||
require("copilot_cmp").setup()
|
||||
|
||||
vim.g.bullets_enabled_file_types = {
|
||||
'markdown',
|
||||
'text',
|
||||
'gitcommit',
|
||||
'scratch'
|
||||
}
|
||||
|
||||
|
||||
require("nvim-tree").setup({
|
||||
sort = {
|
||||
sorter = "case_sensitive",
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
-- filters = {
|
||||
-- dotfiles = true,
|
||||
-- },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user