From e3970f64a516957c5c59ed326dc6316919d73f12 Mon Sep 17 00:00:00 2001 From: zachir Date: Wed, 23 Aug 2023 02:02:19 -0500 Subject: Better nvim mapping formatting --- nvim/init.vim | 65 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 6df2934..080625e 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -200,6 +200,8 @@ augroup end " }}} " keybindings {{{ +" direction keys + inoremap gj inoremap gk inoremap g @@ -208,35 +210,38 @@ vnoremap gj vnoremap gk vnoremap g vnoremap g -noremap gj -noremap gk +nnoremap gj +nnoremap gk + +" clear search highlights +nnoremap / :noh " toggles -noremap tn :set number! -noremap tr :set relativenumber! -noremap tt :NERDTreeToggle +nnoremap tn :set number! +nnoremap tr :set relativenumber! +nnoremap tt :NERDTreeToggle " tabs -noremap th :tabprevious -noremap tl :tabnext -noremap tk :tabnew -noremap tj :tabclose +nnoremap th :tabprevious +nnoremap tl :tabnext +nnoremap tk :tabnew +nnoremap tj :tabclose " splits -noremap wh :vertical resize -1 -noremap wj :resize -1 -noremap wk :resize +1 -noremap wl :vertical resize +1 +nnoremap wh :vertical resize -1 +nnoremap wj :resize -1 +nnoremap wk :resize +1 +nnoremap wl :vertical resize +1 " config -noremap en :e ~/.config/nvim/init.vim -noremap ec :source % +nnoremap en :e ~/.config/nvim/init.vim +nnoremap ec :source % " write as root -noremap ZW :w !pkexec tee % >/dev/null +nnoremap ZW :w !pkexec tee % >/dev/null " Goyo -noremap G :Goyo +nnoremap G :Goyo " windows nnoremap h @@ -250,26 +255,26 @@ vnoremap l " files " these may go away soon -noremap xx :q -noremap x! :q! +nnoremap xx :q +nnoremap x! :q! " these are the new standard -noremap qq :q -noremap q! :q! -noremap wq :wq -noremap ww :w -noremap ee :e +nnoremap qq :q +nnoremap q! :q! +nnoremap wq :wq +nnoremap ww :w +nnoremap ee :e " escape for term windows tnoremap " vim-plug -noremap pi :PlugInstall -noremap pu :PlugUpdate -noremap pU :PlugUpgrade -noremap pc :PlugClean +nnoremap pi :PlugInstall +nnoremap pu :PlugUpdate +nnoremap pU :PlugUpgrade +nnoremap pc :PlugClean " fugitive -noremap gp :G pull -noremap gd :G diff % +nnoremap gp :G pull +nnoremap gd :G diff % " }}} -- cgit v1.2.3 From fd993bf7c55beea099b2a146be102137b94593fe Mon Sep 17 00:00:00 2001 From: zachir Date: Thu, 19 Oct 2023 11:31:29 -0500 Subject: Big nvim config changes Use tabs instead of spaces by default, change the colorscheme to SlateDark, and set indent spacing to 4. Also, don't auto preview or auto :make LaTeX documents. --- nvim/init.vim | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 080625e..9b952d3 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -42,31 +42,30 @@ set showmatch " Highlight matching brace set number set relativenumber -colorscheme BlackSea +"colorscheme CandyPaper +colorscheme SlateDark -set hlsearch " Highlight all search results -set smartcase " Enable smart-case search -set incsearch " Searches for strings incrementally +set hlsearch " Highlight all search results +set smartcase " Enable smart-case search +set incsearch " Searches for strings incrementally -set expandtab " Use spaces instead of tabs -set shiftwidth=2 " Number of auto-indent spaces -set smartindent " Enable smart-indent -set smarttab " Enable smart-tabs -set softtabstop=2 " Number of spaces per Tab +set noexpandtab " Use spaces instead of tabs +set shiftwidth=4 " Number of auto-indent spaces +set smartindent " Enable smart-indent +set nosmarttab " Enable smart-tabs +"set softtabstop=2 " Number of spaces per Tab +set tabstop=4 + "" Advanced -set ruler " Show row and column ruler information -set undolevels=1000 " Number of undo levels +set ruler " Show row and column ruler information +set undolevels=1000 " Number of undo levels set backspace=indent,eol,start " Backspace behaviour filetype plugin indent on "" GUI Config set guifont=mononoki\ Nerd\ Font\ Mono:h12 -hi Normal guibg=NONE ctermbg=NONE -hi NonText guibg=NONE ctermbg=NONE -set background=dark - set foldmethod=marker set conceallevel=2 @@ -187,11 +186,17 @@ autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif " custom augroup {{{ augroup custom autocmd! - au BufEnter *.tex :LLPStartPreview + " au BufEnter *.tex :LLPStartPreview au BufEnter *.md :set textwidth=80 au BufEnter *.ms :set textwidth=80 + " au BufEnter *.c :colo DevC++ + " au BufEnter *.h :colo DevC++ + " au BufEnter *.cc :colo DevC++ + " au BufEnter *.hh :colo DevC++ + " au BufEnter *.cpp :colo DevC++ + " au BufEnter *.hpp :colo DevC++ au BufWritePost init.vim :source % - au BufWritePost *.tex :make + " au BufWritePost *.tex :make au BufWritePost *sxhkdrc* :!pkill -USR1 -x sxhkd au BufWritePost .Xresources :!xrdb ~/.Xresources au BufWritePost .gitignore :!git add .gitignore -- cgit v1.2.3 From 8b2425c9cdb2451bdae282654ea368c2655d9bb9 Mon Sep 17 00:00:00 2001 From: zachir Date: Tue, 7 Nov 2023 09:09:54 -0600 Subject: Use preglow for nvim (my old colorscheme) I'm switching the color scheme for neovim to my old one, preglow (which I forked from the afterglow color scheme). It's purely subjective, but I do like it and intend to stick with it for a while. --- nvim/init.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 9b952d3..59332e9 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -3,6 +3,7 @@ call plug#begin('~/.config/nvim/plugged') " colorschemes {{{ Plug 'tomasiser/vim-code-dark' " codedark color scheme Plug 'flazz/vim-colorschemes' " meta-color scheme package +Plug 'ZachIndigo/vim-preglow' " my old color scheme " }}} " language support {{{ Plug 'axvr/org.vim' " basic org markup language implementation @@ -43,7 +44,8 @@ set number set relativenumber "colorscheme CandyPaper -colorscheme SlateDark +"colorscheme SlateDark +colorscheme preglow set hlsearch " Highlight all search results set smartcase " Enable smart-case search -- cgit v1.2.3 From 4f070005de1e8de35a66fe4679a478b6c4001a2e Mon Sep 17 00:00:00 2001 From: zachir Date: Thu, 8 Feb 2024 21:51:15 -0600 Subject: nvim: Expand tabs to spaces We're switching back to the objectively correct method of using spaces instead of tabs. --- nvim/init.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 59332e9..1f877ed 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -51,12 +51,12 @@ set hlsearch " Highlight all search results set smartcase " Enable smart-case search set incsearch " Searches for strings incrementally -set noexpandtab " Use spaces instead of tabs -set shiftwidth=4 " Number of auto-indent spaces -set smartindent " Enable smart-indent -set nosmarttab " Enable smart-tabs -"set softtabstop=2 " Number of spaces per Tab -set tabstop=4 +set autoindent " Enable auto-indent +"set smartindent " Enable smart-indent +"set nosmarttab " Enable smart-tabs +set expandtab " Use spaces instead of tabs +set tabstop=2 " Number of spaces per tab +set shiftwidth=2 " Number of auto-indent spaces "" Advanced -- cgit v1.2.3 From 1802af2caf8f26820a8c0dfa3149fbfe82afe4c3 Mon Sep 17 00:00:00 2001 From: zachir Date: Thu, 8 Feb 2024 21:52:00 -0600 Subject: nvim: reorganize init.vim to have better comment alignment This is purely for my OCD. --- nvim/init.vim | 60 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 1f877ed..211452e 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,34 +1,34 @@ " vimplugs {{{ call plug#begin('~/.config/nvim/plugged') " colorschemes {{{ -Plug 'tomasiser/vim-code-dark' " codedark color scheme -Plug 'flazz/vim-colorschemes' " meta-color scheme package -Plug 'ZachIndigo/vim-preglow' " my old color scheme +Plug 'tomasiser/vim-code-dark' " codedark color scheme +Plug 'flazz/vim-colorschemes' " meta-color scheme package +Plug 'ZachIndigo/vim-preglow' " my old color scheme " }}} " language support {{{ -Plug 'axvr/org.vim' " basic org markup language implementation -Plug 'ziglang/zig.vim' " zig programming language -Plug 'jdonaldson/vaxe' " haxe programming language +Plug 'axvr/org.vim' " basic org markup language implementation +Plug 'ziglang/zig.vim' " zig programming language +Plug 'jdonaldson/vaxe' " haxe programming language Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } " latex live preview support -Plug 'waycrate/swhkd-vim' " swhkd syntax highlighting -Plug 'HiPhish/guile.vim' " guile syntax highlighting +Plug 'waycrate/swhkd-vim' " swhkd syntax highlighting +Plug 'HiPhish/guile.vim' " guile syntax highlighting " }}} " utility {{{ -Plug 'preservim/nerdtree' " directory tree interface -Plug 'Xuyuanp/nerdtree-git-plugin' " git status indicator for nerdtree -Plug 'PhilRunninger/nerdtree-visual-selection' " allows visual selection mode in nerdtree -Plug 'tpope/vim-fugitive' " git command interface -Plug 'junegunn/goyo.vim' " simplify the user interface (distraction-free) [BROKEN] -Plug 'junegunn/limelight.vim' " focus on single paragraph of text at a time -Plug 'vim-airline/vim-airline' " powerline the vim bottom bar -Plug 'nathanaelkane/vim-indent-guides' " indent guides for vim -Plug 'mhinz/vim-signify' " use signs to show diffs -Plug 'tpope/vim-endwise' " auto end functions/if statements -Plug 'tpope/vim-surround' " auto close stuff -Plug 'mattn/emmet-vim' " html css easy formating -Plug 'godlygeek/tabular' " Needed for vim-markdown -Plug 'plasticboy/vim-markdown' " Better markdown support -Plug 'ryanoasis/vim-devicons' " dev icons for nerdtree +Plug 'preservim/nerdtree' " directory tree interface +Plug 'Xuyuanp/nerdtree-git-plugin' " git status indicator for nerdtree +Plug 'PhilRunninger/nerdtree-visual-selection' " allows visual selection mode in nerdtree +Plug 'tpope/vim-fugitive' " git command interface +Plug 'junegunn/goyo.vim' " simplify the user interface (distraction-free) [BROKEN] +Plug 'junegunn/limelight.vim' " focus on single paragraph of text at a time +Plug 'vim-airline/vim-airline' " powerline the vim bottom bar +Plug 'nathanaelkane/vim-indent-guides' " indent guides for vim +Plug 'mhinz/vim-signify' " use signs to show diffs +Plug 'tpope/vim-endwise' " auto end functions/if statements +Plug 'tpope/vim-surround' " auto close stuff +Plug 'mattn/emmet-vim' " html css easy formating +Plug 'godlygeek/tabular' " Needed for vim-markdown +Plug 'plasticboy/vim-markdown' " Better markdown support +Plug 'ryanoasis/vim-devicons' " dev icons for nerdtree " }}} call plug#end() @@ -38,7 +38,7 @@ call plug#end() "" nvimrc: "" General -set showmatch " Highlight matching brace +set showmatch " Highlight matching brace set number set relativenumber @@ -47,9 +47,9 @@ set relativenumber "colorscheme SlateDark colorscheme preglow -set hlsearch " Highlight all search results -set smartcase " Enable smart-case search -set incsearch " Searches for strings incrementally +set hlsearch " Highlight all search results +set smartcase " Enable smart-case search +set incsearch " Searches for strings incrementally set autoindent " Enable auto-indent "set smartindent " Enable smart-indent @@ -60,9 +60,9 @@ set shiftwidth=2 " Number of auto-indent spaces "" Advanced -set ruler " Show row and column ruler information -set undolevels=1000 " Number of undo levels -set backspace=indent,eol,start " Backspace behaviour +set ruler " Show row and column ruler information +set undolevels=1000 " Number of undo levels +set backspace=indent,eol,start " Backspace behaviour filetype plugin indent on "" GUI Config -- cgit v1.2.3 From 5bb5ef9ec51f4efced3a06cafcf420aa805a5066 Mon Sep 17 00:00:00 2001 From: zachir Date: Thu, 8 Feb 2024 21:52:42 -0600 Subject: nvim: enable live preview for .tex This re-enables the live preview plugin for .tex files. --- nvim/init.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 211452e..cac706f 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -188,7 +188,7 @@ autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif " custom augroup {{{ augroup custom autocmd! - " au BufEnter *.tex :LLPStartPreview + au BufEnter *.tex :LLPStartPreview au BufEnter *.md :set textwidth=80 au BufEnter *.ms :set textwidth=80 " au BufEnter *.c :colo DevC++ -- cgit v1.2.3 From c28620857a470ba43b93207c4c339dce43c1df83 Mon Sep 17 00:00:00 2001 From: zachir Date: Thu, 8 Feb 2024 21:53:11 -0600 Subject: nvim: Use DevC++ colo for c/c++ files This uses a colorscheme specifically for c/c++ files when editing c/c++ files. --- nvim/init.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index cac706f..a28cfc3 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -191,12 +191,12 @@ augroup custom au BufEnter *.tex :LLPStartPreview au BufEnter *.md :set textwidth=80 au BufEnter *.ms :set textwidth=80 - " au BufEnter *.c :colo DevC++ - " au BufEnter *.h :colo DevC++ - " au BufEnter *.cc :colo DevC++ - " au BufEnter *.hh :colo DevC++ - " au BufEnter *.cpp :colo DevC++ - " au BufEnter *.hpp :colo DevC++ + au BufEnter *.c :colo DevC++ + au BufEnter *.h :colo DevC++ + au BufEnter *.cc :colo DevC++ + au BufEnter *.hh :colo DevC++ + au BufEnter *.cpp :colo DevC++ + au BufEnter *.hpp :colo DevC++ au BufWritePost init.vim :source % " au BufWritePost *.tex :make au BufWritePost *sxhkdrc* :!pkill -USR1 -x sxhkd -- cgit v1.2.3 From 1747bb03f303ce3bd4b61b373f05af836ff0ecbc Mon Sep 17 00:00:00 2001 From: zachir Date: Sat, 23 Mar 2024 18:08:59 -0500 Subject: Set nvim colo and remove C++ auto colo --- nvim/init.vim | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index a28cfc3..8c0d378 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -43,9 +43,7 @@ set showmatch " Highlight matching brace set number set relativenumber -"colorscheme CandyPaper -"colorscheme SlateDark -colorscheme preglow +colorscheme 256-grayvim set hlsearch " Highlight all search results set smartcase " Enable smart-case search @@ -191,12 +189,12 @@ augroup custom au BufEnter *.tex :LLPStartPreview au BufEnter *.md :set textwidth=80 au BufEnter *.ms :set textwidth=80 - au BufEnter *.c :colo DevC++ - au BufEnter *.h :colo DevC++ - au BufEnter *.cc :colo DevC++ - au BufEnter *.hh :colo DevC++ - au BufEnter *.cpp :colo DevC++ - au BufEnter *.hpp :colo DevC++ + "au BufEnter *.c :colo DevC++ + "au BufEnter *.h :colo DevC++ + "au BufEnter *.cc :colo DevC++ + "au BufEnter *.hh :colo DevC++ + "au BufEnter *.cpp :colo DevC++ + "au BufEnter *.hpp :colo DevC++ au BufWritePost init.vim :source % " au BufWritePost *.tex :make au BufWritePost *sxhkdrc* :!pkill -USR1 -x sxhkd -- cgit v1.2.3 From fa42672400b9b668a77b649843456af310fc21d3 Mon Sep 17 00:00:00 2001 From: zachir Date: Tue, 4 Jun 2024 23:21:10 -0500 Subject: Add nvim colo's and commented bg options Adding in tomasiser/vim-code-dark and flazz/vim-colorschemes to provide more color options. Also have options (commented out) to make the background transparent should that be desired later. --- nvim/init.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 8c0d378..97b8a40 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -3,6 +3,8 @@ call plug#begin('~/.config/nvim/plugged') " colorschemes {{{ Plug 'tomasiser/vim-code-dark' " codedark color scheme Plug 'flazz/vim-colorschemes' " meta-color scheme package +Plug 'tomasiser/vim-code-dark' " codedark color scheme +Plug 'flazz/vim-colorschemes' " meta-color scheme package Plug 'ZachIndigo/vim-preglow' " my old color scheme " }}} " language support {{{ @@ -66,6 +68,10 @@ filetype plugin indent on "" GUI Config set guifont=mononoki\ Nerd\ Font\ Mono:h12 +"hi Normal guibg=NONE ctermbg=NONE +"hi NonText guibg=NONE ctermbg=NONE +"set background=dark + set foldmethod=marker set conceallevel=2 -- cgit v1.2.3 From 5578f1ca7eb8fcbe449c1fad1ea9a99a3a8c5938 Mon Sep 17 00:00:00 2001 From: zachir Date: Tue, 4 Jun 2024 23:24:28 -0500 Subject: Use nvim smarttab and smartindent This gets all of the indenting and such sorted to be "smart". --- nvim/init.vim | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 97b8a40..3453b71 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -51,13 +51,11 @@ set hlsearch " Highlight all search results set smartcase " Enable smart-case search set incsearch " Searches for strings incrementally -set autoindent " Enable auto-indent -"set smartindent " Enable smart-indent -"set nosmarttab " Enable smart-tabs set expandtab " Use spaces instead of tabs -set tabstop=2 " Number of spaces per tab set shiftwidth=2 " Number of auto-indent spaces - +set smartindent " Enable smart-indent +set smarttab " Enable smart-tabs +set softtabstop=2 " Number of spaces per Tab "" Advanced set ruler " Show row and column ruler information -- cgit v1.2.3 From 4d89bb814c92989db464727934b8863bedd4b2c9 Mon Sep 17 00:00:00 2001 From: zachir Date: Tue, 4 Jun 2024 23:25:44 -0500 Subject: Run :make when writing latex file My latex projects use Makefiles to compile them; this makes that process automatic. --- nvim/init.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 3453b71..42fe34d 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -200,7 +200,7 @@ augroup custom "au BufEnter *.cpp :colo DevC++ "au BufEnter *.hpp :colo DevC++ au BufWritePost init.vim :source % - " au BufWritePost *.tex :make + au BufWritePost *.tex :make au BufWritePost *sxhkdrc* :!pkill -USR1 -x sxhkd au BufWritePost .Xresources :!xrdb ~/.Xresources au BufWritePost .gitignore :!git add .gitignore -- cgit v1.2.3 From b3272c366969eae34b4737e88f83332dd49e3297 Mon Sep 17 00:00:00 2001 From: zachir Date: Mon, 20 Jan 2025 02:01:38 -0600 Subject: Comment out LLPreview in nvim It only works on Vim anyways. --- nvim/init.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index 42fe34d..d27d9d4 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -190,7 +190,7 @@ autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif " custom augroup {{{ augroup custom autocmd! - au BufEnter *.tex :LLPStartPreview + "au BufEnter *.tex :LLPStartPreview au BufEnter *.md :set textwidth=80 au BufEnter *.ms :set textwidth=80 "au BufEnter *.c :colo DevC++ @@ -200,7 +200,7 @@ augroup custom "au BufEnter *.cpp :colo DevC++ "au BufEnter *.hpp :colo DevC++ au BufWritePost init.vim :source % - au BufWritePost *.tex :make + "au BufWritePost *.tex :make au BufWritePost *sxhkdrc* :!pkill -USR1 -x sxhkd au BufWritePost .Xresources :!xrdb ~/.Xresources au BufWritePost .gitignore :!git add .gitignore -- cgit v1.2.3 From 021b916382f129d8e95a5070fbbf466a05c2582a Mon Sep 17 00:00:00 2001 From: zachir Date: Mon, 20 Jan 2025 16:19:53 -0600 Subject: Use the same config for both vim and nvim This was already taken care of in the config, I'm not sure why I didn't do this at the time. --- nvim/init.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index d27d9d4..cdf9b33 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,3 +1,20 @@ +set runtimepath^=$XDG_CONFIG_HOME/vim +set runtimepath+=$XDG_DATA_HOME/vim +set runtimepath+=$XDG_CONFIG_HOME/vim/after + +set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim +set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after + +let g:netrw_home = $XDG_DATA_HOME."/vim" +call mkdir($XDG_DATA_HOME."/vim/spell", 'p') + +set backupdir=$XDG_STATE_HOME/vim/backup | call mkdir(&backupdir, 'p') +set directory=$XDG_STATE_HOME/vim/swap | call mkdir(&directory, 'p') +set undodir=$XDG_STATE_HOME/vim/undo | call mkdir(&undodir, 'p') +set viewdir=$XDG_STATE_HOME/vim/view | call mkdir(&viewdir, 'p') + +if !has('nvim') | set viminfofile=$XDG_STATE_HOME/vim/viminfo | endif + " vimplugs {{{ call plug#begin('~/.config/nvim/plugged') " colorschemes {{{ -- cgit v1.2.3 From 8dd9c87d4d8c2f35f7ef26fe19d3330235abdfb7 Mon Sep 17 00:00:00 2001 From: zachir Date: Mon, 20 Jan 2025 16:20:22 -0600 Subject: Use the Dark2 vim theme instead of 256-grayvim --- nvim/init.vim | 2 +- vim/vimrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'nvim/init.vim') diff --git a/nvim/init.vim b/nvim/init.vim index cdf9b33..812bf3e 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -62,7 +62,7 @@ set showmatch " Highlight matching brace set number set relativenumber -colorscheme 256-grayvim +colorscheme Dark2 set hlsearch " Highlight all search results set smartcase " Enable smart-case search diff --git a/vim/vimrc b/vim/vimrc index cdf9b33..812bf3e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -62,7 +62,7 @@ set showmatch " Highlight matching brace set number set relativenumber -colorscheme 256-grayvim +colorscheme Dark2 set hlsearch " Highlight all search results set smartcase " Enable smart-case search -- cgit v1.2.3 From 12fb9ecc242867b03626d1c52e5e84799ab330c8 Mon Sep 17 00:00:00 2001 From: zachir Date: Thu, 17 Apr 2025 22:59:36 -0500 Subject: Redo nvim to use init.lua --- nvim/init.lua | 5 + nvim/init.vim | 306 ----------------------------------------------- nvim/lua/colorscheme.lua | 8 ++ nvim/lua/keymaps.lua | 97 +++++++++++++++ nvim/lua/options.lua | 32 +++++ nvim/lua/plugins.lua | 106 ++++++++++++++++ nvim/lua/term.lua | 51 ++++++++ sh/profile | 2 +- vim/vimrc | 4 +- 9 files changed, 302 insertions(+), 309 deletions(-) create mode 100644 nvim/init.lua delete mode 100644 nvim/init.vim create mode 100644 nvim/lua/colorscheme.lua create mode 100644 nvim/lua/keymaps.lua create mode 100644 nvim/lua/options.lua create mode 100644 nvim/lua/plugins.lua create mode 100644 nvim/lua/term.lua (limited to 'nvim/init.vim') diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..cf11420 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,5 @@ +require('options') +require('keymaps') +require('plugins') +require('colorscheme') +require('term') diff --git a/nvim/init.vim b/nvim/init.vim deleted file mode 100644 index 812bf3e..0000000 --- a/nvim/init.vim +++ /dev/null @@ -1,306 +0,0 @@ -set runtimepath^=$XDG_CONFIG_HOME/vim -set runtimepath+=$XDG_DATA_HOME/vim -set runtimepath+=$XDG_CONFIG_HOME/vim/after - -set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim -set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after - -let g:netrw_home = $XDG_DATA_HOME."/vim" -call mkdir($XDG_DATA_HOME."/vim/spell", 'p') - -set backupdir=$XDG_STATE_HOME/vim/backup | call mkdir(&backupdir, 'p') -set directory=$XDG_STATE_HOME/vim/swap | call mkdir(&directory, 'p') -set undodir=$XDG_STATE_HOME/vim/undo | call mkdir(&undodir, 'p') -set viewdir=$XDG_STATE_HOME/vim/view | call mkdir(&viewdir, 'p') - -if !has('nvim') | set viminfofile=$XDG_STATE_HOME/vim/viminfo | endif - -" vimplugs {{{ -call plug#begin('~/.config/nvim/plugged') -" colorschemes {{{ -Plug 'tomasiser/vim-code-dark' " codedark color scheme -Plug 'flazz/vim-colorschemes' " meta-color scheme package -Plug 'tomasiser/vim-code-dark' " codedark color scheme -Plug 'flazz/vim-colorschemes' " meta-color scheme package -Plug 'ZachIndigo/vim-preglow' " my old color scheme -" }}} -" language support {{{ -Plug 'axvr/org.vim' " basic org markup language implementation -Plug 'ziglang/zig.vim' " zig programming language -Plug 'jdonaldson/vaxe' " haxe programming language -Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } " latex live preview support -Plug 'waycrate/swhkd-vim' " swhkd syntax highlighting -Plug 'HiPhish/guile.vim' " guile syntax highlighting -" }}} -" utility {{{ -Plug 'preservim/nerdtree' " directory tree interface -Plug 'Xuyuanp/nerdtree-git-plugin' " git status indicator for nerdtree -Plug 'PhilRunninger/nerdtree-visual-selection' " allows visual selection mode in nerdtree -Plug 'tpope/vim-fugitive' " git command interface -Plug 'junegunn/goyo.vim' " simplify the user interface (distraction-free) [BROKEN] -Plug 'junegunn/limelight.vim' " focus on single paragraph of text at a time -Plug 'vim-airline/vim-airline' " powerline the vim bottom bar -Plug 'nathanaelkane/vim-indent-guides' " indent guides for vim -Plug 'mhinz/vim-signify' " use signs to show diffs -Plug 'tpope/vim-endwise' " auto end functions/if statements -Plug 'tpope/vim-surround' " auto close stuff -Plug 'mattn/emmet-vim' " html css easy formating -Plug 'godlygeek/tabular' " Needed for vim-markdown -Plug 'plasticboy/vim-markdown' " Better markdown support -Plug 'ryanoasis/vim-devicons' " dev icons for nerdtree -" }}} -call plug#end() - -" }}} -" nvim options {{{ - -"" nvimrc: -"" General - -set showmatch " Highlight matching brace - -set number -set relativenumber - -colorscheme Dark2 - -set hlsearch " Highlight all search results -set smartcase " Enable smart-case search -set incsearch " Searches for strings incrementally - -set expandtab " Use spaces instead of tabs -set shiftwidth=2 " Number of auto-indent spaces -set smartindent " Enable smart-indent -set smarttab " Enable smart-tabs -set softtabstop=2 " Number of spaces per Tab - -"" Advanced -set ruler " Show row and column ruler information -set undolevels=1000 " Number of undo levels -set backspace=indent,eol,start " Backspace behaviour -filetype plugin indent on - -"" GUI Config -set guifont=mononoki\ Nerd\ Font\ Mono:h12 - -"hi Normal guibg=NONE ctermbg=NONE -"hi NonText guibg=NONE ctermbg=NONE -"set background=dark - -set foldmethod=marker - -set conceallevel=2 - -" set leader key - -let mapleader="'" - -" emmet {{{ -let g:user_emmet_leader_key='' -" }}} - -" zig config {{{ -let g:zig_fmt_autosave = 1 -" }}} - -" latex live preview {{{ -let g:livepreview_previewer = 'zathura' -let g:livepreview_use_biber = 1 -let g:livepreview_cursorhold_recompile = 0 -" }}} - -" vim-markdown {{{ -let g:vim_markdown_folding_disabled = 1 -let g:vim_markdown_folding_level = 3 -let g:vim_markdown_toc_autofit = 1 -let g:vim_markdown_emphasis_multiline = 0 -let g:tex_conceal = "" -let g:vim_markdown_math = 1 -let g:vim_markdown_conceal_code_blocks = 1 -let g:vim_markdown_fenced_languages = ['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini'] -let g:vim_markdown_follow_anchor = 1 -let g:vim_markdown_math = 1 -let g:vim_markdown_frontmatter = 1 -let g:vim_markdown_toml_frontmatter = 1 -let g:vim_markdown_strikethrough = 1 -let g:vim_markdown_no_extensions_in_markdown = 1 -let g:vim_markdown_autowrite = 1 -let g:vim_markdown_auto_insert_bullets = 0 -let g:vim_markdown_new_list_item_indent = 0 -let g:vim_markdown_edit_url_in = 'tab' -" }}} - -" NERDTree config {{{ -let g:NERDTreeGitStatusUseNerdFonts = 1 " use nerd fonts -let g:NERDTreeGitStatusShowClean = 1 " default: 0 -let g:NERDTreeDirArrowExpandable = '>' -let g:NERDTreeDirArrowCollapsible = '<' -let g:NERDTreeMapToggleHidden = 'z' -" }}} - -" Goyo config {{{ -let g:goyo_width = '90%' -let g:goyo_height = '100%' -" }}} - -" limelight config {{{ -let g:limelight_conceal_ctermfg = 'gray' -let g:limelight_conceal_guifg = 'gray' -" }}} - -" devicon config {{{ -let g:airline_powerline_fonts = 1 -let g:webdevicons_enable_nerdtree = 1 -" }}} - -" vim-indent-guides config {{{ -let g:indent_guides_enable_on_vim_startup = 0 -" }}} - -" vim-signify config {{{ -set updatetime=100 -" }}} - -" }}} -" Functions {{{ -" Goyo functions {{{ -function! s:goyo_enter() - if executable('tmux') && strlen($TMUX) - silent !tmux set status off - silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z - endif - set noshowmode - set noshowcmd - set scrolloff=999 - Limelight - NERDTreeClose -endfunction -function! s:goyo_leave() - if executable('tmux') && strlen('$TMUX') - silent !tmux set status on - silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z - endif - set showmode - set showcmd - set scrolloff=5 - Limelight! - NERDTree -endfunction -" }}} -" }}} -" Autocommands {{{ -" Goyo autocommands {{{ -autocmd! User GoyoEnter nested call goyo_enter() -autocmd! User GoyoLeave nested call goyo_leave() -" }}} -" NERDTree autocmds {{{ -autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | wincmd p | endif -autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | - \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif -autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif -autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif -"autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | - "\ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer;.buf | endif -autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif -" }}} -" custom augroup {{{ -augroup custom - autocmd! - "au BufEnter *.tex :LLPStartPreview - au BufEnter *.md :set textwidth=80 - au BufEnter *.ms :set textwidth=80 - "au BufEnter *.c :colo DevC++ - "au BufEnter *.h :colo DevC++ - "au BufEnter *.cc :colo DevC++ - "au BufEnter *.hh :colo DevC++ - "au BufEnter *.cpp :colo DevC++ - "au BufEnter *.hpp :colo DevC++ - au BufWritePost init.vim :source % - "au BufWritePost *.tex :make - au BufWritePost *sxhkdrc* :!pkill -USR1 -x sxhkd - au BufWritePost .Xresources :!xrdb ~/.Xresources - au BufWritePost .gitignore :!git add .gitignore -augroup end -" }}} -" }}} -" keybindings {{{ - -" direction keys - -inoremap gj -inoremap gk -inoremap g -inoremap g -vnoremap gj -vnoremap gk -vnoremap g -vnoremap g -nnoremap gj -nnoremap gk - -" clear search highlights -nnoremap / :noh - -" toggles -nnoremap tn :set number! -nnoremap tr :set relativenumber! -nnoremap tt :NERDTreeToggle - -" tabs -nnoremap th :tabprevious -nnoremap tl :tabnext -nnoremap tk :tabnew -nnoremap tj :tabclose - -" splits -nnoremap wh :vertical resize -1 -nnoremap wj :resize -1 -nnoremap wk :resize +1 -nnoremap wl :vertical resize +1 - -" config -nnoremap en :e ~/.config/nvim/init.vim -nnoremap ec :source % - -" write as root -nnoremap ZW :w !pkexec tee % >/dev/null - -" Goyo -nnoremap G :Goyo - -" windows -nnoremap h -nnoremap j -nnoremap k -nnoremap l -vnoremap h -vnoremap j -vnoremap k -vnoremap l - -" files -" these may go away soon -nnoremap xx :q -nnoremap x! :q! -" these are the new standard -nnoremap qq :q -nnoremap q! :q! -nnoremap wq :wq -nnoremap ww :w -nnoremap ee :e - -" escape for term windows -tnoremap - -" vim-plug -nnoremap pi :PlugInstall -nnoremap pu :PlugUpdate -nnoremap pU :PlugUpgrade -nnoremap pc :PlugClean - -" fugitive -nnoremap gp :G pull -nnoremap gd :G diff % - -" }}} diff --git a/nvim/lua/colorscheme.lua b/nvim/lua/colorscheme.lua new file mode 100644 index 0000000..66516fa --- /dev/null +++ b/nvim/lua/colorscheme.lua @@ -0,0 +1,8 @@ +-- define your colorscheme here +local colorscheme = 'badwolf' + +local is_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) +if not is_ok then + vim.notify('colorscheme ' .. colorscheme .. ' not found!') + return +end diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua new file mode 100644 index 0000000..26037c6 --- /dev/null +++ b/nvim/lua/keymaps.lua @@ -0,0 +1,97 @@ +-- define common options +local opts = { + noremap = true, -- non-recursive + silent = true, -- do not show message +} + +-- set leader key +vim.g.mapleader = "'" + +----------------- +-- Normal mode -- +----------------- + +-- Hint: set `:h vim.map.set()` +-- Better window navigation +vim.keymap.set('n', '', 'h', opts) +vim.keymap.set('n', '', 'j', opts) +vim.keymap.set('n', '', 'k', opts) +vim.keymap.set('n', '', 'l', opts) + +-- Resize with arrows +vim.keymap.set('n', '', ':resize -2', opts) +vim.keymap.set('n', '', ':resize +2', opts) +vim.keymap.set('n', '', ':vertical resize -2', opts) +vim.keymap.set('n', '', ':vertical resize +2', opts) +vim.keymap.set('n', 'wh :vertical resize', '-1') +vim.keymap.set('n', 'wj :resize', '-1') +vim.keymap.set('n', 'wk :resize', '+1') +vim.keymap.set('n', 'wl :vertical resize', '+1') + +-- NerdTREE +vim.keymap.set('n', 'tt', ':NERDTreeToggle') + +-- files +-- these may go away soon +vim.keymap.set('n', 'xx', ':q') +vim.keymap.set('n', 'x!', ':q!') + +-- Close with leader +vim.keymap.set('n', 'ww', ':w', opts) +vim.keymap.set('n', 'qq', ':q', opts) +vim.keymap.set('n', 'wq', ':wq', opts) +vim.keymap.set('n', 'q!', ':q!', opts) +vim.keymap.set('n', 'wq', ':wq') +vim.keymap.set('n', 'ee :e', '') + +-- Tabs with leader +vim.keymap.set('n', 'th', ':tabprevious', opts) +vim.keymap.set('n', 'tl', ':tabnext', opts) +vim.keymap.set('n', 'tk', ':tabnew', opts) +vim.keymap.set('n', 'tj', ':tabclose', opts) + +-- Write with sudo +vim.keymap.set('n', 'ZW', ':w !pkexec tee % >/dev/null', opts) + +-- clear search highlights +vim.keymap.set('n', '/', ':noh') + +-- toggles +vim.keymap.set('n', 'tn :set', 'number!') +vim.keymap.set('n', 'tr :set', 'relativenumber!') + +-- write as root +vim.keymap.set('n', 'ZW', ':w !pkexec tee % >/dev/null') + +-- config +vim.keymap.set('n', 'en', ':e ~/.config/nvim/init.lua') +vim.keymap.set('n', 'ec', ':source %') +vim.keymap.set('n', 'er', ':source ~/.config/nvim/init.lua') + +-- Goyo +vim.keymap.set('n', 'G', ':Goyo') + +-- fugitive +vim.keymap.set('n', 'gp :G', 'pull') +vim.keymap.set('n', 'gd :G diff', '%') + +----------------- +-- Visual mode -- +----------------- + +-- Hint: start visual mode with the same area as the previous area and the same mode +--vim.keymap.set('v', '<', '', '>gv', opts) + +-- windows +vim.keymap.set('v', '', 'h') +vim.keymap.set('v', '', 'j') +vim.keymap.set('v', '', 'k') +vim.keymap.set('v', '', 'l') + +-------------- +-- TERMINAL -- +-------------- + +-- escape for term windows +vim.keymap.set('t', '', '') diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua new file mode 100644 index 0000000..1d4826e --- /dev/null +++ b/nvim/lua/options.lua @@ -0,0 +1,32 @@ +-- Hint: use `:h