-- You can add your own plugins here or in other files in this directory! -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information ---@module 'lazy' ---@type LazySpec vim.cmd 'language en_GB.UTF-8' vim.opt.encoding = 'utf-8' vim.opt.fileencoding = 'utf-8' vim.opt.fileencodings = { 'utf-8' } vim.opt.termguicolors = true vim.opt.winblend = 0 vim.opt.pumblend = 0 vim.g.background = 'dark' vim.opt.wrap = true vim.diagnostic.config { update_in_insert = true, underline = false, } vim.cmd 'filetype plugin on' -- NOTE: keymaps local map = vim.keymap.set local opts = { noremap = true, silent = true } -- basic function map('n', ';', ':', { desc = '' }) -- buffer control map('n', '', 'bnext', { desc = 'Next buffer' }) map('n', 'x', function() local cur_win = vim.api.nvim_get_current_win() local cur_buf = vim.api.nvim_get_current_buf() local cur_ft = vim.bo[cur_buf].filetype local wins = vim.api.nvim_tabpage_list_wins(0) local non_float = {} for _, win in ipairs(wins) do if vim.api.nvim_win_get_config(win).relative == '' then non_float[#non_float + 1] = win end end local function is_neotree_win(win) local buf = vim.api.nvim_win_get_buf(win) return vim.bo[buf].filetype == 'neo-tree' end if cur_ft == 'neo-tree' then if #non_float <= 1 then vim.cmd 'enew' return end vim.api.nvim_win_close(cur_win, true) return end if #non_float == 2 then local other = non_float[1] == cur_win and non_float[2] or non_float[1] if is_neotree_win(other) then vim.api.nvim_win_close(other, true) end end vim.cmd 'bdelete' end, { desc = 'Delete buffer' }) -- telescope map('n', 'tc', 'Telescope colorscheme', { desc = '[T]elescope [C]olorscheme' }) -- toggleterm map('n', 'H', 'ToggleTerm size=16 direction=horizontal', { desc = 'Open Terminal Horizontal' }) -- map('t', 'H', 'ToggleTerm size=20 direction=horizontal', { desc = 'Open Terminal Horizontal' }) map('n', 'V', 'ToggleTerm size=80 direction=vertical', { desc = 'Open Terminal Vertical' }) -- map('t', 'V', 'ToggleTerm size=80 direction=vertical', { desc = 'Open Terminal Vertical' }) map('n', '', 'ToggleTerm direction=float', { desc = 'Open Terminal floating' }) map('t', '', 'ToggleTerm direction=float', { desc = 'Open Terminal floating' }) -- NOTE: macos like keybindings for text editing in insert mode -- map('i', '', '^', opts) -- map('i', '', '$', opts) -- map('i', '', 'D', opts) -- map('i', '', 'd0', opts) -- map('i', '', '', opts) -- map('i', '', '', opts) -- map('i', '', '', opts) -- map('i', '', '', opts) -- map('i', '', '', opts) -- map('i', '', '', opts) -- NOTE: keymaps end -- NOTE: neovide local function set_ime(args) if args.event:match 'Enter$' then vim.g.neovide_input_ime = true else vim.g.neovide_input_ime = false end end local ime_input = vim.api.nvim_create_augroup('ime_input', { clear = true }) vim.api.nvim_create_autocmd({ 'InsertEnter', 'InsertLeave' }, { group = ime_input, pattern = '*', callback = set_ime, }) vim.api.nvim_create_autocmd({ 'CmdlineEnter', 'CmdlineLeave' }, { group = ime_input, pattern = '[/\\?]', callback = set_ime, }) vim.g.neovide_cursor_animation_length = 0.1 -- NOTE: neovide end return {}