Add more LSPs, Hyprlang grammar and more plugins.

This commit is contained in:
NaniNoni 2024-06-23 22:25:01 +02:00
parent faff89f789
commit c1ba048e90
3 changed files with 39 additions and 51 deletions

View File

@ -1,4 +1,4 @@
-- Set <space> as the leader key
-- ngSet <space> 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', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- Change copilot key for accepting suggestions
vim.keymap.set('i', '<C-Y>', '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: <c-/>
-- - 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

View File

@ -20,6 +20,10 @@ return {
['\\'] = 'close_window',
},
},
filtered_items = {
hide_dotfiles = false,
},
},
},
}

13
lua/plugins/obsidian.lua Normal file
View File

@ -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',
},
}