Skip to content

Instantly share code, notes, and snippets.

@alexng353
Last active November 14, 2023 23:05
Show Gist options
  • Save alexng353/3aabb03e2d250a2cbcc04099a8afd35e to your computer and use it in GitHub Desktop.
Save alexng353/3aabb03e2d250a2cbcc04099a8afd35e to your computer and use it in GitHub Desktop.
lazy.vim copilot configuration
filetype plugin indent on
" On pressing tab, insert 2 spaces
set expandtab
" show existing tab with 2 spaces width
set tabstop=2
set softtabstop=2
" when indenting with '>', use 2 spaces width
set shiftwidth=2
" Ctrl-j/k deletes blank line below/above, and Alt-j/k inserts.
nnoremap <silent><C-j> m`:silent +g/\m^\s*$/d<CR>``:noh<CR>
nnoremap <silent><C-k> m`:silent -g/\m^\s*$/d<CR>``:noh<CR>
nnoremap <silent><A-j> :set paste<CR>m`o<Esc>``:set nopaste<CR>
nnoremap <silent><A-k> :set paste<CR>m`O<Esc>``:set nopaste<CR>
set mouse=
-- copilot.lua for lazy.vim
-- ~/.config/nvim/lua/plugins/copilot.lua
return {
"zbirenbaum/copilot.lua",
cmd = "Copilot",
build = ":Copilot auth",
event = "InsertEnter",
opts = {
panel = {
enabled = true,
auto_refresh = true,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>"
},
layout = {
position = "right", -- bottom | top | left | right
ratio = 0.3
},
},
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
keymap = {
accept = "<M-l>",
accept_word = false,
accept_line = false,
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
},
copilot_node_command = 'node', -- Node.js version must be > 18.x
server_opts_overrides = {},
}
}
-- init.lua for astronvim
-- load a custom vimscript configuration from ~/.nvimrc
-- ~/.config/nvim/init.lua
for _, source in ipairs {
"astronvim.bootstrap",
"astronvim.options",
"astronvim.lazy",
"astronvim.autocmds",
"astronvim.mappings",
} do
local status_ok, fault = pcall(require, source)
if not status_ok then vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault) end
end
-- run custom .vimrc on startup
vim.cmd('autocmd VimEnter * source ~/.nvimrc')
if astronvim.default_colorscheme then
if not pcall(vim.cmd.colorscheme, astronvim.default_colorscheme) then
require("astronvim.utils").notify("Error setting up colorscheme: " .. astronvim.default_colorscheme, "error")
end
end
require("astronvim.utils").conditional_func(astronvim.user_opts("polish", nil, false), true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment