AVT2DSXIYISFKWLX4LJVMFAAVCRTDE4QX7MZ72PXQVSOXTPMYYKAC vim.env.LAZY_STDPATH = '~/.vim/.repro'load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))()---@diagnostic disable-next-line: missing-fieldsrequire('lazy.minit').repro({spec = {{'saghen/blink.cmp',-- please test on `main` if possible-- otherwise, remove this line and set `version = '*'`-- build = 'cargo build --release',version = '*',opts = {completion = {menu = {draw = {columns = {{ 'label', gap = 1 },{ 'kind_icon', 'label_description', gap = 1 },},components = {label_description = {text = function(ctx)return ctx.label_description ~= '' and ctx.label_description or ctx.item.detailend,},},},},},},opts_extend = { 'sources.default' },},{'mason-org/mason.nvim',build = ':MasonUpdate',opts = {},},{'mason-org/mason-lspconfig.nvim',dependencies = { 'mason-org/mason.nvim', 'neovim/nvim-lspconfig' },opts = {ensure_installed = {'hls',},},},},})vim.lsp.enable({'hls',})
require('nvim-treesitter.configs').setup {-- A list of parser names, or "all"ensure_installed = {"lua","html","css","javascript","typescript","scheme","haskell","c","rust","python",},--incremental_selection = { enable = true },--textobjects = { enable = true },-- Install parsers synchronously (only applied to `ensure_installed`)sync_install = false,auto_install = true,-- List of parsers to ignore installing (for "all")--ignore_install = { "javascript" },highlight = {-- `false` will disable the whole extensionenable = false,-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is-- the name of the parser)-- list of language that will be disabled--disable = { "c", "rust" },-- Setting this to true will run `:h syntax` and tree-sitter at the same time.-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).-- Using this option may slow down your editor, and you may see some duplicate highlights.-- Instead of true it can also be a list of languagesadditional_vim_regex_highlighting = false,},}local ts_utils = require 'nvim-treesitter.ts_utils'-- -- ^ not using "highlight" in config to prevent error on loading files which have a vim swap file-- -- however, the following can be used to automatically enable it after:-- vim.api.nvim_create_autocmd('FileType', {-- group = vim.api.nvim_create_augroup('treesitter', {}),-- callback = function(ev)-- local max_filesize = 100 * 1024 -- 100 KB-- local parsers = require("nvim-treesitter.parsers")-- local lang = parsers.ft_to_lang(ev.match)-- if not parsers.has_parser(lang) then-- return-- end-- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(ev.buf))-- if ok and stats and stats.size > max_filesize then-- return-- end-- vim.treesitter.start(ev.buf)-- end,-- })
vim.cmd([[ set undodir=$HOME/.config/nvim/undo ]])vim.cmd([[ set t_Co=256 ]])vim.cmd([[ set termguicolors ]])vim.cmd([[ let g:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', '```':'```', '"""':'"""', "'''":"'''", "`":"`"} ]])
vim.opt.undodir = vim.fn.expand('~/.config/nvim/undo')vim.opt.termguicolors = true
local opts = { noremap = true, silent = true }-- zero_picker: vcs-aware file finder for telescopelocal zero_picker = function(picker_opts)local pickers = require('telescope.pickers')local finders = require('telescope.finders')local conf = require('telescope.config').valuespicker_opts = picker_opts or {}local finder_title, finder_cmdlocal check_dir = function(dir) return vim.fn.isdirectory(dir) == 1 endif check_dir('.git') thenfinder_title = 'git files'finder_cmd = { 'git', 'ls-files' }elseif check_dir('_darcs') thenfinder_title = 'darcs files'finder_cmd = { 'sh', '-c', 'darcs show files --no-directories | cut -c3-' }elseif check_dir('.pijul') thenfinder_title = 'pijul files'finder_cmd = { 'fd', '-Htf', '-E', '.pijul' }elsefinder_title = 'files'finder_cmd = { 'fd', '-t', 'f', '-H' }endpickers.new(picker_opts, {prompt_title = finder_title,finder = finders.new_oneshot_job(finder_cmd, picker_opts),sorter = conf.file_sorter(picker_opts),previewer = conf.file_previewer(picker_opts),}):find()end-- Telescope highlight overrides — re-applied on every colorscheme changelocal function apply_telescope_highlights()local highlights = {TelescopeSelection = { fg = 'none', bg = 'none' },TelescopeSelectionCaret = { fg = '#79d4d5', bg = 'none' },TelescopeMultiSelection = { fg = 'none', bg = '#202020' },TelescopeNormal = { fg = 'none', bg = '#262626' },TelescopeBorder = { fg = 'none', bg = 'none' },TelescopePromptBorder = { fg = 'none', bg = '#202020' },TelescopeResultsBorder = { fg = 'none', bg = '#262626' },TelescopePreviewBorder = { fg = 'none', bg = '#262626' },TelescopeMatching = { fg = '#79d4d5', bg = 'none' },TelescopePromptPrefix = { fg = 'none', bg = 'none' },TelescopePromptNormal = { fg = 'none', bg = '#202020' },TelescopePromptTitle = { fg = 'none', bg = 'none' },TelescopePreviewTitle = { fg = '#262626', bg = 'none' },TelescopeResultsTitle = { fg = '#202020', bg = 'none' },}for hl, col in pairs(highlights) dovim.api.nvim_set_hl(0, hl, col)endendapply_telescope_highlights()vim.api.nvim_create_autocmd('ColorScheme', { callback = apply_telescope_highlights })require('lazy').setup({{ -- color schemes{ 'alligator/accent.vim',config = function()vim.g.accent_colour = 'cyan'vim.g.accent_darken = 1vim.g.accent_invert_status = 0vim.g.accent_auto_cwd_colour = 1vim.g.accent_no_bg = 1end,},'kadekillary/skull-vim','lokaltog/vim-monotone','arcticicestudio/nord-vim','hardselius/warlock','sainnhe/everforest','logico/typewriter-vim','reedes/vim-colors-pencil','junegunn/seoul256.vim','sainnhe/gruvbox-material','sonph/onehalf','EdenEast/nightfox.nvim','nordtheme/vim','joshdick/onedark.vim','folke/tokyonight.nvim','morhetz/gruvbox',},{'RRethy/vim-illuminate',config = function()require('illuminate').configure({providers = { 'lsp', 'treesitter', 'regex' },delay = 9,filetype_overrides = {},filetypes_denylist = { 'dirbuf', 'dirvish', 'fugitive' },filetypes_allowlist = {},modes_denylist = {},modes_allowlist = {},providers_regex_syntax_denylist = {},providers_regex_syntax_allowlist = {},under_cursor = true,large_file_cutoff = nil,large_file_overrides = nil,min_count_to_highlight = 1,should_enable = function(bufnr) return true end,case_insensitive_regex = false,})end,},{'jiangmiao/auto-pairs',config = function()vim.g.AutoPairsMultilineClose = 0end,},{'norcalli/nvim-colorizer.lua',config = function()require('colorizer').setup({ '*', '!TelescopePrompt', '!TelescopeResults' },{mode = 'background',RGB = true,RRGGBB = true,names = false,RRGGBBAA = true,rgb_fn = true,hsl_fn = true,css = false,css_fn = false,})vim.api.nvim_create_autocmd('TextChanged', { command = 'ColorizerAttachToBuffer' })end,},{'mbbill/undotree',config = function()vim.g.undotree_WindowLayout = 2vim.g.undotree_ShortIndicators = 1vim.g.undotree_SplitWidth = 29vim.g.undotree_DiffpanelHeight = 10vim.g.undotree_DiffAutoOpen = 1vim.g.undotree_SetFocusWhenToggle = 1vim.g.undotree_TreeNodeShape = '*'vim.g.undotree_TreeVertShape = '|'vim.g.undotree_TreeSplitShape = '/'vim.g.undotree_TreeReturnShape = '\\'vim.g.undotree_DiffCommand = 'diff -s'vim.g.undotree_RelativeTimestamp = 1vim.g.undotree_HighlightChangedText = 1vim.g.undotree_HighlightChangedWithSign = 1vim.g.undotree_HighlightSyntaxAdd = 'DiffAdd'vim.g.undotree_HighlightSyntaxChange = 'DiffChange'vim.g.undotree_HighlightSyntaxDel = 'DiffDelete'vim.g.undotree_HelpLine = 1vim.g.undotree_CursorLine = 1vim.keymap.set('n', '<leader>u', '<cmd>UndotreeToggle<cr>', opts)vim.keymap.set('n', '<C-w>u', '<cmd>UndotreeShow | UndotreeFocus<cr>', opts)vim.keymap.set('n', '<C-w>U', '<cmd>UndotreeHide<cr>', opts)vim.keymap.set('n', '<C-w><C-u>', '<cmd>UndotreeShow<cr>', opts)end,},'junegunn/goyo.vim','junegunn/limelight.vim','907th/vim-auto-save',{'lewis6991/gitsigns.nvim',init = function()require('gitsigns').setup({signs = {add = { text = '│' },change = { text = '│' },delete = { text = '└' },topdelete = { text = '┌' },changedelete = { text = '├' },untracked = { text = '┤' },},signs_staged = {add = { text = '│' },change = { text = '│' },delete = { text = '└' },topdelete = { text = '┌' },changedelete = { text = '├' },untracked = { text = '┤' },},signs_staged_enable = true,})end,},{'Eiko-Tokura/darcssigns.nvim',init = function()require('darcssigns').setup({enabled = true,signs = {add = { text = '│', hl = 'DarcsSignsAdd' },change = { text = '│', hl = 'DarcsSignsChange' },delete = { text = '└', hl = 'DarcsSignsDelete' },untracked = { text = '┤', hl = 'DarcsSignsUntracked' },},})end,},{'nvim-telescope/telescope.nvim',dependencies = {'nvim-lua/plenary.nvim',{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },},config = function()local actions = require('telescope.actions')local action_layout = require('telescope.actions.layout')require('telescope').setup {defaults = {initial_mode = 'insert',layout_strategy = 'horizontal',layout_config = {prompt_position = 'top',preview_cutoff = 0,height = 0.9,width = 0.9,preview_width = 0.5,},sorting_strategy = 'ascending',scroll_strategy = 'cycle',file_ignore_patterns = { '.git/[^h]' },winblend = 0,previewer = true,preview = {treesitter = false,syntax = true,},show_line = false,prompt_prefix = '',prompt_title = false,results_title = false,selection_strategy = 'reset',border = {},borderchars = {prompt = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },results = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },preview = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },},default_selection_index = 1,mappings = {i = {['<C-h>'] = actions.which_key,['<C-j>'] = actions.move_selection_next,['<C-k>'] = actions.move_selection_previous,['<C-l>'] = actions.toggle_selection,['<C-q>'] = actions.close,['<C-BS>'] = false,['<C-w>'] = action_layout.toggle_preview,['<C-u>'] = actions.preview_scrolling_up,['<C-d>'] = actions.preview_scrolling_down,['<PageUp>'] = actions.preview_scrolling_up,['<PageDown>'] = actions.preview_scrolling_down,['<M-S-,>'] = actions.cycle_history_prev,['<M-S-.>'] = actions.cycle_history_next,},n = {['?'] = actions.which_key,['<ESC>'] = actions.close,['q'] = actions.close,['w'] = action_layout.toggle_preview,['<C-u>'] = actions.preview_scrolling_up,['<C-d>'] = actions.preview_scrolling_down,['<PageUp>'] = actions.preview_scrolling_up,['<PageDown>'] = actions.preview_scrolling_down,},},},pickers = {colorscheme = { enable_preview = true },find_files = {find_command = { 'fd', '-t', 'f', '-H' },hidden = true,},buffers = {show_all_buffers = true,sort_lastused = true,mappings = {i = { ['<c-d>'] = 'delete_buffer' },},},},extensions = {fzf = {fuzzy = true,override_generic_sorter = true,override_file_sorter = true,case_mode = 'smart_case',},},}require('telescope').load_extension('fzf')
vim.keymap.set('n', '<leader>T', '<cmd>Telescope<cr>', opts)vim.keymap.set('n', '<leader>t', builtin.resume, opts)vim.keymap.set('n', '<leader>?', builtin.help_tags, opts)vim.keymap.set('n', '<leader>F', builtin.find_files, opts)vim.keymap.set('n', '<leader>f', zero_picker, opts)vim.keymap.set('n', '<leader>g', builtin.git_commits, opts)vim.keymap.set('n', '<leader>G', builtin.git_bcommits, opts)vim.keymap.set('n', '<leader>v', builtin.live_grep, opts)vim.keymap.set('n', '<leader>/', builtin.grep_string, opts)vim.keymap.set('n', '<leader>k', builtin.lsp_dynamic_workspace_symbols, opts)vim.keymap.set('n', '<leader>K', builtin.lsp_definitions, opts)vim.keymap.set('n', '<leader>b', builtin.buffers, opts)vim.keymap.set('n', '<leader>d', builtin.diagnostics, opts)vim.keymap.set('n', '<leader>j', builtin.jumplist, opts)vim.keymap.set('n', '<leader>r', builtin.registers, opts)vim.keymap.set('n', '<leader>m', builtin.marks, opts)vim.keymap.set('n', '<leader>q', builtin.quickfix, opts)vim.keymap.set('n', '<leader>l', builtin.loclist, opts)-- fzf command (kept alongside telescope)vim.cmd([[ command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0) ]])vim.keymap.set('n', '<leader>z', '<cmd>FZF!<cr>', opts)-- -- open telescope when nvim is invoked with a directory argument-- vim.api.nvim_create_autocmd('VimEnter', {-- callback = function()-- local arg = vim.fn.argv(0)-- if arg ~= '' and vim.fn.isdirectory(arg) == 1 then-- vim.cmd('cd ' .. vim.fn.fnameescape(arg))-- vim.schedule(function() zero_picker() end)-- end-- end,-- })end,},{'vifm/vifm.vim',init = function()vim.g.loaded_netrw = 1vim.g.loaded_netrwPlugin = 1vim.g.vifm_replace_netrw = 1vim.g.vifm_replace_netrw_cmd = 'Vifm'end,config = function()vim.g.vifm_embed_term = 1vim.keymap.set('n', '<leader>x', '<cmd>Vifm<cr>', opts)end,},-- {-- 'ibhagwan/fzf-lua',-- -- optional for icon support-- -- dependencies = { 'nvim-tree/nvim-web-devicons' },-- -- or if using mini.icons/mini.nvim-- -- dependencies = { 'echasnovski/mini.icons' },-- opts = {}-- },-- {-- 'folke/flash.nvim',-- event = 'VeryLazy',-- ---@type Flash.Config-- opts = {-- incremental = true,-- modes = {-- search = { enabled = false },-- },-- prompt = {-- enabled = true,-- prefix = { { ' ', 'FlashPromptIcon' } },-- },-- },-- -- stylua: ignore-- keys = {-- { 's', mode = { 'n', 'x', 'o' }, function() require('flash').jump() end, desc = 'Flash' },-- { 'S', mode = { 'n', 'x', 'o' }, function() require('flash').treesitter() end, desc = 'Flash Treesitter' },-- { 'r', mode = 'o', function() require('flash').remote() end, desc = 'Remote Flash' },-- { 'R', mode = { 'o', 'x' }, function() require('flash').treesitter_search() end, desc = 'Treesitter Search' },-- { '<c-s>', mode = { 'c' }, function() require('flash').toggle() end, desc = 'Toggle Flash Search' },-- },-- },-- {-- 'nvim-telescope/telescope-file-browser.nvim',-- dependencies = {-- 'nvim-telescope/telescope.nvim',-- 'nvim-lua/plenary.nvim'-- },-- init = function()-- vim.g.loaded_netrw = 1-- vim.g.loaded_netrwPlugin = 1-- end,-- config = function()-- require('telescope').setup {-- extensions = {-- file_browser = {-- hijack_netrw = true,-- hidden = false, -- show hidden files-- respect_gitignore = true,-- dir_icon = " ",-- }-- }-- }-- require('telescope').load_extension('file_browser')---- -- Open file browser (mimics your Vifm setup)-- vim.keymap.set('n', '-', ':Telescope file_browser path=%:p:h select_buffer=true<CR>',-- { desc = 'Open file browser' })-- end,-- },
local opts = { noremap = true, silent = true }
{'nvim-treesitter/nvim-treesitter',lazy = true,build = ':TSUpdate',config = function()require('config-treesitter')end,},
-- color schemesvim.pack.add({'https://github.com/alligator/accent.vim','https://github.com/kadekillary/skull-vim','https://github.com/lokaltog/vim-monotone','https://github.com/arcticicestudio/nord-vim','https://github.com/hardselius/warlock','https://github.com/sainnhe/everforest','https://github.com/logico/typewriter-vim','https://github.com/reedes/vim-colors-pencil','https://github.com/junegunn/seoul256.vim','https://github.com/sainnhe/gruvbox-material','https://github.com/EdenEast/nightfox.nvim','https://github.com/nordtheme/vim','https://github.com/joshdick/onedark.vim','https://github.com/folke/tokyonight.nvim','https://github.com/morhetz/gruvbox',})
-- lsp{ 'mason-org/mason.nvim', config = true },{'neovim/nvim-lspconfig',config = function()require('config-lsp')end,},{'mason-org/mason-lspconfig.nvim',opts = {ensure_installed = is_64bit and {'rust_analyzer', 'hls', 'ts_ls', 'lua_ls',} or {'ts_ls',},},dependencies = { 'mason-org/mason.nvim', 'neovim/nvim-lspconfig' },},
vim.g.accent_colour = 'cyan'vim.g.accent_darken = 1vim.g.accent_invert_status = 0vim.g.accent_auto_cwd_colour = 1vim.g.accent_no_bg = 1
{'saghen/blink.cmp',enabled = jit.arch == 'x64' or jit.arch == 'arm64',dependencies = { 'rafamadriz/friendly-snippets' },version = '1.*',---@module 'blink.cmp'---@type blink.cmp.Configopts = {keymap = {preset = 'none',['<TAB>'] = { 'select_next', 'fallback' },['<S-TAB>'] = { 'select_prev', 'fallback' },['<C-N>'] = { 'select_next', 'fallback' },['<C-P>'] = { 'select_prev', 'fallback' },['<C-K>'] = { 'show_documentation', 'fallback' },['<C-U>'] = { 'scroll_documentation_up', 'fallback' },['<C-D>'] = { 'scroll_documentation_down', 'fallback' },['<C-C>'] = { 'cancel', 'fallback' },},appearance = { nerd_font_variant = 'mono' },completion = {documentation = { auto_show = false },menu = {auto_show = true,draw = {padding = 1,columns = {{ 'label', gap = 1 },{ 'kind_icon', 'label_description', gap = 1 },},components = {label_description = {text = function(ctx)return ctx.label_description ~= '' and ctx.label_description or ctx.item.detailend,},},},max_height = 6,},ghost_text = { enabled = true, show_with_menu = true },list = {selection = { preselect = false, auto_insert = true },},},cmdline = {keymap = { preset = 'inherit' },completion = {menu = { auto_show = true },list = { selection = { preselect = false, auto_insert = true } },},},sources = {default = { 'lsp', 'path', 'buffer' },},signature = { enabled = true },fuzzy = { implementation = 'prefer_rust' },},opts_extend = { 'sources.default' },},
vim.pack.add({ 'https://github.com/jiangmiao/auto-pairs' })vim.g.AutoPairs = { ['('] = ')', ['['] = ']', ['{'] = '}', ['"'] = '"', ['```'] = '```', ['"""'] = '"""', ["'''"] = "'''", ['`'] = '`' }vim.g.AutoPairsMultilineClose = 0
-- {-- 'hrsh7th/nvim-cmp',-- -- load cmp on InsertEnter-- event = 'InsertEnter',-- -- these dependencies will only be loaded when cmp loads-- -- dependencies are always lazy-loaded unless specified otherwise-- dependencies = {-- 'hrsh7th/cmp-nvim-lsp',-- 'hrsh7th/cmp-buffer',-- 'hrsh7th/cmp-path',-- 'hrsh7th/cmp-cmdline',-- 'hrsh7th/cmp-vsnip',-- 'hrsh7th/vim-vsnip',-- },-- config = function()-- require('config-cmp')-- end,-- },-- {-- 'folke/noice.nvim',-- event = 'VeryLazy',-- opts = {-- -- add any options here-- },-- dependencies = {-- -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries-- 'MunifTanjim/nui.nvim',-- -- -- OPTIONAL:-- -- -- `nvim-notify` is only needed, if you want to use the notification view.-- -- -- If not available, we use `mini` as the fallback-- -- 'rcarriga/nvim-notify',-- }-- },
vim.pack.add({ 'https://github.com/RRethy/vim-illuminate' })require('illuminate').configure({providers = { 'lsp', 'treesitter', 'regex' },delay = 9,filetypes_denylist = { 'dirbuf', 'dirvish', 'fugitive' },under_cursor = true,min_count_to_highlight = 1,should_enable = function(bufnr) return true end,case_insensitive_regex = false,})
'stevearc/oil.nvim',opts = {lazy = false,default_file_explorer = true,columns = {-- 'icon','permissions',-- 'size',-- 'mtime',},},vim.keymap.set('n', '<leader>o', '<cmd>Oil<cr>', opts)},}, { install = { missing = false } })
mode = 'background',RGB = true,RRGGBB = true,names = false,RRGGBBAA = true,rgb_fn = true,hsl_fn = true,css = false,css_fn = false,})vim.api.nvim_create_autocmd('TextChanged', { command = 'ColorizerAttachToBuffer' })
-- Swarm LSP — started outside lazy since it's not a pluginif vim.fn.executable('swarm') == 1 thenvim.lsp.start({name = 'Swarm Language Server',cmd = { 'swarm', 'lsp' },})end
-- vim.pack.add({ 'https://github.com/mbbill/undotree' })-- vim.g.undotree_WindowLayout = 2-- vim.g.undotree_ShortIndicators = 1-- vim.g.undotree_SplitWidth = 29-- vim.g.undotree_DiffpanelHeight = 10-- vim.g.undotree_DiffAutoOpen = 1-- vim.g.undotree_SetFocusWhenToggle = 1-- vim.g.undotree_TreeNodeShape = '*'-- vim.g.undotree_TreeVertShape = '|'-- vim.g.undotree_TreeSplitShape = '/'-- vim.g.undotree_TreeReturnShape = '\\'-- vim.g.undotree_DiffCommand = 'diff -s'-- vim.g.undotree_RelativeTimestamp = 1-- vim.g.undotree_HighlightChangedText = 1-- vim.g.undotree_HighlightChangedWithSign = 1-- vim.g.undotree_HighlightSyntaxAdd = 'DiffAdd'-- vim.g.undotree_HighlightSyntaxChange = 'DiffChange'-- vim.g.undotree_HighlightSyntaxDel = 'DiffDelete'-- vim.g.undotree_HelpLine = 1-- vim.g.undotree_CursorLine = 1-- vim.keymap.set('n', '<leader>u', '<cmd>UndotreeToggle<cr>', opts)-- vim.keymap.set('n', '<C-w>u', '<cmd>UndotreeShow | UndotreeFocus<cr>', opts)-- vim.keymap.set('n', '<C-w>U', '<cmd>UndotreeHide<cr>', opts)-- vim.keymap.set('n', '<C-w><C-u>', '<cmd>UndotreeShow<cr>', opts)
-- toggle autosave per buffervim.cmd([[let g:auto_save = 0function BufferAutoSaveToggle()if exists('b:auto_save')let b:auto_save = !b:auto_saveelselet b:auto_save = 1endifif b:auto_save == 1echo 'autosave on'elseecho 'autosave off'endifendfunctioncommand BufferAutoSave call BufferAutoSaveToggle()nnoremap <leader>a :BufferAutoSave<cr>]])
vim.pack.add({'https://github.com/junegunn/goyo.vim','https://github.com/junegunn/limelight.vim','https://github.com/907th/vim-auto-save',})
let g:auto_save = 0function BufferAutoSaveToggle()if exists('b:auto_save')let b:auto_save = !b:auto_saveelselet b:auto_save = 1endifif b:auto_save == 1echo 'autosave on'elseecho 'autosave off'endifendfunctioncommand BufferAutoSave call BufferAutoSaveToggle()nnoremap <leader>a :BufferAutoSave<cr>
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'if not vim.loop.fs_stat(lazypath) thenvim.fn.system({'git','clone','--filter=blob:none','https://github.com/folke/lazy.nvim.git','--branch=stable',lazypath,})
vim.pack.add({ 'https://github.com/lewis6991/gitsigns.nvim' })require('gitsigns').setup({signs = {add = { text = '│' },change = { text = '│' },delete = { text = '└' },topdelete = { text = '┌' },changedelete = { text = '├' },untracked = { text = '┤' },},signs_staged = {add = { text = '│' },change = { text = '│' },delete = { text = '└' },topdelete = { text = '┌' },changedelete = { text = '├' },untracked = { text = '┤' },},signs_staged_enable = true,})vim.pack.add({ 'https://github.com/Eiko-Tokura/darcssigns.nvim' })require('darcssigns').setup({enabled = true,signs = {add = { text = '│', hl = 'DarcsSignsAdd' },change = { text = '│', hl = 'DarcsSignsChange' },delete = { text = '└', hl = 'DarcsSignsDelete' },untracked = { text = '┤', hl = 'DarcsSignsUntracked' },},})vim.pack.add({ 'https://github.com/vifm/vifm.vim' })vim.g.loaded_netrw = 1vim.g.loaded_netrwPlugin = 1vim.g.vifm_replace_netrw = 1vim.g.vifm_replace_netrw_cmd = 'Vifm'vim.g.vifm_embed_term = 1vim.keymap.set('n', '<leader>x', '<cmd>Vifm<cr>', opts)vim.pack.add({ 'https://github.com/stevearc/oil.nvim' })require('oil').setup({default_file_explorer = true,columns = { 'permissions' },})vim.keymap.set('n', '<leader>o', '<cmd>Oil<cr>', opts)-- -------------------------------------------------------------- telescope-- ------------------------------------------------------------vim.pack.add({'https://github.com/nvim-lua/plenary.nvim','https://github.com/nvim-telescope/telescope-fzf-native.nvim','https://github.com/nvim-telescope/telescope.nvim',})vim.api.nvim_create_autocmd('PackChanged', {callback = function(ev)if ev.data.spec.name == 'telescope-fzf-native.nvim' thenvim.system({ 'make' }, { cwd = ev.data.path })endend,})local function apply_telescope_highlights()local highlights = {TelescopeSelection = { fg = 'none', bg = 'none' },TelescopeSelectionCaret = { fg = '#79d4d5', bg = 'none' },TelescopeMultiSelection = { fg = 'none', bg = '#202020' },TelescopeNormal = { fg = 'none', bg = '#262626' },TelescopeBorder = { fg = 'none', bg = 'none' },TelescopePromptBorder = { fg = 'none', bg = '#202020' },TelescopeResultsBorder = { fg = 'none', bg = '#262626' },TelescopePreviewBorder = { fg = 'none', bg = '#262626' },TelescopeMatching = { fg = '#79d4d5', bg = 'none' },TelescopePromptPrefix = { fg = 'none', bg = 'none' },TelescopePromptNormal = { fg = 'none', bg = '#202020' },TelescopePromptTitle = { fg = 'none', bg = 'none' },TelescopePreviewTitle = { fg = '#262626', bg = 'none' },TelescopeResultsTitle = { fg = '#202020', bg = 'none' },}for hl, col in pairs(highlights) dovim.api.nvim_set_hl(0, hl, col)end
vim.opt.rtp:prepend(lazypath)
apply_telescope_highlights()vim.api.nvim_create_autocmd('ColorScheme', { callback = apply_telescope_highlights })local actions = require('telescope.actions')local action_layout = require('telescope.actions.layout')require('telescope').setup {defaults = {initial_mode = 'insert',layout_strategy = 'horizontal',layout_config = {prompt_position = 'top',preview_cutoff = 0,height = 0.9,width = 0.9,preview_width = 0.5,},sorting_strategy = 'ascending',scroll_strategy = 'cycle',file_ignore_patterns = { '.git/[^h]' },winblend = 0,previewer = true,preview = {treesitter = false,syntax = true,},show_line = false,prompt_prefix = '',prompt_title = false,results_title = false,selection_strategy = 'reset',border = {},borderchars = {prompt = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },results = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },preview = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },},default_selection_index = 1,mappings = {i = {['<C-h>'] = actions.which_key,['<C-j>'] = actions.move_selection_next,['<C-k>'] = actions.move_selection_previous,['<C-l>'] = actions.toggle_selection,['<C-q>'] = actions.close,['<C-BS>'] = false,['<C-w>'] = action_layout.toggle_preview,['<C-u>'] = actions.preview_scrolling_up,['<C-d>'] = actions.preview_scrolling_down,['<PageUp>'] = actions.preview_scrolling_up,['<PageDown>'] = actions.preview_scrolling_down,['<M-S-,>'] = actions.cycle_history_prev,['<M-S-.>'] = actions.cycle_history_next,},n = {['?'] = actions.which_key,['<ESC>'] = actions.close,['q'] = actions.close,['w'] = action_layout.toggle_preview,['<C-u>'] = actions.preview_scrolling_up,['<C-d>'] = actions.preview_scrolling_down,['<PageUp>'] = actions.preview_scrolling_up,['<PageDown>'] = actions.preview_scrolling_down,},},},pickers = {colorscheme = { enable_preview = true },find_files = {find_command = { 'fd', '-t', 'f', '-H' },hidden = true,},buffers = {show_all_buffers = true,sort_lastused = true,mappings = {i = { ['<c-d>'] = 'delete_buffer' },},},},extensions = {fzf = {fuzzy = true,override_generic_sorter = true,override_file_sorter = true,case_mode = 'smart_case',},},}
require('telescope').load_extension('fzf')local builtin = require('telescope.builtin')local zero_picker = function(picker_opts)local pickers = require('telescope.pickers')local finders = require('telescope.finders')local conf = require('telescope.config').valuespicker_opts = picker_opts or {}local finder_title, finder_cmdlocal check_dir = function(dir) return vim.fn.isdirectory(dir) == 1 endif check_dir('.git') thenfinder_title = 'git files'finder_cmd = { 'git', 'ls-files' }elseif check_dir('_darcs') thenfinder_title = 'darcs files'finder_cmd = { 'sh', '-c', 'darcs show files --no-directories | cut -c3-' }elseif check_dir('.pijul') thenfinder_title = 'pijul files'finder_cmd = { 'fd', '-Htf', '-E', '.pijul' }elsefinder_title = 'files'finder_cmd = { 'fd', '-t', 'f', '-H' }endpickers.new(picker_opts, {prompt_title = finder_title,finder = finders.new_oneshot_job(finder_cmd, picker_opts),sorter = conf.file_sorter(picker_opts),previewer = conf.file_previewer(picker_opts),}):find()endvim.keymap.set('n', '<leader>T', '<cmd>Telescope<cr>', opts)vim.keymap.set('n', '<leader>t', builtin.resume, opts)vim.keymap.set('n', '<leader>?', builtin.help_tags, opts)vim.keymap.set('n', '<leader>F', builtin.find_files, opts)vim.keymap.set('n', '<leader>f', zero_picker, opts)vim.keymap.set('n', '<leader>g', builtin.git_commits, opts)vim.keymap.set('n', '<leader>G', builtin.git_bcommits, opts)vim.keymap.set('n', '<leader>v', builtin.live_grep, opts)vim.keymap.set('n', '<leader>/', builtin.grep_string, opts)vim.keymap.set('n', '<leader>k', builtin.lsp_dynamic_workspace_symbols, opts)vim.keymap.set('n', '<leader>K', builtin.lsp_definitions, opts)vim.keymap.set('n', '<leader>b', builtin.buffers, opts)vim.keymap.set('n', '<leader>d', builtin.diagnostics, opts)vim.keymap.set('n', '<leader>j', builtin.jumplist, opts)vim.keymap.set('n', '<leader>r', builtin.registers, opts)vim.keymap.set('n', '<leader>m', builtin.marks, opts)vim.keymap.set('n', '<leader>q', builtin.quickfix, opts)vim.keymap.set('n', '<leader>l', builtin.loclist, opts)vim.cmd([[ command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0) ]])vim.keymap.set('n', '<leader>z', '<cmd>FZF!<cr>', opts)vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })require('nvim-treesitter').install { "lua", "html", "css", "javascript", "typescript", "scheme", "haskell", "c", "rust", "python" }require('nvim-treesitter').setup {-- A list of parser names, or "all"ensure_installed = { "lua", "html", "css", "javascript", "typescript", "scheme", "haskell", "c", "rust", "python" },-- incremental_selection = { enable = true },-- textobjects = { enable = true },-- Install parsers synchronously (only applied to `ensure_installed`)sync_install = false,auto_install = true,-- List of parsers to ignore installing (for "all")-- ignore_install = { "javascript" },highlight = {enable = false,-- disable = { "c", "rust" },-- Setting additional_vim_regex_highlighting to true will run `:h syntax` and tree-sitter at the same time.-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).-- Using this option may slow down your editor, and you may see some duplicate highlights.-- Instead of true it can also be a list of languagesadditional_vim_regex_highlighting = false,},}vim.api.nvim_create_autocmd('PackChanged', {callback = function(ev)if ev.data.spec.name == 'nvim-treesitter' and ev.data.kind == 'update' thenif not ev.data.active then vim.cmd.packadd('nvim-treesitter') endvim.cmd('TSUpdate')endend,})vim.pack.add({'https://github.com/mason-org/mason.nvim','https://github.com/neovim/nvim-lspconfig','https://github.com/mason-org/mason-lspconfig.nvim',})require('mason').setup()require('mason-lspconfig').setup({ensure_installed = (jit.arch == 'x64' or jit.arch == 'arm64') and {'rust_analyzer', 'hls', 'ts_ls', 'lua_ls',} or {'ts_ls',},})require('config-lsp')vim.pack.add({'https://github.com/rafamadriz/friendly-snippets',{ src = 'https://github.com/saghen/blink.cmp', version = vim.version.range('1.*') },})if jit.arch == 'x64' or jit.arch == 'arm64' thenrequire('blink.cmp').setup({keymap = {preset = 'none',['<TAB>'] = { 'select_next', 'fallback' },['<S-TAB>'] = { 'select_prev', 'fallback' },['<C-N>'] = { 'select_next', 'fallback' },['<C-P>'] = { 'select_prev', 'fallback' },['<C-K>'] = { 'show_documentation', 'fallback' },['<C-U>'] = { 'scroll_documentation_up', 'fallback' },['<C-D>'] = { 'scroll_documentation_down', 'fallback' },['<C-C>'] = { 'cancel', 'fallback' },},appearance = { nerd_font_variant = 'mono' },completion = {documentation = { auto_show = false },menu = {auto_show = true,draw = {padding = 1,columns = {{ 'label', gap = 1 },{ 'kind_icon', 'label_description', gap = 1 },},components = {label_description = {text = function(ctx)return ctx.label_description ~= '' and ctx.label_description or ctx.item.detailend,},},},max_height = 6,},ghost_text = { enabled = true, show_with_menu = true },list = {selection = { preselect = false, auto_insert = true },},},cmdline = {keymap = { preset = 'inherit' },completion = {menu = { auto_show = true },list = { selection = { preselect = false, auto_insert = true } },},},sources = {default = { 'lsp', 'path', 'buffer' },},signature = { enabled = true },fuzzy = { implementation = 'prefer_rust' },})end
Mod+N { focus-workspace-up; }Mod+P { focus-workspace-down; }Mod+Shift+N { move-column-to-workspace-up; }Mod+Shift+P { move-column-to-workspace-down; }Mod+Shift+Alt+N { move-column-to-workspace-up focus=false; }Mod+Shift+Alt+P { move-column-to-workspace-down focus=false; }
Mod+P { focus-workspace-up; }Mod+N { focus-workspace-down; }Mod+Shift+P { move-column-to-workspace-up; }Mod+Shift+N { move-column-to-workspace-down; }Mod+Shift+Alt+P { move-column-to-workspace-up focus=false; }Mod+Shift+Alt+N { move-column-to-workspace-down focus=false; }