diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 535e7e2..b242ab2 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -2,6 +2,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 + -- Set highlight on search vim.o.hlsearch = false @@ -53,7 +54,6 @@ vim.o.wrap = true vim.o.foldmethod = "expr" vim.o.foldexpr = "nvim_treesitter#foldexpr()" --- vim.o.nofoldenable = true vim.o.foldlevelstart = 99 -- show cursor line only in active window @@ -70,6 +70,14 @@ vim.api.nvim_create_autocmd( -- Auto format on save vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] +-- Auto update on file changes +vim.o.autoread = true +vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, { + command = "if mode() != 'c' | checktime | endif", + pattern = { "*" }, +}) +vim.api.nvim_create_autocmd({ "FileChangedShellPost" }, + { command = 'echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None', pattern = { "*" }, }) ------------------------------------------------------------------- -- Plugin management ------------------------------------------------------------------- @@ -235,6 +243,40 @@ require('lazy').setup({ }, }, + { + 's1n7ax/nvim-window-picker', + version = '2.*', + config = function() + require 'window-picker'.setup({ + filter_rules = { + include_current_win = false, + autoselect_one = true, + -- filter using buffer options + bo = { + -- if the file type is one of following, the window will be ignored + filetype = { 'neo-tree', "neo-tree-popup", "notify" }, + -- if the buffer type is one of following, the window will be ignored + buftype = { 'terminal', "quickfix" }, + }, + }, + highlights = { + statusline = { + unfocused = { + fg = '#d7af5f', + bg = '#262626', + bold = true, + }, + focused = { + fg = '#d7af5f', + bg = '#262626', + bold = true, + }, + }, + }, + }) + end, + }, + { "nvim-neo-tree/neo-tree.nvim", branch = "v3.x", @@ -242,45 +284,12 @@ require('lazy').setup({ "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons", "MunifTanjim/nui.nvim", - { - 's1n7ax/nvim-window-picker', - version = '2.*', - config = function() - require 'window-picker'.setup({ - filter_rules = { - include_current_win = false, - autoselect_one = true, - -- filter using buffer options - bo = { - -- if the file type is one of following, the window will be ignored - filetype = { 'neo-tree', "neo-tree-popup", "notify" }, - -- if the buffer type is one of following, the window will be ignored - buftype = { 'terminal', "quickfix" }, - }, - }, - highlights = { - statusline = { - unfocused = { - fg = '#d7af5f', - bg = '#262626', - bold = true, - }, - focused = { - fg = '#d7af5f', - bg = '#262626', - bold = true, - }, - }, - }, - }) - end, - }, }, config = function() require("neo-tree").setup { close_if_last_window = true, popup_border_style = "rounded", - enable_git_status = true, + enable_git_status = false, enable_diagnostics = true, open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes sort_case_insensitive = false, -- used when sorting files and directories in the tree @@ -1017,11 +1026,3 @@ vim.keymap.set('n', 'c', ":tabclose", { desc = 'Format code', silent vim.keymap.set('n', 'e', ":Neotree filesystem reveal float toggle", { desc = 'File explorer', silent = true }) vim.keymap.set('n', 's', ":HopWord", { desc = 'hop', silent = true }) vim.keymap.set('n', 't', ":TroubleToggle", { desc = 'Trouble view', silent = true }) - -vim.o.autoread = true -vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, { - command = "if mode() != 'c' | checktime | endif", - pattern = { "*" }, -}) -vim.api.nvim_create_autocmd({ "FileChangedShellPost" }, - { command = 'echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None', pattern = { "*" }, })