-- Leader key vim.g.mapleader = " " -- Disable Copilot by default vim.g.copilot_enabled = false -- Basic settings vim.opt.compatible = false vim.opt.showmatch = true vim.opt.ignorecase = true vim.opt.mouse = "v" vim.opt.hlsearch = true vim.opt.incsearch = true -- Tab and indentation settings vim.opt.tabstop = 4 vim.opt.softtabstop = 4 vim.opt.expandtab = true vim.opt.shiftwidth = 4 vim.opt.autoindent = true -- Line numbering vim.opt.number = true vim.opt.relativenumber = true -- Command-line completion mode vim.opt.wildmode = { "longest", "list" } -- Column marker at 80 characters vim.opt.colorcolumn = "80" -- Enable filetype plugins and indentation vim.cmd("filetype plugin indent on") -- Enable syntax highlighting vim.cmd("syntax on") -- Enable mouse support vim.opt.mouse = "a" -- Use system clipboard vim.opt.clipboard = "unnamedplus" -- Enable cursorline vim.opt.cursorline = true -- Optimize for fast terminal vim.opt.ttyfast = true -- Do not add a newline at the end of the file vim.opt.fixeol = false if vim.fn.has("termguicolors") == 1 then vim.opt.termguicolors = true end -- Enable syntax highlighting vim.cmd("syntax enable") -- Set colorscheme to dracula vim.cmd("colorscheme dracula") -- Open new vertical splits to the right vim.opt.splitright = true -- Open new horizontal splits below vim.opt.splitbelow = true -- Insert mode mappings vim.api.nvim_set_keymap('i', '', ':m .+1==gi', { noremap = true, silent = true }) vim.api.nvim_set_keymap('i', '', ':m .-2==gi', { noremap = true, silent = true }) -- Visual mode mappings vim.api.nvim_set_keymap('v', '', ":m '>+1gv=gv", { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', '', ":m '<-2gv=gv", { noremap = true, silent = true }) -- Normal mode mappings for window movement vim.api.nvim_set_keymap('n', '', 'H', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'J', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'K', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'L', { noremap = true, silent = true }) -- Normal mode mappings for window navigation vim.api.nvim_set_keymap('n', '', 'h', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'j', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'k', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'l', { noremap = true, silent = true }) -- Normal mode mapping for opening file in vertical split vim.api.nvim_set_keymap('n', 'gf', ':vert winc f', { noremap = true, silent = true }) -- Insert mode mappings for CoC (Conquer of Completion) vim.api.nvim_set_keymap('i', '', [[coc#pum#visible() ? coc#_select_confirm() : "\u\"]], { noremap = true, silent = true, expr = true }) vim.api.nvim_set_keymap('i', '', [[coc#pum#visible() ? coc#pum#next(1) : "\"]], { noremap = true, silent = true, expr = true }) vim.api.nvim_set_keymap('i', '', [[coc#pum#visible() ? coc#pum#prev(1) : "\"]], { noremap = true, silent = true, expr = true }) -- Normal mode mappings for NERDTree vim.api.nvim_set_keymap('n', 'n', ':NERDTreeFocus', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', ':NERDTree', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', ':NERDTreeToggle', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', ':NERDTreeFind', { noremap = true, silent = true }) -- Normal mode mapping for opening file explorer vim.api.nvim_set_keymap('n', 'ee', ':Ex', { noremap = true, silent = true }) -- Harpoon mappings vim.api.nvim_set_keymap('n', 'ha', 'lua require("harpoon.mark").add_file()', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'hh', 'lua require("harpoon.ui").toggle_quick_menu()', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '1', 'lua require("harpoon.ui").nav_file(1)', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '2', 'lua require("harpoon.ui").nav_file(2)', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '3', 'lua require("harpoon.ui").nav_file(3)', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '4', 'lua require("harpoon.ui").nav_file(4)', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'lua require("harpoon.ui").nav_prev()', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'lua require("harpoon.ui").nav_next()', { noremap = true, silent = true }) -- FZF mapping vim.api.nvim_set_keymap('n', 'ff', ':FZF', { noremap = true, silent = true }) -- Miscellaneous mappings vim.api.nvim_set_keymap('n', 'mm', ':nohl', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'ml', ':%s/\\r//g', { noremap = true, silent = true }) -- Yarn mappings vim.api.nvim_set_keymap('n', 'yb', ':!yarn build', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'yi', ':!yarn install', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'ys', ':!yarn start', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'yt', ':!yarn test', { noremap = true, silent = true }) -- Dotnet mapping vim.api.nvim_set_keymap('n', 'dr', ':!dotnet run', { noremap = true, silent = true }) -- Prettier mapping vim.api.nvim_set_keymap('n', 'p', '(prettier-format)', { noremap = true, silent = true }) -- Copilot Chat mappings vim.api.nvim_set_keymap('n', '', ':CopilotChatToggle', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'ps', ':CopilotChatStop', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'pr', ':CopilotChatReset', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pe', ':CopilotChatExplain', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pr', ':CopilotChatReview', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pf', ':CopilotChatFix', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'po', ':CopilotChatOptimize', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pd', ':CopilotChatDocs', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pt', ':CopilotChatTests', { noremap = true, silent = true }) -- Harpoon mappings vim.api.nvim_set_keymap('n', 'ha', 'lua require("harpoon.mark").add_file()', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'hh', 'lua require("harpoon.ui").toggle_quick_menu()', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '1', 'lua require("harpoon.ui").nav_file(1)', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '2', 'lua require("harpoon.ui").nav_file(2)', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '3', 'lua require("harpoon.ui").nav_file(3)', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '4', 'lua require("harpoon.ui").nav_file(4)', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'lua require("harpoon.ui").nav_prev()', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'lua require("harpoon.ui").nav_next()', { noremap = true, silent = true }) -- FZF mapping vim.api.nvim_set_keymap('n', 'ff', ':FZF', { noremap = true, silent = true }) -- Miscellaneous mappings vim.api.nvim_set_keymap('n', 'mm', ':nohl', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'ml', ':%s/\\r//g', { noremap = true, silent = true }) -- Yarn mappings vim.api.nvim_set_keymap('n', 'yb', ':!yarn build', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'yi', ':!yarn install', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'ys', ':!yarn start', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'yt', ':!yarn test', { noremap = true, silent = true }) -- Dotnet mapping vim.api.nvim_set_keymap('n', 'dr', ':!dotnet run', { noremap = true, silent = true }) -- Prettier mapping vim.api.nvim_set_keymap('n', 'p', '(prettier-format)', { noremap = true, silent = true }) -- Copilot mappings vim.api.nvim_set_keymap('n', '', ':CopilotChatToggle', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'ps', ':CopilotChatStop', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'pr', ':CopilotChatReset', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pe', ':CopilotChatExplain', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pr', ':CopilotChatReview', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pf', ':CopilotChatFix', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'po', ':CopilotChatOptimize', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pd', ':CopilotChatDocs', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', 'pt', ':CopilotChatTests', { noremap = true, silent = true }) local ensure_packer = function() local fn = vim.fn local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) vim.cmd [[packadd packer.nvim]] return true end return false end local packer_bootstrap = ensure_packer() vim.cmd [[packadd packer.nvim]] return require('packer').startup(function(use) -- Packer can manage itself use 'wbthomason/packer.nvim' -- Plugins use 'dracula/vim' use 'ryanoasis/vim-devicons' -- use 'SirVer/ultisnips' use 'honza/vim-snippets' use 'scrooloose/nerdtree' use 'preservim/nerdcommenter' use 'mhinz/vim-startify' use {'neoclide/coc.nvim', branch = 'release'} use 'nvim-lua/plenary.nvim' use 'ThePrimeagen/harpoon' use {'junegunn/fzf', run = function() vim.fn['fzf#install']() end} use 'junegunn/fzf.vim' use 'neovim/nvim-lspconfig' use 'jose-elias-alvarez/null-ls.nvim' use 'MunifTanjim/prettier.nvim' use 'github/copilot.vim' use {'CopilotC-Nvim/CopilotChat.nvim', branch = 'canary'} end) -- Copilot Chat local prompts = require('CopilotChat.prompts') local select = require('CopilotChat.select') require("CopilotChat").setup { debug = false, question_header = '## User ', answer_header = '## Copilot ', error_header = '## Error ', separator = '---', selection = function(source) return select.visual(source) or select.line(source) end, window = { layout = 'float', }, }