this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 187 lines 6.7 kB view raw
1return { 2 'neovim/nvim-lspconfig', 3 dependencies = { 4 'williamboman/mason-lspconfig.nvim', 5 "williamboman/mason.nvim", 6 'neovim/nvim-lspconfig', 7 'hrsh7th/cmp-nvim-lsp', 8 'hrsh7th/cmp-buffer', 9 'hrsh7th/cmp-path', 10 'hrsh7th/cmp-cmdline', 11 'micangl/cmp-vimtex', 12 'hrsh7th/nvim-cmp', 13 'windwp/nvim-autopairs', 14 { 15 'L3MON4D3/LuaSnip', 16 build = "make install_jsregexp", 17 dependencies = { 18 'rafamadriz/friendly-snippets' 19 }, 20 }, 21 'j-hui/fidget.nvim', 22 }, 23 config = function() 24 require('fidget').setup({}) 25 require("nvim-autopairs").setup({}) 26 require("mason").setup({ 27 PATH="append", 28 }) 29 require("mason-lspconfig").setup({ 30 ensure_installed = { 31 'lua_ls', 32 'rust_analyzer', 33 'lua_ls', 34 'marksman', 35 'jedi_language_server', 36 'fortls', 37 'tinymist', 38 'clangd' 39 }, 40 handlers = { 41 function(server_name) 42 local cmp_nvim_lsp = require("cmp_nvim_lsp") 43 local capabilities = vim.tbl_deep_extend( 44 "force", 45 {}, 46 vim.lsp.protocol.make_client_capabilities(), 47 cmp_nvim_lsp.default_capabilities()) 48 49 vim.lsp.config(server_name, { 50 capabilities = capabilities, 51 vim.lsp.enable(server_name) 52 }) 53 vim.lsp.config('fortls' ,{ 54 cmd = { 55 'fortls', 56 '--hover_signature', 57 '--hover_language=fortran', 58 '--use_signature_help', 59 '--lowercase_intrinsics' 60 }, 61 }) 62 vim.lsp.config('lua_ls',{ 63 settings = { 64 Lua = { 65 diagnostics = { 66 -- Get the language server to recognize the `vim` global 67 globals = { 'vim' }, 68 }, 69 workspace = { 70 checkThirdParty = false, 71 library = { 72 vim.env.VIMRUNTIME 73 } 74 } 75 } 76 } 77 }) 78 vim.lsp.config('tinymist', { 79 settings = { 80 81 formatterMode = "typstyle", 82 83 exportPdf = "onType", 84 85 semanticTokens = "disable" 86 87 } 88 }) 89 end, 90 } 91 }) 92 93 94 local has_words_before = function() 95 unpack = unpack or table.unpack 96 local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 97 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil 98 end 99 100 101 local cmp = require('cmp') 102 local cmp_autopairs = require('nvim-autopairs.completion.cmp') 103 104 105 local luasnip = require('luasnip') 106 -- require("luasnip.loaders.from_vscode").lazy_load() 107 108 cmp.event:on( 109 'confirm_done', 110 cmp_autopairs.on_confirm_done() 111 ) 112 local cmp_select = { behaviour = cmp.SelectBehavior.Insert } 113 cmp.setup({ 114 snippet = { 115 expand = function(args) 116 require('luasnip').lsp_expand(args.body) -- For `luasnip` users. 117 end, 118 }, 119 mapping = cmp.mapping.preset.insert({ 120 ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), 121 ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), 122 ['<CR>'] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace, }), 123 ['<C-Space>'] = cmp.mapping.complete(), 124 ['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), 125 ['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), 126 ["<Tab>"] = cmp.mapping(function(fallback) 127 if cmp.visible() then 128 cmp.select_next_item() 129 -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() 130 -- they way you will only jump inside the snippet region 131 elseif luasnip.expand_or_jumpable() then 132 luasnip.expand_or_jump() 133 elseif has_words_before() then 134 cmp.complete() 135 else 136 fallback() 137 end 138 end, { "i", "s" }), 139 140 ["<S-Tab>"] = cmp.mapping(function(fallback) 141 if cmp.visible() then 142 cmp.select_prev_item() 143 elseif luasnip.jumpable(-1) then 144 luasnip.jump(-1) 145 else 146 fallback() 147 end 148 end, { "i", "s" }), 149 }), 150 sources = cmp.config.sources({ 151 { name = 'nvim_lsp' }, 152 { name = 'vimtex' }, 153 { name = 'luasnip' }, -- For luasnip users. 154 }, { 155 { name = 'buffer' }, 156 }) 157 }) 158 cmp.setup.cmdline({ '/', '?' }, { 159 mapping = cmp.mapping.preset.cmdline(), 160 sources = { 161 { name = 'buffer' } 162 } 163 }) 164 165 -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). 166 cmp.setup.cmdline(':', { 167 mapping = cmp.mapping.preset.cmdline(), 168 sources = cmp.config.sources({ 169 { name = 'path' } 170 }, { 171 { name = 'cmdline' } 172 }) 173 }) 174 175 vim.diagnostic.config({ 176 update_in_insert = true, 177 float = { 178 focusable = false, 179 style = "minimal", 180 border = "rounded", 181 source = "always", 182 header = "", 183 prefix = "", 184 } 185 }) 186 end 187}