From c1ba048e9063a5a65cf317ed596e2871615c6ac9 Mon Sep 17 00:00:00 2001 From: NaniNoni Date: Sun, 23 Jun 2024 22:25:01 +0200 Subject: [PATCH] Add more LSPs, Hyprlang grammar and more plugins. --- init.lua | 73 ++++++++++++---------------------------- lua/plugins/neo-tree.lua | 4 +++ lua/plugins/obsidian.lua | 13 +++++++ 3 files changed, 39 insertions(+), 51 deletions(-) create mode 100644 lua/plugins/obsidian.lua diff --git a/init.lua b/init.lua index 949829d7..847357f4 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ --- Set as the leader key +-- ngSet as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' @@ -32,6 +32,10 @@ vim.opt.clipboard = 'unnamedplus' -- Enable break indent vim.opt.breakindent = true +vim.bo.shiftwidth = 4 +vim.bo.tabstop = 4 +vim.bo.expandtab = true + -- Save undo history vim.opt.undofile = true @@ -68,6 +72,11 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- Custom filetype associations +vim.filetype.add { + pattern = { ['.*/hypr/.*%.conf'] = 'hyprlang' }, +} + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -89,25 +98,12 @@ 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!!"') - --- Keybinds to make split navigation easier. --- Use CTRL+ to switch between windows --- -- See `:help wincmd` for a list of all window commands 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' }) --- Change copilot key for accepting suggestions -vim.keymap.set('i', '', 'copilot#Accept("")', { expr = true, replace_keycodes = false }) -vim.g.copilot_no_tab_map = true - -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -137,8 +133,7 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - - 'github/copilot.vim', + 'numToStr/Comment.nvim', -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following @@ -150,7 +145,6 @@ require('lazy').setup({ -- require('Comment').setup({}) -- "gc" to comment visual regions/lines - { '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: @@ -240,25 +234,6 @@ require('lazy').setup({ { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() - -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search - -- many different aspects of Neovim, your workspace, LSP, and more! - -- - -- The easiest way to use Telescope, is to start by doing something like: - -- :Telescope help_tags - -- - -- After running this command, a window will open up and you're able to - -- type in the prompt window. You'll see a list of `help_tags` options and - -- a corresponding preview of the help. - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! - -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { @@ -476,20 +451,15 @@ require('lazy').setup({ -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. -- - 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 lspconfig = require 'lspconfig' + local servers = { clangd = {}, cmake = {}, - -- gopls = {}, - -- pyright = {}, rust_analyzer = {}, + csharp_ls = {}, -- ... 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: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, - -- lua_ls = { -- cmd = {...}, @@ -519,7 +489,8 @@ require('lazy').setup({ -- for you, so that they are available from within Neovim. local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code + 'stylua', + 'clang-format', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -565,6 +536,8 @@ require('lazy').setup({ end, formatters_by_ft = { lua = { 'stylua' }, + c = { 'clang-format' }, + cpp = { 'clang-format' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- @@ -786,12 +759,10 @@ 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 'plugins.debug', - -- require 'plugins.indent_line', - -- require 'plugins.lint', - -- require 'plugins.autopairs', require 'plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'plugins.autopairs', + -- require 'plugins.lint', + require 'plugins.obsidian', }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index c793b885..c8814e8b 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -20,6 +20,10 @@ return { ['\\'] = 'close_window', }, }, + + filtered_items = { + hide_dotfiles = false, + }, }, }, } diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua new file mode 100644 index 00000000..e28483c4 --- /dev/null +++ b/lua/plugins/obsidian.lua @@ -0,0 +1,13 @@ +return { + 'epwalsh/obsidian.nvim', + version = '*', + lazy = true, + ft = 'markdown', + + dependencies = { + 'nvim-lua/plenary.nvim', + 'hrsh7th/nvim-cmp', + 'nvim-telescope/telescope.nvim', + 'nvim-treesitter/nvim-treesitter', + }, +}