From e86a5583cdd48e028206c3c40dd4f0d508446c9d Mon Sep 17 00:00:00 2001 From: hoellen Date: Tue, 8 Aug 2023 17:17:21 +0200 Subject: [PATCH] Add Neovim config --- .config/nvim/init.vim | 47 +++++++++++++++++++++++++++++++++++++ .config/nvim/lua/config.lua | 19 +++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .config/nvim/init.vim create mode 100644 .config/nvim/lua/config.lua diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..4dcf372 --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,47 @@ +" Load lua config +lua require('config') + +" General editor config +set number +set scrolloff=3 +set sidescroll=3 +set tabstop=4 +set shiftwidth=4 +set nowrap +set ignorecase +set smartcase +set smartindent +set mouse=a +set showmatch +set undofile +set shortmess=I "disable intro message + +" Key mapping +let mapleader = "\" +nnoremap \\ :noh " Clear higlighting + +set listchars=tab:▸\ ,eol:↵,space:. +nnoremap l :set list! + +" enable copy to clipboard +map y "+y +map p "*p + +" Align block of text and keep them selected +vmap < >gv + +" jk is escape +inoremap jk + +" Jump to the last position when reopening a file +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + +" Trim Whitespaces +fun! TrimWhitespace() + let l:save = winsaveview() + keeppatterns %s/\s\+$//e + call winrestview(l:save) +endfun +command! TrimWhitespace call TrimWhitespace() + diff --git a/.config/nvim/lua/config.lua b/.config/nvim/lua/config.lua new file mode 100644 index 0000000..b95ae9b --- /dev/null +++ b/.config/nvim/lua/config.lua @@ -0,0 +1,19 @@ +-- lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Plugins +require("lazy").setup({ + --"lukas-reineke/indent-blankline.nvim", --Indent guides for Neovim +}) +