diff --git a/init.lua b/init.lua index 292ec077..b0d0a020 100644 --- a/init.lua +++ b/init.lua @@ -232,7 +232,7 @@ require('lazy').setup { -- require('Comment').setup({}) -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = {} }, -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. This is equivalent to the following lua: @@ -267,7 +267,7 @@ require('lazy').setup { -- after the plugin has been loaded: -- config = function() ... end - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' config = function() -- This is the function that runs, AFTER loading @@ -534,7 +534,13 @@ require('lazy').setup { -- clangd = {}, -- gopls = {}, -- pyright = {}, - -- rust_analyzer = {}, + rust_analyzer = { + settings = { + check = { + command = "clippy", + }, + }, + }, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -605,6 +611,8 @@ require('lazy').setup { { -- Autoformat 'stevearc/conform.nvim', + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, opts = { notify_on_error = false, format_on_save = { @@ -612,15 +620,18 @@ require('lazy').setup { lsp_fallback = true, }, formatters_by_ft = { - lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use a sub-list to tell conform to run *until* a formatter - -- is found. - -- javascript = { { "prettierd", "prettier" } }, + lua = { "stylua" }, + python = { "isort", "black" }, + javascript = { { "prettierd", "prettier" } }, + typescript = { { "prettierd", "prettier" } }, + rust = { "rustfmt" }, + cpp = { "clang-format" }, }, }, + init = function() + -- If you want the formatexpr, here is the place to set it + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, }, { -- Autocompletion @@ -722,7 +733,7 @@ require('lazy').setup { -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme` 'folke/tokyonight.nvim', - lazy = false, -- make sure we load this during startup if it is your main colorscheme + lazy = false, -- make sure we load this during startup if it is your main colorscheme priority = 1000, -- make sure to load this before all the other start plugins config = function() -- Load the colorscheme here @@ -781,7 +792,7 @@ require('lazy').setup { ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup { - ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc', 'rust', 'svelte', 'typescript', 'tsx', 'javascript' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { enable = true }, @@ -806,7 +817,7 @@ require('lazy').setup { -- Here are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` @@ -814,7 +825,7 @@ require('lazy').setup { -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, } -- The line beneath this is called `modeline`. See `:help modeline` diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000..18931957 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,10 @@ +return { -- Copilot + 'github/copilot.vim', + init = function() + vim.keymap.set('i', '', 'copilot#Accept("\\")', { + expr = true, + replace_keycodes = false + }) + vim.g.copilot_no_tab_map = true + end +} diff --git a/lua/custom/plugins/rust.lua b/lua/custom/plugins/rust.lua new file mode 100644 index 00000000..8f758131 --- /dev/null +++ b/lua/custom/plugins/rust.lua @@ -0,0 +1,9 @@ +return { + -- Managing crates.io dependencies -- + 'saecki/crates.nvim', + tag = 'stable', + event = { "BufRead Cargo.toml" }, + config = function() + require('crates').setup() + end, + },