From ec8547fe833fbe1edf9cca6080bd7612c692520b Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 20 Mar 2024 20:00:52 -0500 Subject: [PATCH] chg: Tidy things up, convert more stuff to lua, and switch to lualine --- laptop/keymaps.vim | 4 +++ laptop/paq.lua | 6 ++-- laptop/plugin/airline.vim | 50 -------------------------------- laptop/plugin/lualine.lua | 13 +++++++++ laptop/plugin/suda.lua | 5 ++++ laptop/plugin/suda.vim | 4 --- laptop/plugin/vimtex.lua | 23 +++++++++++++++ laptop/plugin/vimtex.vim | 27 ----------------- server/keymaps.vim | 4 +++ server/paq.lua | 6 ++-- server/plugin/airline.vim | 45 ----------------------------- server/plugin/cmp.lua | 61 --------------------------------------- server/plugin/lualine.lua | 13 +++++++++ server/plugin/pyright.lua | 11 ------- server/plugin/suda.lua | 5 ++++ server/plugin/suda.vim | 3 -- vps/paq.lua | 9 ++---- vps/plugin/airline.vim | 45 ----------------------------- vps/plugin/cmp.lua | 61 --------------------------------------- vps/plugin/lualine.lua | 13 +++++++++ vps/plugin/pyright.lua | 11 ------- vps/plugin/suda.lua | 5 ++++ vps/plugin/suda.vim | 3 -- 23 files changed, 94 insertions(+), 333 deletions(-) delete mode 100644 laptop/plugin/airline.vim create mode 100644 laptop/plugin/lualine.lua create mode 100644 laptop/plugin/suda.lua delete mode 100644 laptop/plugin/suda.vim create mode 100644 laptop/plugin/vimtex.lua delete mode 100644 laptop/plugin/vimtex.vim delete mode 100644 server/plugin/airline.vim delete mode 100644 server/plugin/cmp.lua create mode 100644 server/plugin/lualine.lua delete mode 100644 server/plugin/pyright.lua create mode 100644 server/plugin/suda.lua delete mode 100644 server/plugin/suda.vim delete mode 100644 vps/plugin/airline.vim delete mode 100644 vps/plugin/cmp.lua create mode 100644 vps/plugin/lualine.lua delete mode 100644 vps/plugin/pyright.lua create mode 100644 vps/plugin/suda.lua delete mode 100644 vps/plugin/suda.vim diff --git a/laptop/keymaps.vim b/laptop/keymaps.vim index 5343faa..90f50c1 100644 --- a/laptop/keymaps.vim +++ b/laptop/keymaps.vim @@ -30,3 +30,7 @@ nnoremap u " Find files using fzf by ,f nnoremap f :Files +" Move around buffers using ,j and ,k +nnoremap k :bnext +nnoremap k :bprevious + diff --git a/laptop/paq.lua b/laptop/paq.lua index 0fb7a09..50bc61d 100644 --- a/laptop/paq.lua +++ b/laptop/paq.lua @@ -24,9 +24,9 @@ end bootstrap_paq { -- Let paq-nvim manage itself "savq/paq-nvim", - -- airline related plugins - "vim-airline/vim-airline", - "vim-airline/vim-airline-themes", + -- Use lualine for statusbar + "nvim-lualine/lualine.nvim", + "nvim-tree/nvim-web-devicons", -- Auto commenting per filetype "numToStr/Comment.nvim", -- Give option to save files using sudo, if needed diff --git a/laptop/plugin/airline.vim b/laptop/plugin/airline.vim deleted file mode 100644 index 32f3f22..0000000 --- a/laptop/plugin/airline.vim +++ /dev/null @@ -1,50 +0,0 @@ -" enable tabline -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#left_sep = '' -let g:airline#extensions#tabline#left_alt_sep = '' -let g:airline#extensions#tabline#right_sep = '' -let g:airline#extensions#tabline#right_alt_sep = '' - -" air-line -let g:airline_powerline_fonts = 1 - -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif - -" unicode symbols -let g:airline_left_sep = '»' -let g:airline_left_sep = '▶' -let g:airline_right_sep = '«' -let g:airline_right_sep = '◀' -let g:airline_symbols.linenr = '␊' -let g:airline_symbols.linenr = '␤' -let g:airline_symbols.linenr = '¶' -let g:airline_symbols.branch = '⎇' -let g:airline_symbols.paste = 'ρ' -let g:airline_symbols.paste = 'Þ' -let g:airline_symbols.paste = '∥' -let g:airline_symbols.whitespace = 'Ξ' - -" airline symbols -let g:airline_left_sep = '' -let g:airline_left_alt_sep = '' -let g:airline_right_sep = '' -let g:airline_right_alt_sep = '' -let g:airline_symbols.branch = '' -let g:airline_symbols.readonly = '' -let g:airline_symbols.linenr = '' - -" Switch to your current theme -let g:airline_theme = 'moonfly' - -" Always show tabs -set showtabline=2 - -" We don't need to see things like -- INSERT -- anymore -set noshowmode - -" Navigate tabs using ,j and ,k -nnoremap k :bnext -nnoremap j :bprevious - diff --git a/laptop/plugin/lualine.lua b/laptop/plugin/lualine.lua new file mode 100644 index 0000000..7ee31c1 --- /dev/null +++ b/laptop/plugin/lualine.lua @@ -0,0 +1,13 @@ +require("lualine").setup{ + options = { + theme = 'moonfly', + }, + tabline = { + lualine_a = {'buffers'}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {'filename'}, + lualine_z = {'tabs'}, + }, +} diff --git a/laptop/plugin/suda.lua b/laptop/plugin/suda.lua new file mode 100644 index 0000000..d25555a --- /dev/null +++ b/laptop/plugin/suda.lua @@ -0,0 +1,5 @@ +-- Disable Suda in diff views +if not vim.api.nvim_win_get_option(0, 'diff') then + vim.g.suda_smart_edit = 1 +end + diff --git a/laptop/plugin/suda.vim b/laptop/plugin/suda.vim deleted file mode 100644 index 15e6b27..0000000 --- a/laptop/plugin/suda.vim +++ /dev/null @@ -1,4 +0,0 @@ -if ! &diff - let g:suda_smart_edit = 1 -endif - diff --git a/laptop/plugin/vimtex.lua b/laptop/plugin/vimtex.lua new file mode 100644 index 0000000..0a3a6f4 --- /dev/null +++ b/laptop/plugin/vimtex.lua @@ -0,0 +1,23 @@ +-- Enable languagetool support using YaLafi +vim.g.vimtex_grammar_vlty = { lt_command = "languagetool" } + +-- Compile once by ;lo and also add proper line-breaking +vim.api.nvim_create_autocmd( + 'FileType', { + desc = 'Compile once by lo and also add proper line-breaking', + pattern = 'tex', + group = vim.api.nvim_create_augroup('vimrc_tex', {}), + callback = function() + vim.keymap.set('n', 'lo', ":silent VimtexCompileSS", {buffer = true }) + vim.opt.linebreak = true + vim.opt.tw = 140 + end, + } +) + +-- Use zathura with vimtex, the zathura_simple one makes synctex work in Wayland +vim.g.vimtex_view_method = 'zathura_simple' + +-- Use a temporary directory for aux files +vim.g.vimtex_compiler_latexmk = { aux_dir = "/tmp/latexmk" } + diff --git a/laptop/plugin/vimtex.vim b/laptop/plugin/vimtex.vim deleted file mode 100644 index 3cca6a9..0000000 --- a/laptop/plugin/vimtex.vim +++ /dev/null @@ -1,27 +0,0 @@ -" Automatically start continuous compilation -" augroup vimtex_config -" autocmd User VimtexEventInitPost VimtexCompile -" augroup END - -" Enable languagetool support using YaLafi -let g:vimtex_grammar_vlty = {'lt_command': 'languagetool'} -set spelllang=en_us - -" Compile once by \lo -augroup vimrc_tex - autocmd! - autocmd FileType tex nnoremap lo :silent VimtexCompileSS -augroup END - -" Enable word wrapping for tex files -" autocmd FileType tex :set wrap -autocmd FileType tex :set linebreak -autocmd FileType tex :set tw=140 - -" Use zathura with vimtex, the zathura_simple one makes synctex work in -" Wayland -let g:vimtex_view_method = 'zathura_simple' - -" Use a temporary directory for aux files -let g:vimtex_compiler_latexmk = { 'aux_dir' : '/tmp/latexmk' } - diff --git a/server/keymaps.vim b/server/keymaps.vim index d5db0f3..9cca56f 100644 --- a/server/keymaps.vim +++ b/server/keymaps.vim @@ -15,3 +15,7 @@ nnoremap O Oj " Use ,u for redo nnoremap u +" Move around buffers using ,j and ,k +nnoremap k :bnext +nnoremap k :bprevious + diff --git a/server/paq.lua b/server/paq.lua index c8cce1f..840bf3d 100644 --- a/server/paq.lua +++ b/server/paq.lua @@ -24,9 +24,9 @@ end bootstrap_paq { -- Let paq-nvim manage itself "savq/paq-nvim", - -- airline related plugins - "vim-airline/vim-airline", - "vim-airline/vim-airline-themes", + -- Use lualine for statusbar + "nvim-lualine/lualine.nvim", + "nvim-tree/nvim-web-devicons", -- Auto commenting per filetype "numToStr/Comment.nvim", -- Give option to save files using sudo, if needed diff --git a/server/plugin/airline.vim b/server/plugin/airline.vim deleted file mode 100644 index b295121..0000000 --- a/server/plugin/airline.vim +++ /dev/null @@ -1,45 +0,0 @@ -" enable tabline -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#left_sep = '' -let g:airline#extensions#tabline#left_alt_sep = '' -let g:airline#extensions#tabline#right_sep = '' -let g:airline#extensions#tabline#right_alt_sep = '' - -" air-line -let g:airline_powerline_fonts = 1 - -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif - -" unicode symbols -let g:airline_left_sep = '»' -let g:airline_left_sep = '▶' -let g:airline_right_sep = '«' -let g:airline_right_sep = '◀' -let g:airline_symbols.linenr = '␊' -let g:airline_symbols.linenr = '␤' -let g:airline_symbols.linenr = '¶' -let g:airline_symbols.branch = '⎇' -let g:airline_symbols.paste = 'ρ' -let g:airline_symbols.paste = 'Þ' -let g:airline_symbols.paste = '∥' -let g:airline_symbols.whitespace = 'Ξ' - -" airline symbols -let g:airline_left_sep = '' -let g:airline_left_alt_sep = '' -let g:airline_right_sep = '' -let g:airline_right_alt_sep = '' -let g:airline_symbols.branch = '' -let g:airline_symbols.readonly = '' -let g:airline_symbols.linenr = '' - -" Switch to your current theme -let g:airline_theme = 'moonfly' - -" Always show tabs -set showtabline=2 - -" We don't need to see things like -- INSERT -- anymore -set noshowmode diff --git a/server/plugin/cmp.lua b/server/plugin/cmp.lua deleted file mode 100644 index 34ba86c..0000000 --- a/server/plugin/cmp.lua +++ /dev/null @@ -1,61 +0,0 @@ -local cmp = require'cmp' - -cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - end, - }, - window = { - completion = cmp.config.window.bordered(winhighlight), - documentation = cmp.config.window.bordered(winhighlight), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - }, {{ name = 'buffer' }} - ), - experimental = { ghost_text = true }, - }) - - -- Set configuration for specific filetype. - cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). - }, { - { name = 'buffer' }, - }) -}) - --- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline({ '/', '?' }, { -mapping = cmp.mapping.preset.cmdline(), -sources = { - { name = 'buffer' } -} -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { -mapping = cmp.mapping.preset.cmdline(), -sources = cmp.config.sources({ - { name = 'path' } -}, { - { name = 'cmdline' } -}) -}) - diff --git a/server/plugin/lualine.lua b/server/plugin/lualine.lua new file mode 100644 index 0000000..7ee31c1 --- /dev/null +++ b/server/plugin/lualine.lua @@ -0,0 +1,13 @@ +require("lualine").setup{ + options = { + theme = 'moonfly', + }, + tabline = { + lualine_a = {'buffers'}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {'filename'}, + lualine_z = {'tabs'}, + }, +} diff --git a/server/plugin/pyright.lua b/server/plugin/pyright.lua deleted file mode 100644 index 132e859..0000000 --- a/server/plugin/pyright.lua +++ /dev/null @@ -1,11 +0,0 @@ -require'lspconfig'.pyright.setup({ - on_attach = on_attach, - flags = lsp_flags, - settings = { - python = { - analysis = { - typeCheckingMode = "off" - } - } - } -}) diff --git a/server/plugin/suda.lua b/server/plugin/suda.lua new file mode 100644 index 0000000..d25555a --- /dev/null +++ b/server/plugin/suda.lua @@ -0,0 +1,5 @@ +-- Disable Suda in diff views +if not vim.api.nvim_win_get_option(0, 'diff') then + vim.g.suda_smart_edit = 1 +end + diff --git a/server/plugin/suda.vim b/server/plugin/suda.vim deleted file mode 100644 index d66021d..0000000 --- a/server/plugin/suda.vim +++ /dev/null @@ -1,3 +0,0 @@ -if ! &diff - let g:suda_smart_edit = 1 -endif diff --git a/vps/paq.lua b/vps/paq.lua index 2b58a05..e349cfb 100644 --- a/vps/paq.lua +++ b/vps/paq.lua @@ -24,18 +24,15 @@ end bootstrap_paq { -- Let paq-nvim manage itself "savq/paq-nvim", - -- airline related plugins - "vim-airline/vim-airline", - "vim-airline/vim-airline-themes", + -- Use lualine for statusbar + "nvim-lualine/lualine.nvim", + "nvim-tree/nvim-web-devicons", -- Auto commenting per filetype "numToStr/Comment.nvim", -- Give option to save files using sudo, if needed "lambdalisue/suda.vim", -- Auto toggle for number mode when vim isn't focused "sitiom/nvim-numbertoggle", - -- Plugin for lean - "nvim-tree/nvim-tree.lua", - "nvim-tree/nvim-web-devicons", -- LSP related plugins "neovim/nvim-lspconfig", "nvim-lua/plenary.nvim", diff --git a/vps/plugin/airline.vim b/vps/plugin/airline.vim deleted file mode 100644 index b295121..0000000 --- a/vps/plugin/airline.vim +++ /dev/null @@ -1,45 +0,0 @@ -" enable tabline -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#left_sep = '' -let g:airline#extensions#tabline#left_alt_sep = '' -let g:airline#extensions#tabline#right_sep = '' -let g:airline#extensions#tabline#right_alt_sep = '' - -" air-line -let g:airline_powerline_fonts = 1 - -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif - -" unicode symbols -let g:airline_left_sep = '»' -let g:airline_left_sep = '▶' -let g:airline_right_sep = '«' -let g:airline_right_sep = '◀' -let g:airline_symbols.linenr = '␊' -let g:airline_symbols.linenr = '␤' -let g:airline_symbols.linenr = '¶' -let g:airline_symbols.branch = '⎇' -let g:airline_symbols.paste = 'ρ' -let g:airline_symbols.paste = 'Þ' -let g:airline_symbols.paste = '∥' -let g:airline_symbols.whitespace = 'Ξ' - -" airline symbols -let g:airline_left_sep = '' -let g:airline_left_alt_sep = '' -let g:airline_right_sep = '' -let g:airline_right_alt_sep = '' -let g:airline_symbols.branch = '' -let g:airline_symbols.readonly = '' -let g:airline_symbols.linenr = '' - -" Switch to your current theme -let g:airline_theme = 'moonfly' - -" Always show tabs -set showtabline=2 - -" We don't need to see things like -- INSERT -- anymore -set noshowmode diff --git a/vps/plugin/cmp.lua b/vps/plugin/cmp.lua deleted file mode 100644 index 34ba86c..0000000 --- a/vps/plugin/cmp.lua +++ /dev/null @@ -1,61 +0,0 @@ -local cmp = require'cmp' - -cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - end, - }, - window = { - completion = cmp.config.window.bordered(winhighlight), - documentation = cmp.config.window.bordered(winhighlight), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - }, {{ name = 'buffer' }} - ), - experimental = { ghost_text = true }, - }) - - -- Set configuration for specific filetype. - cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). - }, { - { name = 'buffer' }, - }) -}) - --- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline({ '/', '?' }, { -mapping = cmp.mapping.preset.cmdline(), -sources = { - { name = 'buffer' } -} -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { -mapping = cmp.mapping.preset.cmdline(), -sources = cmp.config.sources({ - { name = 'path' } -}, { - { name = 'cmdline' } -}) -}) - diff --git a/vps/plugin/lualine.lua b/vps/plugin/lualine.lua new file mode 100644 index 0000000..7ee31c1 --- /dev/null +++ b/vps/plugin/lualine.lua @@ -0,0 +1,13 @@ +require("lualine").setup{ + options = { + theme = 'moonfly', + }, + tabline = { + lualine_a = {'buffers'}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {'filename'}, + lualine_z = {'tabs'}, + }, +} diff --git a/vps/plugin/pyright.lua b/vps/plugin/pyright.lua deleted file mode 100644 index 132e859..0000000 --- a/vps/plugin/pyright.lua +++ /dev/null @@ -1,11 +0,0 @@ -require'lspconfig'.pyright.setup({ - on_attach = on_attach, - flags = lsp_flags, - settings = { - python = { - analysis = { - typeCheckingMode = "off" - } - } - } -}) diff --git a/vps/plugin/suda.lua b/vps/plugin/suda.lua new file mode 100644 index 0000000..d25555a --- /dev/null +++ b/vps/plugin/suda.lua @@ -0,0 +1,5 @@ +-- Disable Suda in diff views +if not vim.api.nvim_win_get_option(0, 'diff') then + vim.g.suda_smart_edit = 1 +end + diff --git a/vps/plugin/suda.vim b/vps/plugin/suda.vim deleted file mode 100644 index d66021d..0000000 --- a/vps/plugin/suda.vim +++ /dev/null @@ -1,3 +0,0 @@ -if ! &diff - let g:suda_smart_edit = 1 -endif