diff --git a/README.md b/README.md index f445b65e..66b5930b 100644 --- a/README.md +++ b/README.md @@ -227,3 +227,58 @@ sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim ``` + +``` +lua/custom/plugins/markdown.lua +return { + { + "iamcco/markdown-preview.nvim", + ft = "markdown", + build = ":call mkdp#util#install()", + }, +} + + +lua/custom/plugins/others.lua +return { + -- { + -- "kevinhwang91/nvim-bqf", + -- lazy = false, + -- }, + { + "tpope/vim-unimpaired", + }, +} + +lua/custom/plugins/rust.lua +return { +{ + "rust-lang/rust.vim", + ft = "rust", + init = function() + vim.g.rustfmt_autosave = 1 + end, + }, + --{ + -- "simrat39/rust-tools.nvim", + -- ft = "rust", + -- dependencies = "neovim/nvim-lspconfig", + -- opts = function() + -- return require "custom.configs.rust-tools" + -- end, + -- config = function(_, opts) + -- require("rust-tools").setup(opts) + -- end, + --}, + { + "saecki/crates.nvim", + ft = { "rust", "toml" }, + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function(_, opts) + local crates = require "crates" + crates.setup(opts) + crates.show() + end, + }, +} +``` diff --git a/init.lua b/init.lua index 88658ef3..32f61584 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' @@ -119,11 +119,11 @@ vim.opt.clipboard = 'unnamedplus' vim.opt.breakindent = true -- Save undo history -vim.opt.undofile = true +-- vim.opt.undofile = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.opt.ignorecase = true -vim.opt.smartcase = true +-- vim.opt.ignorecase = true +-- vim.opt.smartcase = true -- Keep signcolumn on by default vim.opt.signcolumn = 'yes' @@ -154,6 +154,45 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- Cutom configs + +vim.opt.colorcolumn = '100' + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +-- https://youtu.be/w7i4amO_zaE?t=1408 +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir' +vim.opt.undofile = true + +-- vim.opt.hlsearch = false +-- vim.opt.incsearch = true + +vim.opt.scrolloff = 4 +vim.opt.ignorecase = false +vim.opt.smartcase = false + +-- vim.opt.colorcolumn = "100" + +-- autocmd BufReadPost *.py :SymbolsOutline +-- vim.api.nvim_command('autocmd BufReadPost *.py :SymbolsOutline') + +vim.g.undotree_WindowLayout = 3 +vim.g.undotree_ShortIndicators = 1 + +-- spell +-- vim.opt.spelllang = 'en_us' +-- vim.opt.spell = true +-- vim.opt.spellsuggest='best,9' + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -181,6 +220,12 @@ vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' } -- vim.keymap.set('n', '', 'echo "Use k to move!!"') -- vim.keymap.set('n', '', 'echo "Use j to move!!"') +-- Disable arrow keys +vim.keymap.set({ 'n', 'i', 'v' }, '', '', { silent = true }) +vim.keymap.set({ 'n', 'i', 'v' }, '', '', { silent = true }) +vim.keymap.set({ 'n', 'i', 'v' }, '', '', { silent = true }) +vim.keymap.set({ 'n', 'i', 'v' }, '', '', { silent = true }) + -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- @@ -592,6 +637,53 @@ require('lazy').setup({ }, }, }, + rust_analyzer = { + checkOnSave = { + allFeatures = true, + overrideCommand = { + 'cargo', + 'clippy', + '--workspace', + '--message-format=json', + '--all-targets', + '--all-features', + }, + }, + }, + + ruff_lsp = { + init_options = { + settings = { + -- Any extra CLI arguments for `ruff` go here. + args = {}, + }, + }, + }, + + -- pylsp = { + -- pylsp = { + -- plugins = { + -- pycodestyle = { + -- ignore = { 'W391' }, + -- maxLineLength = 100, + -- }, + -- }, + -- }, + -- }, + + bashls = {}, + cssls = {}, + html = {}, + jsonls = {}, + tailwindcss = {}, + tsserver = {}, + ltex = { + ltex = { + additionalRules = { + languageModel = '~/ngrams/', + }, + }, + }, } -- Ensure the servers and tools above are installed @@ -835,7 +927,31 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, + ensure_installed = { + 'bash', + 'c', + 'diff', + 'html', + 'lua', + 'luadoc', + 'markdown', + 'vim', + 'vimdoc', + 'python', + 'rust', + 'tsx', + 'typescript', + 'javascript', + 'css', + 'json', + 'comment', + 'gitignore', + 'kdl', + 'regex', + 'sql', + 'toml', + 'yaml', + }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -885,7 +1001,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' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/custom/plugins/rust.lua b/lua/custom/plugins/rust.lua new file mode 100644 index 00000000..47fe5323 --- /dev/null +++ b/lua/custom/plugins/rust.lua @@ -0,0 +1,30 @@ +return { + { + 'rust-lang/rust.vim', + ft = 'rust', + init = function() + vim.g.rustfmt_autosave = 1 + end, + }, + --{ + -- "simrat39/rust-tools.nvim", + -- ft = "rust", + -- dependencies = "neovim/nvim-lspconfig", + -- opts = function() + -- return require "custom.configs.rust-tools" + -- end, + -- config = function(_, opts) + -- require("rust-tools").setup(opts) + -- end, + --}, + { + 'saecki/crates.nvim', + ft = { 'rust', 'toml' }, + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function(_, opts) + local crates = require 'crates' + crates.setup(opts) + crates.show() + end, + }, +}