diff --git a/init.lua b/init.lua index c1f0a1b..7d2c2c6 100644 --- a/init.lua +++ b/init.lua @@ -1,21 +1,26 @@ -require('nv-globals') -require('plugins') -require('colorscheme') -require('settings') -require('keymappings') +if (vim.api.nvim_eval('exists("g:vscode")')) then + require('settings') + require('keymappings') +else + require('nv-globals') + require('plugins') + require('colorscheme') + require('settings') + require('keymappings') --- LSP -require('lsp') -require('lsp.typescript-ls') -require('lsp.python-ls') -require('lsp.lua-ls') -require('lsp.elixir-ls') -require('lsp.go-ls') + -- LSP + require('lsp') + require('lsp.typescript-ls') + require('lsp.python-ls') + require('lsp.lua-ls') + require('lsp.elixir-ls') + require('lsp.go-ls') --- Completion -require('nv-compe') + -- Completion + require('nv-compe') --- Function signatures -require('lsp_signature') + -- Function signatures + require('lsp_signature') -require('nv-prettier') + require('nv-prettier') +end diff --git a/lua/keymappings.lua b/lua/keymappings.lua index a47894d..b44959a 100644 --- a/lua/keymappings.lua +++ b/lua/keymappings.lua @@ -17,6 +17,11 @@ vim.api.nvim_set_keymap('o', '', '', {silent = true}) vim.api.nvim_set_keymap('l', '', '', {silent = true}) vim.api.nvim_set_keymap('t', '', '', {silent = true}) +-- Move left and right when in insert mode. +vim.api.nvim_set_keymap("i", '', '', {silent = true}) +vim.api.nvim_set_keymap("i", '', '', {silent = true}) + + -- Quick save. vim.api.nvim_set_keymap('n', 'fw', ':w', {silent = true}) diff --git a/lua/lsp/go-ls.lua b/lua/lsp/go-ls.lua index 74e4d0f..ac717b8 100644 --- a/lua/lsp/go-ls.lua +++ b/lua/lsp/go-ls.lua @@ -1,4 +1,4 @@ -lspconfig = require "lspconfig" +local lspconfig = require "lspconfig" lspconfig.gopls.setup { on_attach = function(client, bufnr) require "lsp_signature".on_attach({ @@ -14,6 +14,7 @@ lspconfig.gopls.setup { end, cmd = {"gopls", "serve"}, settings = { + autostart = true, gopls = { analyses = { unusedparams = true, @@ -21,6 +22,7 @@ lspconfig.gopls.setup { staticcheck = true, }, }, + autostart = true, root_dir = lspconfig.util.root_pattern(".git","go.mod"), init_options = {usePlaceholders = true, completeUnimported = true}, } diff --git a/lua/settings.lua b/lua/settings.lua index 9e88272..c1c5525 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -22,7 +22,7 @@ vim.o.updatetime = 300 -- Faster completion vim.o.timeoutlen = 500 -- By default timeoutlen is 1000 ms vim.cmd(":set number relativenumber") -vim.cmd("highlight ColorColumn ctermbg=0 guibg=lightgrey") +vim.cmd("highlight ColorColumn ctermbg=0 guibg=grey") ------ Folding -- vim.o.foldlevel = 99 -- Persist folds. diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua new file mode 100644 index 0000000..dde02df --- /dev/null +++ b/plugin/packer_compiled.lua @@ -0,0 +1,170 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + + local time + local profile_info + local should_profile = false + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/Users/marianouvalle/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/marianouvalle/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/marianouvalle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/marianouvalle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/Users/marianouvalle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s)) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + ["auto-pairs"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/auto-pairs" + }, + ["black-nvim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/black-nvim" + }, + ["gitsigns.nvim"] = { + config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" }, + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/gitsigns.nvim" + }, + ["lightline.vim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/lightline.vim" + }, + ["lsp_signature.nvim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim" + }, + ["lspsaga.nvim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/lspsaga.nvim" + }, + ["nvim-compe"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/nvim-compe" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/nvim-lspconfig" + }, + ["nvim-lspinstall"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/nvim-lspinstall" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/packer.nvim" + }, + ["palenight.vim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/palenight.vim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/plenary.nvim" + }, + ["popup.nvim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/popup.nvim" + }, + ["telescope.nvim"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/telescope.nvim" + }, + ["vim-commentary"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/vim-commentary" + }, + ["vim-go"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/vim-go" + }, + ["vim-polyglot"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/vim-polyglot" + }, + ["vim-prettier"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/vim-prettier" + }, + ["vim-rooter"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/vim-rooter" + }, + ["vim-styled-components"] = { + loaded = true, + path = "/Users/marianouvalle/.local/share/nvim/site/pack/packer/start/vim-styled-components" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: gitsigns.nvim +time([[Config for gitsigns.nvim]], true) +try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim") +time([[Config for gitsigns.nvim]], false) +if should_profile then save_profiles() end + +end) + +if not no_errors then + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end