diff --git a/init.lua b/init.lua index 08717d537e6..b4e9c067389 100644 --- a/init.lua +++ b/init.lua @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -157,9 +157,46 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- Tab size +-- Set global default tab size (optional) +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +-- Filetype-specific settings +vim.api.nvim_create_autocmd('FileType', { + pattern = 'c', + callback = function() + vim.opt_local.tabstop = 8 + vim.opt_local.shiftwidth = 8 + vim.opt_local.expandtab = true + end, +}) + +vim.api.nvim_create_autocmd('FileType', { + pattern = 'javascript', + callback = function() + vim.opt_local.tabstop = 2 + vim.opt_local.shiftwidth = 2 + vim.opt_local.expandtab = true + end, +}) + +vim.api.nvim_create_autocmd('FileType', { + pattern = 'jsx', + callback = function() + vim.opt_local.tabstop = 2 + vim.opt_local.shiftwidth = 2 + vim.opt_local.expandtab = true + end, +}) + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` +-- Change the default file explorer command to leader + e +vim.api.nvim_set_keymap('n', 'pv', ':Ex', { noremap = true, silent = true }) + -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') @@ -175,24 +212,38 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn -- or just use to exit terminal mode vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) --- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +-- Disable arrow keys in normal mode +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows --- -- See `:help wincmd` for a list of all window commands +-- Unmap Ctrl+L from clearing the screen +vim.keymap.set('n', '', '', { noremap = true, silent = true }) vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Same keymaps for terminal mode +vim.keymap.set('t', '', [[]], { desc = 'Move out of terminal mode and focus to the left window' }) +vim.keymap.set('t', '', [[]], { desc = 'Move out of terminal mode and focus to the right window' }) +vim.keymap.set('t', '', [[]], { desc = 'Move out of terminal mode and focus to the lower window' }) +vim.keymap.set('t', '', [[]], { desc = 'Move out of terminal mode and focus to the upper window' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` +-- Disable auto-commenting on new lines for all file types +vim.api.nvim_create_autocmd('FileType', { + pattern = '*', + callback = function() + vim.bo.formatoptions = vim.bo.formatoptions:gsub('c', ''):gsub('r', '') + end, +}) + -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode -- See `:help vim.highlight.on_yank()` @@ -615,9 +666,9 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, + clangd = {}, + gopls = {}, + pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -834,21 +885,19 @@ require('lazy').setup({ end, }, - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - - -- You can configure highlights by doing something like: - vim.cmd.hi 'Comment gui=none' + { + 'metalelf0/black-metal-theme-neovim', + lazy = false, -- Load early to ensure colorscheme is available + priority = 1000, -- High priority for colorschemes + config = function() + require('black-metal').setup { + theme = 'taake', -- Set Taake as the default theme + variant = 'dark', -- Use the dark variant (default) + alt_bg = false, -- Set to true for marduk-alt (lighter background) + transparent = true, -- For transparent background (like tokyonight) + } + -- Load the colorscheme after setup + vim.cmd.colorscheme 'taake' end, }, @@ -918,6 +967,21 @@ require('lazy').setup({ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, + --[[ + { -- Integrated Github Copilot + 'github/copilot.vim', + cmd = 'Copilot', + event = 'InsertEnter', + build = ':Copilot auth', + config = function() + vim.g.copilot_no_tab_map = true + vim.g.copilot_no_y_map = true + vim.api.nvim_set_keymap('i', '', 'copilot#Accept("")', { silent = true, expr = true }) + end, + }, +]] + -- + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. diff --git a/pack/github/start/copilot.vim b/pack/github/start/copilot.vim new file mode 160000 index 00000000000..87038123804 --- /dev/null +++ b/pack/github/start/copilot.vim @@ -0,0 +1 @@ +Subproject commit 87038123804796ca7af20d1b71c3428d858a9124