commit abebffc0e7ea47fef43df172315a8a5ca93b8e77
parent 94746fea92ecc223cc013bee91a090ebc71b1ae6
Author: Ryan Jeffrey <ryan@ryanmj.xyz>
Date: Sat, 13 Aug 2022 19:26:17 -0700
Neovim backup config
Diffstat:
3 files changed, 175 insertions(+), 1 deletion(-)
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
@@ -0,0 +1,117 @@
+require('plugins')
+
+local g = vim.g
+local o = vim.o
+local A = vim.api
+
+-- Editor options.
+-- Do not save when switching buffers
+-- o.hidden = true
+
+-- Decrease update time
+o.timeoutlen = 500
+o.updatetime = 200
+
+-- Number of screen lines to keep above and below the cursor
+o.scrolloff = 8
+o.number = true
+
+-- Line numbers.
+o.relativenumber = true
+o.cursorline = true
+o.signcolumn = 'yes'
+
+-- Better editing experience
+o.expandtab = true
+-- o.smarttab = true
+o.cindent = true
+-- o.autoindent = true
+o.wrap = true
+o.textwidth = 300
+o.tabstop = 4
+o.shiftwidth = 0
+o.softtabstop = -1 -- If negative, shiftwidth value is used
+
+-- Undo and backup options
+o.backup = false
+o.writebackup = false
+o.undofile = true
+o.swapfile = false
+
+-- Remember 69 items in commandline history
+o.history = 69
+
+-- Better buffer splitting
+o.splitright = true
+o.splitbelow = true
+
+-- Grahics options.
+o.termguicolors = true
+
+-- Better whitespace.
+g.strip_whitespace_on_save=1
+
+--local ok, _ = pcall(vim.cmd, 'colorscheme sakura')
+
+-- LSP
+
+lsp = require 'lspconfig'
+
+-- Mappings.
+-- See `:help vim.diagnostic.*` for documentation on any of the below functions
+local opts = { noremap=true, silent=true }
+vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
+vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
+vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
+vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
+
+-- Use an on_attach function to only map the following keys
+-- after the language server attaches to the current buffer
+local on_attach = function(client, bufnr)
+ -- Enable completion triggered by <c-x><c-o>
+ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
+
+ -- Mappings.
+ -- See `:help vim.lsp.*` for documentation on any of the below functions
+ local bufopts = { noremap=true, silent=true, buffer=bufnr }
+ vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
+ vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
+ vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
+ vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
+ vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
+ vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
+ vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
+ vim.keymap.set('n', '<space>wl', function()
+ print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+ end, bufopts)
+ vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
+ vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
+ vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
+ vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
+ vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
+end
+
+local lsp_flags = {
+ -- This is the default in Nvim 0.7+
+ debounce_text_changes = 150,
+}
+lsp['pyright'].setup{
+ on_attach = on_attach,
+ flags = lsp_flags,
+}
+lsp['tsserver'].setup{
+ on_attach = on_attach,
+ flags = lsp_flags,
+}
+lsp['rust_analyzer'].setup{
+ on_attach = on_attach,
+ flags = lsp_flags,
+ -- Server-specific settings...
+ settings = {
+ ["rust-analyzer"] = {}
+ }
+}
+lsp.clangd.setup{
+ on_attach = on_attach,
+ flags = lsp_flags,
+}
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
@@ -0,0 +1,57 @@
+
+-- Only required if you have packer configured as `opt`
+vim.cmd [[packadd packer.nvim]]
+
+return require('packer').startup(function(use)
+ use 'wbthomason/packer.nvim' -- The package manager.
+
+ use {'dracula/vim', as = 'dracula'} -- Dracula theme
+
+ use {
+ -- Sakura theme.
+ 'numToStr/Sakura.nvim',
+ config = function()
+ require('Sakura').load()
+ end,
+ }
+
+ use({
+ {
+ -- Lualine modeline plugin.
+ 'nvim-lualine/lualine.nvim',
+ after = 'Sakura.nvim',
+ event = 'BufEnter',
+ config = function()
+ require('numToStr.plugins.lualine')
+ end,
+ },
+ {
+ -- Lualine stuff.
+ 'j-hui/fidget.nvim',
+ after = 'lualine.nvim',
+ config = function()
+ require('fidget').setup()
+ end,
+ },
+ })
+
+ use 'neovim/nvim-lspconfig' -- Configurations for Nvim LSP
+
+
+ use 'https://github.com/tpope/vim-commentary' -- use gcc & gc to comment and uncomment code.
+
+ --use 'vim-airline/vim-airline' -- Arline plugin
+
+ use 'Raimondi/delimitMate' -- Delim matching.
+
+ use 'https://github.com/ryanoasis/vim-devicons' -- Developer icons.
+
+ use 'https://github.com/vim-python/python-syntax' -- Better python mode than nvim's default.
+
+ use 'https://github.com/Yggdroot/indentLine' -- Better python mode than nvim's default.
+
+ use 'https://github.com/terryma/vim-multiple-cursors' -- Ctrl+N for multiple cursors
+
+ use 'ntpeters/vim-better-whitespace' -- Show trailing whitespace.
+end)
+
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
@@ -142,7 +142,7 @@ alias srz='source ~/.config/zsh/.zshrc'
alias jrc='joe $MY_CONF_DIR/joestar/joestarrc'
if type "nvim" &>/dev/null; then
alias vim='nvim'
- alias cfv="nvim $MY_CONF_DIR/nvim/init.vim"
+ alias cfv="nvim $MY_CONF_DIR/nvim/init.lua"
else
alias cfv="vim $HOME/.vimrc"
fi