From fa8e0e7331c313ed0cf289b00876d0452dbdd4f5 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Tue, 23 Aug 2022 22:12:01 +0300 Subject: [PATCH] Ran luaformat on all neovim files, removed unneeded files --- home/.config/nvim/ftplugin/java.lua | 5 +- home/.config/nvim/lua/pager.lua | 2 +- home/.config/nvim/lua/plugins/cmp.lua | 116 +++--- home/.config/nvim/lua/plugins/colorscheme.lua | 103 +++--- .../nvim/lua/plugins/indent-blankline.lua | 14 +- home/.config/nvim/lua/plugins/init.lua | 331 +++++++++--------- home/.config/nvim/lua/plugins/lualine.lua | 4 +- home/.config/nvim/lua/plugins/nvim-tree.lua | 0 home/.config/nvim/lua/plugins/telescope.lua | 10 +- home/.config/nvim/lua/plugins/treesitter.lua | 29 +- home/.config/nvim/lua/settings.lua | 2 - 11 files changed, 304 insertions(+), 312 deletions(-) delete mode 100644 home/.config/nvim/lua/plugins/nvim-tree.lua diff --git a/home/.config/nvim/ftplugin/java.lua b/home/.config/nvim/ftplugin/java.lua index 3da13fa..4cbe0d6 100644 --- a/home/.config/nvim/ftplugin/java.lua +++ b/home/.config/nvim/ftplugin/java.lua @@ -12,8 +12,9 @@ require('jdtls').start_or_attach({ 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.lang=ALL-UNNAMED', '-jar', nvim_local_dir .. '/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar', - '-configuration', nvim_local_dir .. '/mason/packages/jdtls/config_linux', - '-data', workspace_dir + '-configuration', + nvim_local_dir .. '/mason/packages/jdtls/config_linux', '-data', + workspace_dir } }) diff --git a/home/.config/nvim/lua/pager.lua b/home/.config/nvim/lua/pager.lua index 1534a44..1a8c91f 100644 --- a/home/.config/nvim/lua/pager.lua +++ b/home/.config/nvim/lua/pager.lua @@ -2,4 +2,4 @@ require 'common' MapKey('n', 'q', 'q') ---vim.cmd('set nomodifiable') +-- vim.cmd('set nomodifiable') diff --git a/home/.config/nvim/lua/plugins/cmp.lua b/home/.config/nvim/lua/plugins/cmp.lua index 51a00cf..a4a1757 100644 --- a/home/.config/nvim/lua/plugins/cmp.lua +++ b/home/.config/nvim/lua/plugins/cmp.lua @@ -1,68 +1,62 @@ return function() - -- Setup git completion source - require("cmp_git").setup() + -- Setup git completion source + require("cmp_git").setup() - -- Set completeopt to have a better completion experience - vim.o.completeopt = 'menuone,noselect' + -- Set completeopt to have a better completion experience + vim.o.completeopt = 'menuone,noselect' - -- luasnip setup - local luasnip = require 'luasnip' + -- luasnip setup + local luasnip = require 'luasnip' - -- nvim-cmp setup - local cmp = require 'cmp' - cmp.setup { - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, - [''] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - { name = 'git' }, - { name = 'buffer' }, - }, - } + -- nvim-cmp setup + local cmp = require 'cmp' + cmp.setup { + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end + }, + mapping = { + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true + }, + [''] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, + [''] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end + }, + sources = { + {name = 'nvim_lsp'}, {name = 'luasnip'}, {name = 'path'}, + {name = 'git'}, {name = 'buffer'} + } + } - -- Enable autopairs when enter is processed - -- on completion - local cmp_autopairs = require 'nvim-autopairs.completion.cmp' - cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() - ) + -- Enable autopairs when enter is processed + -- on completion + local cmp_autopairs = require 'nvim-autopairs.completion.cmp' + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) - -- load friendly-snippets to luasnip - require('luasnip/loaders/from_vscode').lazy_load() + -- load friendly-snippets to luasnip + require('luasnip/loaders/from_vscode').lazy_load() end diff --git a/home/.config/nvim/lua/plugins/colorscheme.lua b/home/.config/nvim/lua/plugins/colorscheme.lua index 3c09838..f28d9bd 100644 --- a/home/.config/nvim/lua/plugins/colorscheme.lua +++ b/home/.config/nvim/lua/plugins/colorscheme.lua @@ -1,51 +1,54 @@ -return function () - require('catppuccin').setup({ - transparent_background = false, - term_colors = false, - compile = {enabled = true, path = vim.fn.stdpath 'cache' .. '/catppuccin'}, - styles = { - comments = {'italic'}, - functions = {'italic'}, - keywords = {'italic'}, - strings = {}, - variables = {} - }, - integrations = { - treesitter = true, - native_lsp = { - enabled = true, - virtual_text = { - errors = {'italic'}, - hints = {'italic'}, - warnings = {'italic'}, - information = {'italic'} - }, - underlines = { - errors = {'underline'}, - hints = {'underline'}, - warnings = {'underline'}, - information = {'underline'} - } - }, - lsp_trouble = false, - lsp_saga = false, - gitgutter = true, - gitsigns = false, - telescope = true, - nvimtree = {enabled = false, show_root = false}, - which_key = false, - indent_blankline = {enabled = true, colored_indent_levels = false}, - dashboard = false, - neogit = false, - vim_sneak = false, - fern = false, - barbar = false, - bufferline = false, - markdown = false, - lightspeed = false, - ts_rainbow = false, - hop = false - } - }) - vim.cmd [[colorscheme catppuccin]] +return function() + require('catppuccin').setup({ + transparent_background = false, + term_colors = false, + compile = { + enabled = true, + path = vim.fn.stdpath 'cache' .. '/catppuccin' + }, + styles = { + comments = {'italic'}, + functions = {'italic'}, + keywords = {'italic'}, + strings = {}, + variables = {} + }, + integrations = { + treesitter = true, + native_lsp = { + enabled = true, + virtual_text = { + errors = {'italic'}, + hints = {'italic'}, + warnings = {'italic'}, + information = {'italic'} + }, + underlines = { + errors = {'underline'}, + hints = {'underline'}, + warnings = {'underline'}, + information = {'underline'} + } + }, + lsp_trouble = false, + lsp_saga = false, + gitgutter = true, + gitsigns = false, + telescope = true, + nvimtree = {enabled = false, show_root = false}, + which_key = false, + indent_blankline = {enabled = true, colored_indent_levels = false}, + dashboard = false, + neogit = false, + vim_sneak = false, + fern = false, + barbar = false, + bufferline = false, + markdown = false, + lightspeed = false, + ts_rainbow = false, + hop = false + } + }) + vim.cmd [[colorscheme catppuccin]] end diff --git a/home/.config/nvim/lua/plugins/indent-blankline.lua b/home/.config/nvim/lua/plugins/indent-blankline.lua index 1056ad0..f48e612 100644 --- a/home/.config/nvim/lua/plugins/indent-blankline.lua +++ b/home/.config/nvim/lua/plugins/indent-blankline.lua @@ -1,8 +1,8 @@ -return function () - vim.opt.list = true - require('indent_blankline').setup { - space_char_blankline = ' ', - show_current_context = true, - show_current_context_start = true, - } +return function() + vim.opt.list = true + require('indent_blankline').setup { + space_char_blankline = ' ', + show_current_context = true, + show_current_context_start = true + } end diff --git a/home/.config/nvim/lua/plugins/init.lua b/home/.config/nvim/lua/plugins/init.lua index e0dde74..449f059 100644 --- a/home/.config/nvim/lua/plugins/init.lua +++ b/home/.config/nvim/lua/plugins/init.lua @@ -3,182 +3,179 @@ local fn = vim.fn -- Install packer if it's not yet installed local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then - print('Installing Packer') - Packer_installed = fn.system({ - 'git', 'clone', '--depth', '1', - 'https://github.com/wbthomason/packer.nvim', install_path - }) - vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' .. - vim.o.runtimepath - print('Installed Packer') + print('Installing Packer') + Packer_installed = fn.system({ + 'git', 'clone', '--depth', '1', + 'https://github.com/wbthomason/packer.nvim', install_path + }) + vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' .. + vim.o.runtimepath + print('Installed Packer') end -- Configure packer vim.cmd [[packadd packer.nvim]] require('packer').startup(function() - local use = require('packer').use - - -- The plugin manager itself - use {'wbthomason/packer.nvim', opt=true} - - -- Colorscheme - use { - 'catppuccin/nvim', - as = 'catppuccin', - config = require('plugins.colorscheme'), - } - - -- Git in signcolumn - use 'airblade/vim-gitgutter' - - -- Statusline - use { - 'hoob3rt/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true }, - config = function() - require('lualine').setup { - options = { theme = 'catppuccin' } - } - end, - } - - -- Tabline/bufferline - use { - 'akinsho/nvim-bufferline.lua', - tag = '*', - requires = 'kyazdani42/nvim-web-devicons', - config = function() require('bufferline').setup {} end - } - - -- Git commands - use 'tpope/vim-fugitive' - - -- Indent characters - use { - 'lukas-reineke/indent-blankline.nvim', - config = require('plugins.indent-blankline') - } - - -- Tree explorer - use { - 'kyazdani42/nvim-tree.lua', - requires = 'kyazdani42/nvim-web-devicons', - config = function() require('nvim-tree').setup {} end - } - - -- Telescope - use { - 'nvim-telescope/telescope.nvim', - config = require('plugins.telescope'), - requires = { - { 'nvim-lua/plenary.nvim' }, -- Internal dep for telescope - { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }, -- Use fzf for fuzzy finder - { 'nvim-telescope/telescope-ui-select.nvim' } -- Replace vim built in select with telescope - } - } - - -- Do stuff as sudo - use 'lambdalisue/suda.vim' - - -- Display possible keybinds - use { - 'folke/which-key.nvim', - config = function() require('which-key').setup {} end - } - - -- Read editorconfig settings - use 'editorconfig/editorconfig-vim' - - -- Install LSP server executables - use { - 'williamboman/mason.nvim', - config = function() require('mason').setup {} end - } - use { - 'williamboman/mason-lspconfig.nvim', - config = function() - require('mason-lspconfig').setup { automatic_installation = true } - end - } - - -- Configs for built-in LSP - use { - 'neovim/nvim-lspconfig', - config = require('plugins.lspconfig').setup - } - - -- Additional LSP features for Java - use 'mfussenegger/nvim-jdtls' - - -- Display function signature - use 'ray-x/lsp_signature.nvim' - - -- Completion - use { - 'hrsh7th/nvim-cmp', - requires = { - { 'hrsh7th/cmp-nvim-lsp' }, -- LSP source - { 'hrsh7th/cmp-path' }, -- Path source - { 'petertriho/cmp-git', requires = "nvim-lua/plenary.nvim" }, -- Git source - { 'hrsh7th/cmp-buffer' }, -- Buffer source - { 'saadparwaiz1/cmp_luasnip' }, -- Snippets source - { 'L3MON4D3/LuaSnip' }, -- Snippets plugin - { 'rafamadriz/friendly-snippets' }, -- Snippets collection - }, - config = require('plugins.cmp'), - } - - -- Automatic brackets - use { - 'windwp/nvim-autopairs', - config = function() require('nvim-autopairs').setup{} end - } - - -- treesitter - use { - 'nvim-treesitter/nvim-treesitter', - run = function() - require('nvim-treesitter.install').update({ with_sync = true }) - end, - config = require('plugins.treesitter') - } - - -- treesitter plugin for commentstring - use 'JoosepAlviste/nvim-ts-context-commentstring' - - -- Additional plugins for formats not supported - -- by treesitter - use 'jamespeapen/swayconfig.vim' - - -- mappings for commenting in code - use 'tpope/vim-commentary' - - -- we all know this one - use 'tpope/vim-surround' - - -- Formatter plugin - use 'sbdchd/neoformat' - - -- Make editing passwords safer - use { - 'https://git.zx2c4.com/password-store', - rtp = 'contrib/vim/redact_pass.vim' - } - - -- Neovim inside Firefox - use { - 'glacambre/firenvim', - run = function() vim.fn['firenvim#install'](0) end - } - - -- Vim <3 Asciidoctor - use 'habamax/vim-asciidoctor' + local use = require('packer').use + + -- The plugin manager itself + use {'wbthomason/packer.nvim', opt = true} + + -- Colorscheme + use { + 'catppuccin/nvim', + as = 'catppuccin', + config = require('plugins.colorscheme') + } + + -- Git in signcolumn + use 'airblade/vim-gitgutter' + + -- Statusline + use { + 'hoob3rt/lualine.nvim', + requires = {'kyazdani42/nvim-web-devicons', opt = true}, + config = function() + require('lualine').setup {options = {theme = 'catppuccin'}} + end + } + + -- Tabline/bufferline + use { + 'akinsho/nvim-bufferline.lua', + tag = '*', + requires = 'kyazdani42/nvim-web-devicons', + config = function() require('bufferline').setup {} end + } + + -- Git commands + use 'tpope/vim-fugitive' + + -- Indent characters + use { + 'lukas-reineke/indent-blankline.nvim', + config = require('plugins.indent-blankline') + } + + -- Tree explorer + use { + 'kyazdani42/nvim-tree.lua', + requires = 'kyazdani42/nvim-web-devicons', + config = function() require('nvim-tree').setup {} end + } + + -- Telescope + use { + 'nvim-telescope/telescope.nvim', + config = require('plugins.telescope'), + requires = { + {'nvim-lua/plenary.nvim'}, -- Internal dep for telescope + {'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}, -- Use fzf for fuzzy finder + {'nvim-telescope/telescope-ui-select.nvim'} -- Replace vim built in select with telescope + } + } + + -- Do stuff as sudo + use 'lambdalisue/suda.vim' + + -- Display possible keybinds + use { + 'folke/which-key.nvim', + config = function() + require('which-key').setup {spelling = {enabled = true}} + end + } + + -- Read editorconfig settings + use 'editorconfig/editorconfig-vim' + + -- Install LSP server executables + use { + 'williamboman/mason.nvim', + config = function() require('mason').setup {} end + } + use { + 'williamboman/mason-lspconfig.nvim', + config = function() + require('mason-lspconfig').setup {automatic_installation = true} + end + } + + -- Configs for built-in LSP + use {'neovim/nvim-lspconfig', config = require('plugins.lspconfig').setup} + + -- Additional LSP features for Java + use 'mfussenegger/nvim-jdtls' + + -- Display function signature + use 'ray-x/lsp_signature.nvim' + + -- Completion + use { + 'hrsh7th/nvim-cmp', + requires = { + {'hrsh7th/cmp-nvim-lsp'}, -- LSP source + {'hrsh7th/cmp-path'}, -- Path source + {'petertriho/cmp-git', requires = "nvim-lua/plenary.nvim"}, -- Git source + {'hrsh7th/cmp-buffer'}, -- Buffer source + {'saadparwaiz1/cmp_luasnip'}, -- Snippets source + {'L3MON4D3/LuaSnip'}, -- Snippets plugin + {'rafamadriz/friendly-snippets'} -- Snippets collection + }, + config = require('plugins.cmp') + } + + -- Automatic brackets + use { + 'windwp/nvim-autopairs', + config = function() require('nvim-autopairs').setup {} end + } + + -- treesitter + use { + 'nvim-treesitter/nvim-treesitter', + run = function() + require('nvim-treesitter.install').update({with_sync = true}) + end, + config = require('plugins.treesitter') + } + + -- treesitter plugin for commentstring + use 'JoosepAlviste/nvim-ts-context-commentstring' + + -- Additional plugins for formats not supported + -- by treesitter + use 'jamespeapen/swayconfig.vim' + + -- mappings for commenting in code + use 'tpope/vim-commentary' + + -- we all know this one + use 'tpope/vim-surround' + + -- Formatter plugin + use 'sbdchd/neoformat' + + -- Make editing passwords safer + use { + 'https://git.zx2c4.com/password-store', + rtp = 'contrib/vim/redact_pass.vim' + } + + -- Neovim inside Firefox + use { + 'glacambre/firenvim', + run = function() vim.fn['firenvim#install'](0) end + } + + -- Vim <3 Asciidoctor + use 'habamax/vim-asciidoctor' end) -- Sync plugins if Packer was just -- installed if Packer_installed then - print('Syncing plugins') - require('packer').sync() + print('Syncing plugins') + require('packer').sync() end diff --git a/home/.config/nvim/lua/plugins/lualine.lua b/home/.config/nvim/lua/plugins/lualine.lua index 205c0bb..815d2d9 100644 --- a/home/.config/nvim/lua/plugins/lualine.lua +++ b/home/.config/nvim/lua/plugins/lualine.lua @@ -1,3 +1 @@ -require'lualine'.setup { - options = {theme = 'catppuccin'}, -} +require'lualine'.setup {options = {theme = 'catppuccin'}} diff --git a/home/.config/nvim/lua/plugins/nvim-tree.lua b/home/.config/nvim/lua/plugins/nvim-tree.lua deleted file mode 100644 index e69de29..0000000 diff --git a/home/.config/nvim/lua/plugins/telescope.lua b/home/.config/nvim/lua/plugins/telescope.lua index fc94b44..3d889de 100644 --- a/home/.config/nvim/lua/plugins/telescope.lua +++ b/home/.config/nvim/lua/plugins/telescope.lua @@ -1,6 +1,6 @@ -return function () - local telescope = require('telescope') - telescope.setup {} - telescope.load_extension('fzf') - telescope.load_extension('ui-select') +return function() + local telescope = require('telescope') + telescope.setup {} + telescope.load_extension('fzf') + telescope.load_extension('ui-select') end diff --git a/home/.config/nvim/lua/plugins/treesitter.lua b/home/.config/nvim/lua/plugins/treesitter.lua index daeff0f..25c5cc9 100644 --- a/home/.config/nvim/lua/plugins/treesitter.lua +++ b/home/.config/nvim/lua/plugins/treesitter.lua @@ -1,16 +1,17 @@ -return function () - require'nvim-treesitter.configs'.setup { - ensure_installed = { - 'bash', 'c', 'css', 'dockerfile', 'html', 'http', 'java', 'json', - 'json5', 'latex', 'lua', 'make', 'markdown', 'php', 'python', 'regex', - 'rst', 'scss', 'toml', 'tsx', 'typescript', 'javascript', 'yaml' - }, - highlight = {enable = true}, - indent = {enable = true}, - incremental_selection = {enable = true}, - context_commentstring = {enable = true} - } +return function() + require'nvim-treesitter.configs'.setup { + ensure_installed = { + 'bash', 'c', 'css', 'dockerfile', 'html', 'http', 'java', 'json', + 'json5', 'latex', 'lua', 'make', 'markdown', 'php', 'python', + 'regex', 'rst', 'scss', 'toml', 'tsx', 'typescript', 'javascript', + 'yaml' + }, + highlight = {enable = true}, + indent = {enable = true}, + incremental_selection = {enable = true}, + context_commentstring = {enable = true} + } - --vim.wo.foldmethod = 'expr' - --im.wo.foldexpr = 'nvim_treesitter#foldexpr()' + -- vim.wo.foldmethod = 'expr' + -- im.wo.foldexpr = 'nvim_treesitter#foldexpr()' end diff --git a/home/.config/nvim/lua/settings.lua b/home/.config/nvim/lua/settings.lua index 8ff3474..3817c05 100644 --- a/home/.config/nvim/lua/settings.lua +++ b/home/.config/nvim/lua/settings.lua @@ -38,12 +38,10 @@ cmd 'highlight SignColumn guibg=transparent' -- Use suda by default g.suda_smart_edit = 1 - -- Split direction o.splitbelow = true o.splitright = true - -- Case insensitive search o.ignorecase = true o.smartcase = true