Testing autoread

This commit is contained in:
Christoffer Martinsson 2024-10-20 12:21:06 +02:00
parent 557abcdb18
commit 640e90e088

View File

@ -2,7 +2,11 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.o.autoread = true
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
command = "if mode() != 'c' | checktime | endif",
pattern = { "*" },
})
-- Set highlight on search
vim.o.hlsearch = false
@ -243,13 +247,138 @@ 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,
use_libuv_file_watcher = true,
popup_border_style = "rounded",
enable_git_status = true,
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
sort_function = nil, -- use a custom function for sorting files and directories in the tree
-- sort_function = function (a,b)
-- if a.type == b.type then
-- return a.path > b.path
-- else
-- return a.type > b.type
-- end
-- end , -- this sorts files and directories descendantly
default_component_configs = {
indent = { padding = 0, indent_size = 1 },
container = {
enable_character_fade = true
},
indent = {
indent_size = 2,
padding = 1, -- extra padding on left hand side
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
-- expander config, needed for nesting files
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "󰜌",
provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available
if node.type == "file" or node.type == "terminal" then
local success, web_devicons = pcall(require, "nvim-web-devicons")
local name = node.type == "terminal" and "terminal" or node.name
if success then
local devicon, hl = web_devicons.get_icon(name)
icon.text = devicon or icon.text
icon.highlight = hl or icon.highlight
end
end
end,
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon"
},
modified = {
symbol = "[+]",
highlight = "NeoTreeModified",
},
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
-- Change type
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", -- this can only be used in the git_status source
renamed = "󰁕", -- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
conflict = "",
}
},
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
file_size = {
enabled = true,
required_width = 64, -- min width of window required to show this column
},
type = {
enabled = true,
required_width = 122, -- min width of window required to show this column
},
last_modified = {
enabled = true,
required_width = 88, -- min width of window required to show this column
},
created = {
enabled = true,
required_width = 110, -- min width of window required to show this column
},
symlink_target = {
enabled = false,
},
},
commands = {
parent_or_close = function(state)
@ -309,6 +438,7 @@ require('lazy').setup({
end,
},
window = {
position = "float",
width = 30,
mappings = {
["<space>"] = false, -- disable space until we figure out which-key disabling
@ -317,33 +447,10 @@ require('lazy').setup({
Y = "copy_selector",
},
},
filesystem = {
use_libuv_file_watcher = true,
},
}
end,
},
{
"s1n7ax/nvim-window-picker",
opts = {
use_winbar = "smart",
highlights = {
statusline = {
unfocused = {
fg = '#d7af5f',
bg = '#262626',
bold = true,
},
focused = {
fg = '#d7af5f',
bg = '#262626',
bold = true,
},
},
},
}
},
-- GUI ------------------------------------------------------
-- {
@ -912,6 +1019,6 @@ vim.keymap.set('n', '<C-s>', ":write<cr>", { desc = 'Save', silent = true })
vim.keymap.set('n', '<C-q>', ":quit<cr>", { desc = 'Quit', silent = true })
vim.keymap.set('n', '<leader>n', ":tabnew<cr>", { desc = 'Format code', silent = true })
vim.keymap.set('n', '<leader>c', ":tabclose<cr>", { desc = 'Format code', silent = true })
vim.keymap.set('n', '<leader>e', ":Neotree filesystem reveal left toggle<cr>", { desc = 'File explorer', silent = true })
vim.keymap.set('n', '<leader>e', ":Neotree filesystem reveal float toggle<cr>", { desc = 'File explorer', silent = true })
vim.keymap.set('n', 's', ":HopWord<cr>", { desc = 'hop', silent = true })
vim.keymap.set('n', '<leader>t', ":TroubleToggle<cr>", { desc = 'Trouble view', silent = true })