diff --git a/.env b/.env deleted file mode 100644 index e69de29b..00000000 diff --git a/init.lua b/init.lua index ed3da84f..004755fe 100644 --- a/init.lua +++ b/init.lua @@ -159,6 +159,8 @@ vim.opt.scrolloff = 10 -- term gui colors for nvim.notify vim.opt.termguicolors = true +vim.opt.conceallevel = 2 +vim.g.codeium_open_chat_in_buffer = 1 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -166,6 +168,10 @@ vim.opt.termguicolors = true -- For conciseness local opts = { noremap = true, silent = true } +-- local codeium = require('custom.plugins.codeium') +-- +-- vim.api.nvim_set_keymap('n', 'c', ':lua codeium.chat_buffer()', { noremap = true, silent = true }) + -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') @@ -204,6 +210,7 @@ vim.keymap.set('n', 'q', 'q!', { desc = 'Close file' }) -- Keep last yanked when pasting vim.keymap.set('v', 'p', '"_dP', opts) +vim.keymap.set('n', 'A', 'ggVG', opts) -- Vertical scroll and center vim.keymap.set('n', '', 'zz', opts) @@ -241,6 +248,21 @@ vim.keymap.set('n', 'tp', ':tabp', opts) -- go to previous tab vim.keymap.set('v', '<', '', '>gv', opts) +-- Obsidian +vim.keymap.set('n', 'Oc', "lua require('obsidian').util.toggle_checkbox()", { desc = 'Obsidian Check Checkbox' }) +vim.keymap.set('n', 'Ot', 'ObsidianTemplate', { desc = 'Insert Obsidian Template' }) +vim.keymap.set('n', 'Po', 'ObsidianOpen', { desc = 'Open in Obsidian App' }) +vim.keymap.set('n', 'Ob', 'ObsidianBacklinks', { desc = 'Show ObsidianBacklinks' }) +vim.keymap.set('n', 'Ol', 'ObsidianLinks', { desc = 'Show ObsidianLinks' }) +vim.keymap.set('n', 'On', 'ObsidianNew', { desc = 'Create New Note' }) +vim.keymap.set('n', 'Os', 'ObsidianSearch', { desc = 'Search Obsidian' }) +vim.keymap.set('n', 'Oq', 'ObsidianQuickSwitch', { desc = 'Quick Switch' }) + +-- Copilot +-- vim.keymap.set('i', '', function() +-- require('copilot.panel').accept() +-- end, { desc = 'Accept Copilot suggestion' }) +vim.keymap.set('n', 'cc', 'call codeium#Chat()', { desc = 'Codeium Chat' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -365,13 +387,15 @@ require('lazy').setup({ -- Document existing key chains spec = { - { 'c', group = '[C]opilot', mode = { 'n', 'x' } }, + { 'c', group = '[C]hatGPT', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, { 'f', group = '[F]ind' }, -- { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, + { 'O', group = '[O]bsidian' }, { 'gh', group = 'Git [H]unk', mode = { 'n', 'v' } }, + { 'g', group = '[G]it', mode = { 'n', 'v' } }, }, }, }, @@ -439,9 +463,47 @@ require('lazy').setup({ -- }, -- }, -- pickers = {} + defaults = { + layout_strategy = 'vertical', + layout_config = { + preview_height = 0.7, + vertical = { + width = '95%', + height = '95%', + }, + }, + }, pickers = { + current_buffer_fuzzy_find = { + -- Override the layout strategy and config for current_buffer_fuzzy_find + layout_strategy = 'horizontal', -- or any other strategy you prefer + layout_config = { + preview_width = 0.5, -- example config, adjust as needed + }, + }, + old_files = { + layout_strategy = 'vertical', + layout_config = { + preview_height = 0.7, + vertical = { + size = { + width = '95%', + height = '95%', + }, + }, + }, + }, find_files = { - themes = 'dropdown', + layout_strategy = 'vertical', + layout_config = { + preview_height = 0.7, + vertical = { + size = { + width = '95%', + height = '95%', + }, + }, + }, file_ignore_patterns = { 'node_modules', '.git', '.venv' }, hidden = true, }, @@ -457,18 +519,7 @@ require('lazy').setup({ require('telescope.themes').get_dropdown(), }, }, - defaults = { - layout_strategy = 'vertical', - layout_config = { - preview_height = 0.7, - vertical = { - size = { - width = '95%', - height = '95%', - }, - }, - }, - }, + defaults = {}, } -- Enable Telescope extensions if they are installed @@ -486,7 +537,10 @@ require('lazy').setup({ vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) vim.keymap.set('n', 'f', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', 'fo', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', 'fF', function() + require('telescope.builtin').find_files { hidden = true, no_ignore = true } + end, { desc = '[F]ind in all files' }) + -- vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', 'f/', function() @@ -787,6 +841,7 @@ require('lazy').setup({ end, formatters_by_ft = { lua = { 'stylua' }, + go = { 'gofmt' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- diff --git a/lua/custom/plugins/avante.lua b/lua/custom/plugins/avante.lua deleted file mode 100644 index eae82a81..00000000 --- a/lua/custom/plugins/avante.lua +++ /dev/null @@ -1,123 +0,0 @@ -return { - 'yetone/avante.nvim', - event = 'VeryLazy', - lazy = false, - version = false, -- set this if you want to always pull the latest change - opts = { - -- add any opts here - { - ---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string - provider = 'copilot', -- Recommend using Claude - auto_suggestions_provider = 'copilot', -- Since auto-suggestions are a high-frequency operation and therefore expensive, it is recommended to specify an inexpensive provider or even a free provider: copilot - -- claude = { - -- endpoint = 'https://api.anthropic.com', - -- model = 'claude-3-5-sonnet-20240620', - -- temperature = 0, - -- max_tokens = 4096, - -- }, - behaviour = { - auto_suggestions = false, -- Experimental stage - auto_set_highlight_group = true, - auto_set_keymaps = true, - auto_apply_diff_after_generation = false, - support_paste_from_clipboard = true, - }, - mappings = { - --- @class AvanteConflictMappings - diff = { - ours = 'co', - theirs = 'ct', - all_theirs = 'ca', - both = 'cb', - cursor = 'cc', - next = ']x', - prev = '[x', - }, - suggestion = { - accept = '', - next = '', - prev = '', - dismiss = '', - }, - jump = { - next = ']]', - prev = '[[', - }, - submit = { - normal = '', - insert = '', - }, - }, - hints = { enabled = true }, - windows = { - ---@type "right" | "left" | "top" | "bottom" - position = 'right', -- the position of the sidebar - wrap = true, -- similar to vim.o.wrap - width = 30, -- default % based on available width - sidebar_header = { - align = 'center', -- left, center, right for title - rounded = true, - }, - }, - highlights = { - ---@type AvanteConflictHighlights - diff = { - current = 'DiffText', - incoming = 'DiffAdd', - }, - }, - --- @class AvanteConflictUserConfig - diff = { - autojump = true, - ---@type string | fun(): any - list_opener = 'copen', - }, - }, - }, - -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` - build = 'make', - -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows - dependencies = { - 'stevearc/dressing.nvim', - 'nvim-lua/plenary.nvim', - 'MunifTanjim/nui.nvim', - --- The below dependencies are optional, - 'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons - 'zbirenbaum/copilot.lua', -- for providers='copilot' - { - -- support for image pasting - 'HakonHarnes/img-clip.nvim', - event = 'VeryLazy', - opts = { - -- recommended settings - default = { - embed_image_as_base64 = false, - prompt_for_file_name = false, - drag_and_drop = { - insert_mode = true, - }, - -- required for Windows users - use_absolute_path = true, - }, - }, - }, - { - -- Make sure to set this up properly if you have lazy=true - 'MeanderingProgrammer/render-markdown.nvim', - opts = { - file_types = { 'markdown', 'Avante' }, - }, - ft = { 'markdown', 'Avante' }, - }, - }, - init = function() - vim.api.nvim_create_autocmd('VimEnter', { - callback = function() - -- Ensure Avante.nvim has been loaded before switching providers - if vim.fn.exists ':AvanteSwitchProvider' == 2 then - vim.cmd 'AvanteSwitchProvider copilot' - end - end, - }) - end, -} diff --git a/lua/custom/plugins/codeium.lua b/lua/custom/plugins/codeium.lua new file mode 100644 index 00000000..5d936b83 --- /dev/null +++ b/lua/custom/plugins/codeium.lua @@ -0,0 +1,25 @@ +return { + 'Exafunction/codeium.vim', + event = 'BufEnter', + config = function() + -- Change '' here to any keycode you like. + vim.keymap.set('i', '', function() + return vim.fn['codeium#Accept']() + end, { expr = true, silent = true }) + vim.keymap.set('i', '', function() + return vim.fn['codeium#CycleCompletions'](1) + end, { expr = true, silent = true }) + vim.keymap.set('i', '', function() + return vim.fn['codeium#CycleCompletions'](-1) + end, { expr = true, silent = true }) + vim.keymap.set('i', '', function() + return vim.fn['codeium#Clear']() + end, { expr = true, silent = true }) + vim.keymap.set('i', '', function() + return vim.fn['codeium#CycleCompletions(1)']() + end, { expr = true, silent = true }) + vim.keymap.set('i', 'cc', function() + return vim.fn['codeium#Chat()']() + end, { expr = true, silent = true }) + end, +} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua deleted file mode 100644 index 9f6d759c..00000000 --- a/lua/custom/plugins/copilot.lua +++ /dev/null @@ -1,46 +0,0 @@ -return { - { - 'CopilotC-Nvim/CopilotChat.nvim', - branch = 'canary', - dependencies = { - { 'zbirenbaum/copilot.lua' }, -- or github/copilot.vim - { 'nvim-lua/plenary.nvim' }, -- for curl, log wrapper - }, - build = 'make tiktoken', -- Only on MacOS or Linux - keys = { - { - 'ccq', - function() - local input = vim.fn.input 'Quick Chat: ' - if input ~= '' then - require('CopilotChat').ask(input, { selection = require('CopilotChat.select').buffer }) - end - end, - desc = 'CopilotChat Buffer chat', - }, - { - 'cct', - 'CopilotChatToggle', - desc = 'Copilot Chat Toggle', - }, - -- { - -- 'ccs', - -- 'CopilotChatSave', - -- desc = 'CopilotChat - Quick chat', - -- }, - }, - opts = { - debug = false, -- Enable debug logging - window = { - layout = 'float', - relative = 'editor', - title = 'Copilot', - footer = ' to toggle chat | to clean chat', - width = 0.6, - height = 0.5, - row = 0, - border = 'rounded', -- 'none', single', 'double', 'rounded', 'solid', 'shadow' - }, - }, - }, -} diff --git a/lua/custom/plugins/misc.lua b/lua/custom/plugins/misc.lua index 39616439..380dc198 100644 --- a/lua/custom/plugins/misc.lua +++ b/lua/custom/plugins/misc.lua @@ -135,5 +135,57 @@ return { end, config = true, }, - { 'github/copilot.vim' }, + -- { + -- 'zbirenbaum/copilot.lua', + -- cmd = 'Copilot', + -- event = 'InsertEnter', + -- config = function() + -- require('copilot').setup { + -- panel = { + -- enabled = true, + -- auto_refresh = false, + -- keymap = { + -- jump_prev = '[[', + -- jump_next = ']]', + -- accept = '', + -- refresh = 'gr', + -- open = '', + -- }, + -- layout = { + -- position = 'bottom', -- | top | left | right + -- ratio = 0.4, + -- }, + -- }, + -- suggestion = { + -- enabled = true, + -- auto_trigger = true, + -- hide_during_completion = true, + -- debounce = 75, + -- keymap = { + -- accept = '', + -- accept_word = false, + -- accept_line = false, + -- next = '', + -- prev = '', + -- dismiss = '', + -- }, + -- }, + -- filetypes = { + -- yaml = false, + -- markdown = false, + -- help = false, + -- gitcommit = false, + -- gitrebase = false, + -- hgcommit = false, + -- svn = false, + -- cvs = false, + -- ['.'] = false, + -- }, + -- copilot_node_command = 'node', -- Node.js version must be > 18.x + -- server_opts_overrides = {}, + -- } + -- end, + -- }, + { 'norcalli/nvim-colorizer.lua' }, + { 'wsdjeg/vim-chat' }, } diff --git a/lua/custom/plugins/neotree.lua b/lua/custom/plugins/neotree.lua index 1096aaae..3e440178 100644 --- a/lua/custom/plugins/neotree.lua +++ b/lua/custom/plugins/neotree.lua @@ -151,7 +151,7 @@ return { -- see `:h neo-tree-custom-commands-global` commands = {}, window = { - position = 'right', + position = 'left', width = 40, mapping_options = { noremap = true, @@ -334,7 +334,7 @@ return { } -- vim.cmd [[nnoremap \ :Neotree reveal]] - vim.keymap.set('n', 'e', ':Neotree toggle position=right', { noremap = true, silent = true }) -- focus file explorer + vim.keymap.set('n', 'e', ':Neotree toggle position=left', { noremap = true, silent = true }) -- focus file explorer vim.keymap.set('n', 'gt', ':Neotree float git_status', { noremap = true, silent = true }) -- open git status window end, },