diff --git a/init.lua b/init.lua index b98ffc6198a..46e0e43d805 100644 --- a/init.lua +++ b/init.lua @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.o.relativenumber = true +vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -553,11 +553,11 @@ require('lazy').setup({ -- Jump to the definition of the word under your cursor. -- This is where a variable was first declared, or where a function is defined, etc. -- To jump back, press . - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. @@ -671,18 +671,22 @@ require('lazy').setup({ -- - 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 servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, + clangd = {}, + gopls = {}, + pyright = {}, + rust_analyzer = {}, -- ... 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 (`ts_ls`) will work just fine - -- ts_ls = {}, - -- + ts_ls = {}, + -- csharp_ls = {}, + cmake = {}, + bashls = {}, + html = {}, + -- java_language_server = {}, lua_ls = { -- cmd = { ... }, @@ -698,6 +702,10 @@ require('lazy').setup({ }, }, }, + + opencl_ls = { + filetypes = { 'opencl', 'cl' }, + }, } -- Ensure the servers and tools above are installed @@ -829,7 +837,7 @@ require('lazy').setup({ -- -- All presets have the following mappings: -- /: move to right/left of your snippet expansion - -- : Open menu or open docs if already open + -- : cpen menu or open docs if already open -- / or /: Select next/previous item -- : Hide menu -- : Toggle signature help @@ -881,11 +889,19 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + -- 'folke/tokyonight.nvim', + 'navarasu/onedark.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. + -- init = function() + -- TODO: Figure out how to change line number color + -- https://github.com/navarasu/onedark.nvim + -- https://github.com/navarasu/onedark.nvim/blob/master/lua/onedark/highlights.lua#L133-L257 + -- https://www.reddit.com/r/neovim/comments/mwyzxn/how_to_change_the_color_of_line_numbering/ + -- https://stackoverflow.com/questions/75277938/need-to-change-the-colour-of-line-numbers-in-neovim + -- maybe try opts = {} as that should be equivalent of setup({}) config = function() ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { + require('onedark').setup { styles = { comments = { italic = false }, -- Disable italics in comments }, @@ -894,7 +910,11 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + -- vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'onedark' + + -- You can configure highlights by doing something like: + vim.cmd.hi 'Comment gui=none' end, }, @@ -944,7 +964,8 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + -- ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = 'all', -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -977,8 +998,9 @@ require('lazy').setup({ -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', + -- TODO: Look into neotree to replace netrw -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. @@ -1012,5 +1034,12 @@ require('lazy').setup({ }, }) +vim.opt.foldmethod = 'expr' +vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' +-- TODO: Write foldtext function to have both line count and TS syntax highlighting +-- vim.opt.foldtext = '' +vim.opt.foldlevelstart = 0 +vim.opt.foldnestmax = 4 + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et