From f9369c20aa5d4c1a39668cbbf328ded2ecd58d9c Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 20 Mar 2024 17:55:18 -0500 Subject: [PATCH] chg: Move most of the config to lua --- laptop/init.lua | 45 +++++++++++++++++++---- laptop/keymaps.vim | 32 +++++++++++++++++ laptop/paq.lua | 2 +- laptop/plugin/misc.lua | 8 +++++ laptop/plugin/suda.vim | 1 + laptop/vimrc.vim | 82 ------------------------------------------ server/init.lua | 42 +++++++++++++++++----- server/keymaps.vim | 17 +++++++++ server/paq.lua | 9 +---- server/plugin/misc.lua | 11 ++++++ server/vimrc.vim | 75 -------------------------------------- vps/init.lua | 41 ++++++++++++++++----- vps/keymaps.vim | 17 +++++++++ vps/paq.lua | 1 + vps/plugin/misc.lua | 11 ++++++ vps/vimrc.vim | 75 -------------------------------------- 16 files changed, 205 insertions(+), 264 deletions(-) create mode 100644 laptop/keymaps.vim create mode 100644 laptop/plugin/misc.lua delete mode 100644 laptop/vimrc.vim create mode 100644 server/keymaps.vim create mode 100644 server/plugin/misc.lua delete mode 100644 server/vimrc.vim create mode 100644 vps/keymaps.vim create mode 100644 vps/plugin/misc.lua delete mode 100644 vps/vimrc.vim diff --git a/laptop/init.lua b/laptop/init.lua index d7112a0..83cf54a 100644 --- a/laptop/init.lua +++ b/laptop/init.lua @@ -1,11 +1,42 @@ --- Load old vimrc first -local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim" -vim.cmd.source(vimrc) +local set = vim.opt --- Load plugins using vim-plug +-- Turn on numbers +set.number = true +-- Turn off line wrapping +set.wrap = false +-- Disable cmdline from bottom +set.cmdheight = 0 +-- Ignore case while searching except when the search term contains capital letters +set.ignorecase = true +set.smartcase = true +-- Use 4 spaces and properly adjust them for files using TAB +set.tabstop = 4 +set.shiftwidth = 4 +set.softtabstop = 4 +set.expandtab = true +-- Show LSP signs in the number column +set.signcolumn = 'number' +-- Turn on spell checking +set.spell = true +-- Enable mouse support +set.mouse = 'n' +-- Enable programming dictionary +set.spelllang = { "en", "programming" } +-- Use ctrl-[hjkl] to select the active split + +-- Disable unused plugins +vim.g.loaded_perl_provider = 0 +vim.g.loaded_node_provider = 0 +vim.g.loaded_ruby_provider = 0 + +-- Load UltiSnips snippets from custom-snippets directory +vim.g.UltiSnipsSnippetDirectories = { "custom-snippets", "UltiSnips" } + +-- Load keymaps +local keymaps = vim.fn.stdpath("config") .. "/keymaps.vim" +vim.cmd.source(keymaps) + +-- Load plugins using paq-nvim local paq = vim.fn.stdpath("config") .. "/paq.lua" vim.cmd.source(paq) --- Default settings for comment plugin -require('Comment').setup() - diff --git a/laptop/keymaps.vim b/laptop/keymaps.vim new file mode 100644 index 0000000..5343faa --- /dev/null +++ b/laptop/keymaps.vim @@ -0,0 +1,32 @@ +" This file lists all the global keymaps + +" Set K to hover +command -nargs=+ LspHover lua vim.lsp.buf.hover() +set keywordprg=:LspHover + +" Use ctrl-[hjkl] to select the active split! +nmap :wincmd k +nmap :wincmd j +nmap :wincmd h +nmap :wincmd l + +" Change the leader and localleader +let mapleader="," +let maplocalleader=';' + +" Use ,dd for deleting without putting into buffer +nnoremap d "_d +nnoremap D "_D +nnoremap x "_x +vnoremap d "_d + +" Insert a newline in normal mode by ,o +nnoremap o ok +nnoremap O Oj + +" Use ,u for redo +nnoremap u + +" Find files using fzf by ,f +nnoremap f :Files + diff --git a/laptop/paq.lua b/laptop/paq.lua index 3fe3b9b..0fb7a09 100644 --- a/laptop/paq.lua +++ b/laptop/paq.lua @@ -59,6 +59,6 @@ bootstrap_paq { "lervag/vimtex", -- Formatter "stevearc/conform.nvim", - -- For Searching "junegunn/fzf.vim", + "kylechui/nvim-surround", } diff --git a/laptop/plugin/misc.lua b/laptop/plugin/misc.lua new file mode 100644 index 0000000..f0a642d --- /dev/null +++ b/laptop/plugin/misc.lua @@ -0,0 +1,8 @@ +-- This file lists all the plugins that need to be initiated to default setup + +-- Default settings for comment plugin +require("Comment").setup() + +-- Default settings for nvim-surround +require("nvim-surround").setup() + diff --git a/laptop/plugin/suda.vim b/laptop/plugin/suda.vim index d66021d..15e6b27 100644 --- a/laptop/plugin/suda.vim +++ b/laptop/plugin/suda.vim @@ -1,3 +1,4 @@ if ! &diff let g:suda_smart_edit = 1 endif + diff --git a/laptop/vimrc.vim b/laptop/vimrc.vim deleted file mode 100644 index 0496458..0000000 --- a/laptop/vimrc.vim +++ /dev/null @@ -1,82 +0,0 @@ -" Disable netrw for nvim-tree to work -" let loaded_netrw = 1 -" let loaded_netrwPlugin = 1 - -" Turn on numbers -set number - -" Turn off line wrapping -set nowrap - -" Turn on syntax highlighting -syntax on -filetype plugin indent on - -" Disable cmdline from bottom -set cmdheight=0 - -" Display as much of a line as possible instead of just showing @ -set display+=lastline - -" Ignore case while searching except when the search term contains capital letters -set ignorecase -set smartcase - -" Use 4 spaces for tabs and properly adjust them for files using TAB -set tabstop=4 -set shiftwidth=4 -set expandtab - -" Needed for group colors to work in nvim-tree -set termguicolors - -" Show LSP signs in the number column -set signcolumn=number - -" Turn on spell checking -set spell - -" Enable mouse support -set mouse=n - -" Set K to hover -command -nargs=+ LspHover lua vim.lsp.buf.hover() -set keywordprg=:LspHover - -" Enable programming dictionary -set spelllang=en,programming - -" Use ctrl-[hjkl] to select the active split! -nmap :wincmd k -nmap :wincmd j -nmap :wincmd h -nmap :wincmd l - -" Disable unused plugins -let g:loaded_perl_provider=0 -let g:loaded_node_provider=0 -let g:loaded_ruby_provider=0 - -" Change the leader and localleader -let mapleader="," -let maplocalleader=';' - -" Use ,dd for deleting without putting into buffer -nnoremap d "_d -nnoremap D "_D -nnoremap x "_x -vnoremap d "_d - -" Insert a newline in normal mode by ,o -nnoremap o ok -nnoremap O Oj - -" Use ,u for redo -nnoremap u - -" Load UltiSnips snippets from custom-snippets -let g:UltiSnipsSnippetDirectories=["custom-snippets", "UltiSnips"] - -" Find files using fzf by ,f -nnoremap f :Files - diff --git a/server/init.lua b/server/init.lua index 1d71c09..1a4adb8 100644 --- a/server/init.lua +++ b/server/init.lua @@ -1,13 +1,39 @@ --- Load old vimrc first -local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim" -vim.cmd.source(vimrc) +local set = vim.opt + +-- Turn on numbers +set.number = true +-- Turn off line wrapping +set.wrap = false +-- Disable cmdline from bottom +set.cmdheight = 0 +-- Ignore case while searching except when the search term contains capital letters +set.ignorecase = true +set.smartcase = true +-- Use 4 spaces and properly adjust them for files using TAB +set.tabstop = 4 +set.shiftwidth = 4 +set.softtabstop = 4 +set.expandtab = true +-- Show LSP signs in the number column +set.signcolumn = 'number' +-- Turn on spell checking +set.spell = true +-- Enable mouse support +set.mouse = 'n' +-- Enable programming dictionary +set.spelllang = { "en", "programming" } +-- Use ctrl-[hjkl] to select the active split + +-- Disable unused plugins +vim.g.loaded_perl_provider = 0 +vim.g.loaded_node_provider = 0 +vim.g.loaded_ruby_provider = 0 + +-- Load keymaps +local keymaps = vim.fn.stdpath("config") .. "/keymaps.vim" +vim.cmd.source(keymaps) -- Load plugins using paq-nvim local paq = vim.fn.stdpath("config") .. "/paq.lua" vim.cmd.source(paq) --- Default settings for comment plugin -require('Comment').setup() - --- Default settings for autopairs plugin -require('nvim-autopairs').setup() diff --git a/server/keymaps.vim b/server/keymaps.vim new file mode 100644 index 0000000..d5db0f3 --- /dev/null +++ b/server/keymaps.vim @@ -0,0 +1,17 @@ +" Change the leader to a comma +let mapleader = "," +let g:mapleader = "," + +" Use ,dd for deleting without putting into buffer +nnoremap d "_d +nnoremap D "_D +nnoremap x "_x +vnoremap d "_d + +" Insert a newline in normal mode by ,o +nnoremap o ok +nnoremap O Oj + +" Use ,u for redo +nnoremap u + diff --git a/server/paq.lua b/server/paq.lua index 5e8e964..c8cce1f 100644 --- a/server/paq.lua +++ b/server/paq.lua @@ -33,14 +33,6 @@ bootstrap_paq { "lambdalisue/suda.vim", -- Auto toggle for number mode when vim isn't focused "sitiom/nvim-numbertoggle", - -- LSP related plugins - "neovim/nvim-lspconfig", - "nvim-lua/plenary.nvim", - "hrsh7th/nvim-cmp", -- For LSP completion - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", -- Support programming terms { "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' }, -- vim-moonfly theme @@ -51,5 +43,6 @@ bootstrap_paq { "isobit/vim-caddyfile", -- Syntax highlighting for Fish scripts "khaveesh/vim-fish-syntax", + "kylechui/nvim-surround", } diff --git a/server/plugin/misc.lua b/server/plugin/misc.lua new file mode 100644 index 0000000..eb0a1cf --- /dev/null +++ b/server/plugin/misc.lua @@ -0,0 +1,11 @@ +-- This file lists all the plugins that need to be initiated to default setup + +-- Default settings for comment plugin +require("Comment").setup() + +-- Default settings for autopairs plugin +require("nvim-autopairs").setup() + +-- Default settings for nvim-surround +require("nvim-surround").setup() + diff --git a/server/vimrc.vim b/server/vimrc.vim deleted file mode 100644 index 5addd91..0000000 --- a/server/vimrc.vim +++ /dev/null @@ -1,75 +0,0 @@ -" Disable netrw for nvim-tree to work -let loaded_netrw = 1 -let loaded_netrwPlugin = 1 - -" Turn on numbers -set number - -" Turn off line wrapping -set nowrap - -" Turn on syntax highlighting -syntax on -filetype plugin indent on - -" Disable cmdline from bottom -set cmdheight=0 - -" Display as much of a line as possible instead of just showing @ -set display+=lastline - -" Ignore case while searching except when the search term contains capital -" letters -set ignorecase -set smartcase - -" Use 4 spaces for tabs and properly adjust them for files using TAB -set tabstop=4 -set shiftwidth=4 -set expandtab - -" Needed for group colors to work in nvim-tree -set termguicolors - -" Show LSP signs in the number column -set signcolumn=number - -" Turn on spell checking -set spell - -" Enable mouse support -set mouse=n - -" Enable automatic format on save, text change in normal mode and leaving -" insert mode -autocmd BufWritePre,TextChanged,InsertLeave lua vim.lsp.buf.format() - -" Set K to hover -command -nargs=+ LspHover lua vim.lsp.buf.hover() -set keywordprg=:LspHover - -" Enable programming dictionary -set spelllang=en,programming - -" Disable unused plugins -let g:loaded_perl_provider=0 -let g:loaded_node_provider=0 -let g:loaded_ruby_provider=0 - -" Change the leader to a comma -let mapleader = "," -let g:mapleader = "," - -" Use ,dd for deleting without putting into buffer -nnoremap d "_d -nnoremap D "_D -nnoremap x "_x -vnoremap d "_d - -" Insert a newline in normal mode by ,o -nnoremap o ok -nnoremap O Oj - -" Use ,u for redo -nnoremap u - diff --git a/vps/init.lua b/vps/init.lua index 1d71c09..b7582de 100644 --- a/vps/init.lua +++ b/vps/init.lua @@ -1,13 +1,38 @@ --- Load old vimrc first -local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim" -vim.cmd.source(vimrc) +local set = vim.opt + +-- Turn on numbers +set.number = true +-- Turn off line wrapping +set.wrap = false +-- Disable cmdline from bottom +set.cmdheight = 0 +-- Ignore case while searching except when the search term contains capital letters +set.ignorecase = true +set.smartcase = true +-- Use 4 spaces and properly adjust them for files using TAB +set.tabstop = 4 +set.shiftwidth = 4 +set.softtabstop = 4 +set.expandtab = true +-- Show LSP signs in the number column +set.signcolumn = 'number' +-- Turn on spell checking +set.spell = true +-- Enable mouse support +set.mouse = 'n' +-- Enable programming dictionary +set.spelllang = { "en", "programming" } + +-- Disable unused plugins +vim.g.loaded_perl_provider = 0 +vim.g.loaded_node_provider = 0 +vim.g.loaded_ruby_provider = 0 + +-- Load keymaps +local keymaps = vim.fn.stdpath("config") .. "/keymaps.vim" +vim.cmd.source(keymaps) -- Load plugins using paq-nvim local paq = vim.fn.stdpath("config") .. "/paq.lua" vim.cmd.source(paq) --- Default settings for comment plugin -require('Comment').setup() - --- Default settings for autopairs plugin -require('nvim-autopairs').setup() diff --git a/vps/keymaps.vim b/vps/keymaps.vim new file mode 100644 index 0000000..d5db0f3 --- /dev/null +++ b/vps/keymaps.vim @@ -0,0 +1,17 @@ +" Change the leader to a comma +let mapleader = "," +let g:mapleader = "," + +" Use ,dd for deleting without putting into buffer +nnoremap d "_d +nnoremap D "_D +nnoremap x "_x +vnoremap d "_d + +" Insert a newline in normal mode by ,o +nnoremap o ok +nnoremap O Oj + +" Use ,u for redo +nnoremap u + diff --git a/vps/paq.lua b/vps/paq.lua index aed3482..2b58a05 100644 --- a/vps/paq.lua +++ b/vps/paq.lua @@ -56,5 +56,6 @@ bootstrap_paq { "isobit/vim-caddyfile", -- Syntax highlighting for Fish scripts "khaveesh/vim-fish-syntax", + "kylechui/nvim-surround", } diff --git a/vps/plugin/misc.lua b/vps/plugin/misc.lua new file mode 100644 index 0000000..eb0a1cf --- /dev/null +++ b/vps/plugin/misc.lua @@ -0,0 +1,11 @@ +-- This file lists all the plugins that need to be initiated to default setup + +-- Default settings for comment plugin +require("Comment").setup() + +-- Default settings for autopairs plugin +require("nvim-autopairs").setup() + +-- Default settings for nvim-surround +require("nvim-surround").setup() + diff --git a/vps/vimrc.vim b/vps/vimrc.vim deleted file mode 100644 index 5addd91..0000000 --- a/vps/vimrc.vim +++ /dev/null @@ -1,75 +0,0 @@ -" Disable netrw for nvim-tree to work -let loaded_netrw = 1 -let loaded_netrwPlugin = 1 - -" Turn on numbers -set number - -" Turn off line wrapping -set nowrap - -" Turn on syntax highlighting -syntax on -filetype plugin indent on - -" Disable cmdline from bottom -set cmdheight=0 - -" Display as much of a line as possible instead of just showing @ -set display+=lastline - -" Ignore case while searching except when the search term contains capital -" letters -set ignorecase -set smartcase - -" Use 4 spaces for tabs and properly adjust them for files using TAB -set tabstop=4 -set shiftwidth=4 -set expandtab - -" Needed for group colors to work in nvim-tree -set termguicolors - -" Show LSP signs in the number column -set signcolumn=number - -" Turn on spell checking -set spell - -" Enable mouse support -set mouse=n - -" Enable automatic format on save, text change in normal mode and leaving -" insert mode -autocmd BufWritePre,TextChanged,InsertLeave lua vim.lsp.buf.format() - -" Set K to hover -command -nargs=+ LspHover lua vim.lsp.buf.hover() -set keywordprg=:LspHover - -" Enable programming dictionary -set spelllang=en,programming - -" Disable unused plugins -let g:loaded_perl_provider=0 -let g:loaded_node_provider=0 -let g:loaded_ruby_provider=0 - -" Change the leader to a comma -let mapleader = "," -let g:mapleader = "," - -" Use ,dd for deleting without putting into buffer -nnoremap d "_d -nnoremap D "_D -nnoremap x "_x -vnoremap d "_d - -" Insert a newline in normal mode by ,o -nnoremap o ok -nnoremap O Oj - -" Use ,u for redo -nnoremap u -