diff --git a/nvim.configlink/settings/custom.vim b/nvim.configlink/settings/custom.vim deleted file mode 100644 index 2758f21..0000000 --- a/nvim.configlink/settings/custom.vim +++ /dev/null @@ -1,112 +0,0 @@ -" Custom Commands -"---------------- - -command! Vimrc edit $MYVIMRC " Edit .vimrc (this file) -command! Refresh source $MYVIMRC " Refresh from .vimrc (this file) -command! Today exe 'edit ~/notes/journal/'.strftime("%Y-%m-%d_%a").'.md' - -" Custom Keybinds -"---------------- - -" Map the leader key -map - -" Unsets the search pattern register by hitting return -nnoremap :noh - -" Shuffle lines around -nnoremap :m .+1== -nnoremap :m .-2== -inoremap :m .+1==gi -inoremap :m .-2==gi -vnoremap :m '>+1gv=gv -vnoremap :m '<-2gv=gv - -" Jump to text in this directory -nnoremap / :Rg - -" Quit vim -nnoremap q :quit -nnoremap Q :quitall - -" Save file -nnoremap fs :write - -" Make file executable -nnoremap fe :!chmod 755 % - -" Make file normal permissions -nnoremap fn :!chmod 644 % - -" Open file in this directory -nnoremap ff :Files - -" Change directory to this file -nnoremap fd :lcd %:p:h - -" Back up directory -nnoremap fu :lcd .. - -" Open a recent file -nnoremap fr :History - -" Switch between multiple open files -nnoremap b :Buffers - -" Switch between two open files -nnoremap :b# - -" Jump to text in this file -nnoremap s :BLines - -" Toggle Git gutter (by line numbers) -nnoremap ` :GitGutterToggle - -" Git repo -nnoremap gr :!gh repo view -w - -" Split window -nnoremap wv :vsplit -nnoremap wh :split - -" Close all other splits -nnoremap wm :only - -" Jump around -nnoremap :HopWord - -" Zoom / Restore window. -" https://stackoverflow.com/a/26551079 -function! s:ZoomToggle() abort - if exists('t:zoomed') && t:zoomed - execute t:zoom_winrestcmd - let t:zoomed = 0 - else - let t:zoom_winrestcmd = winrestcmd() - resize - vertical resize - let t:zoomed = 1 - endif -endfunction -command! ZoomToggle call s:ZoomToggle() -nnoremap z :ZoomToggle - -" Exit terminal mode -tnoremap - -lua << EOF --- Y yank until the end of line -vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true}) -EOF - -" Reload Vimrc settings -nnoremap rr :Refresh -nnoremap rp :Refresh :PlugInstall - -" Tabularize -noremap ta :Tabularize / -noremap t# :Tabularize /# -noremap t" :Tabularize /" - -" Read todo comments -nnoremap td /# \?TODO:\? diff --git a/nvim.configlink/settings/general.vim b/nvim.configlink/settings/general.vim deleted file mode 100644 index 7d74bd1..0000000 --- a/nvim.configlink/settings/general.vim +++ /dev/null @@ -1,72 +0,0 @@ -" General -"-------- - -" Basic Settings -filetype plugin on " Load the plugin for current filetype -syntax enable " Syntax highlighting -set termguicolors " Set to truecolor -colorscheme gruvbox " Installed in autoload/ and colors/ - -" Options -set hidden " Don't unload buffers when leaving them -set number " Show line numbers -set relativenumber " Relative numbers instead of absolute -set list " Reveal whitespace with --- -set expandtab " Tabs into spaces -set shiftwidth=4 " Amount to shift with > key -set softtabstop=4 " Amount to shift with key -set ignorecase " Ignore case when searching -set smartcase " Check case when using capitals in search -set infercase " Don't match cases when completing suggestions -set incsearch " Search while typing -set visualbell " No sounds -set scrolljump=1 " Number of lines to scroll -set scrolloff=3 " Margin of lines to see while scrolling -set splitright " Vertical splits on the right side -set splitbelow " Horizontal splits on the bottom side -set pastetoggle= " Use F3 to enter raw paste mode -set clipboard+=unnamedplus " Uses system clipboard for yanking -set updatetime=300 " Faster diagnostics -set mouse=nv " Mouse interaction / scrolling - -" Neovim only -set inccommand=split " Live preview search and replace -set completeopt=menuone,noselect " Required for nvim-compe completion - -" Remember last position when reopening file -if has("autocmd") - au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif -endif - -" Better backup, swap and undo storage -set noswapfile " Instead of swaps, create backups -set backup " Easier to recover and more secure -set undofile " Keeps undos after quit -set backupdir=~/.config/nvim/dirs/backup -set undodir=~/.config/nvim/dirs/undo - -" Create backup directories if they don't exist -if !isdirectory(&backupdir) - call mkdir(&backupdir, "p") -endif -if !isdirectory(&undodir) - call mkdir(&undodir, "p") -endif - -" Keep selection when tabbing -vnoremap < >gv - -" Force filetype patterns that Vim doesn't know about -au BufRead,BufNewFile *.Brewfile setfiletype brewfile -au BufRead,BufNewFile tmux.conf* setfiletype tmux -au BufRead,BufNewFile *ignore.*link setfiletype gitignore -au BufRead,BufNewFile gitconfig.*link setfiletype gitconfig -au BufRead,BufNewFile *.toml.*link setfiletype toml -au BufRead,BufNewFile .env* set ft=text | set syntax=sh - -" Highlight when yanking -au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 } - -" Auto-pairs -let g:AutoPairsFlyMode = 1 diff --git a/nvim.configlink/settings/gitgutter.vim b/nvim.configlink/settings/gitgutter.vim deleted file mode 100644 index f3ca301..0000000 --- a/nvim.configlink/settings/gitgutter.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Gitgutter plugin -"---------------- - -let g:gitgutter_enabled = 1 " Enabled on start diff --git a/nvim.configlink/settings/latex.vim b/nvim.configlink/settings/latex.vim deleted file mode 100644 index 93c3b34..0000000 --- a/nvim.configlink/settings/latex.vim +++ /dev/null @@ -1,10 +0,0 @@ -" LaTeX Settings -"--------------- - -" LaTeX Hotkeys -autocmd FileType tex inoremap ;bf \textbf{}i -" Jump to the next occurence of <> and replace it with insert mode -autocmd FileType tex nnoremap /<>:nohc2l - -" Autocompile LaTeX on save -autocmd BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw! diff --git a/nvim.configlink/settings/lightline.vim b/nvim.configlink/settings/lightline.vim deleted file mode 100644 index 8de8a68..0000000 --- a/nvim.configlink/settings/lightline.vim +++ /dev/null @@ -1,14 +0,0 @@ -" Lightline Status Bar -"--------------------- - -let g:lightline = { - \ 'colorscheme': 'jellybeans', - \ 'active': { - \ 'right': [[ 'lineinfo' ]], - \ 'left': [[ 'mode', 'paste' ], - \ [ 'readonly', 'relativepath', 'gitbranch', 'modified' ]] - \ }, - \ 'component_function': { - \ 'gitbranch': 'fugitive#head' - \ }, - \ } diff --git a/nvim.configlink/settings/netrw.vim b/nvim.configlink/settings/netrw.vim deleted file mode 100644 index 2ed4298..0000000 --- a/nvim.configlink/settings/netrw.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Plugin Settings -"---------------- - -" Built-in file explorer plugin -let g:netrw_liststyle = 3 " Change style to 'tree' view -let g:netrw_banner = 0 " Remove useless banner -let g:netrw_winsize = 15 " Explore window takes % of page -let g:netrw_browse_split = 4 " Open in previous window -let g:netrw_altv = 1 " Always split left diff --git a/nvim.configlink/settings/plugins.vim b/nvim.configlink/settings/plugins.vim deleted file mode 100644 index e914343..0000000 --- a/nvim.configlink/settings/plugins.vim +++ /dev/null @@ -1,105 +0,0 @@ -" Plugins -"-------- - -" Install vim-plugged if not installed -if empty(glob('$HOME/.config/nvim/autoload/plug.vim')) - silent !curl -fLo $HOME/.config/nvim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $HOME/.config/nvim/init.vim -endif - -" All plugins -call plug#begin('$HOME/.config/nvim/plugged') - -" Core plugins -Plug 'nvim-lua/plenary.nvim' " Prerequisite library for other plugins -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Install fzf (prerequisite for fzf.vim) -Plug 'junegunn/fzf.vim' " Actual fuzzyfinder -Plug 'morhetz/gruvbox' " Colorscheme -Plug 'tpope/vim-surround' " Enables paren editing -Plug 'sheerun/vim-polyglot' " Syntax for every language -Plug 'lewis6991/gitsigns.nvim' " Git next to line numbers -Plug 'tpope/vim-commentary' " Use gc or gcc to comment -Plug 'phaazon/hop.nvim' " Quick jump around the buffer -Plug 'neovim/nvim-lspconfig' " Language server linting -Plug 'jiangmiao/auto-pairs' " Parentheses -Plug 'rafamadriz/friendly-snippets' -Plug 'hrsh7th/vim-vsnip' -Plug 'hrsh7th/vim-vsnip-integ' -Plug 'hrsh7th/nvim-compe' " Auto-complete -Plug 'tpope/vim-repeat' " Actually repeat using . - -" Ancillary plugins -Plug 'godlygeek/tabular' " Spacing and alignment -Plug 'unblevable/quick-scope' " Hints for f and t -Plug 'vimwiki/vimwiki' " Wiki Markdown System -Plug 'airblade/vim-rooter' " Change directory to git route -Plug 'tpope/vim-fugitive' " Other git commands -Plug 'itchyny/lightline.vim' " Status bar -Plug 'tpope/vim-eunuch' " File manipulation in Vim -Plug 'tpope/vim-vinegar' " Fixes netrw file explorer -Plug 'christoomey/vim-tmux-navigator' " Hotkeys for tmux panes - -call plug#end() - -" Enable plugins -lua << EOF -require('lspconfig').rust_analyzer.setup{} -require('lspconfig').pyls.setup{} -require('gitsigns').setup() -require'compe'.setup({ - enabled = true, - source = { - path = true, - buffer = true, - nvim_lsp = true, - }, -}) -EOF - -lua << EOF -local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end - -local check_back_space = function() - local col = vim.fn.col('.') - 1 - if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then - return true - else - return false - end -end - --- Use (s-)tab to: ---- move to prev/next item in completion menuone ---- jump to prev/next snippet's placeholder -_G.tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "" - elseif vim.fn.call("vsnip#available", {1}) == 1 then - return t "(vsnip-expand-or-jump)" - elseif check_back_space() then - return t "" - else - return vim.fn['compe#complete']() - end -end -_G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "" - elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then - return t "(vsnip-jump-prev)" - else - return t "" - end -end -_G.cr_complete = function() - -- if vim.fn.pumvisible() == 1 -end - -vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) -EOF diff --git a/nvim.configlink/settings/polyglot.vim b/nvim.configlink/settings/polyglot.vim deleted file mode 100644 index 5437b01..0000000 --- a/nvim.configlink/settings/polyglot.vim +++ /dev/null @@ -1,5 +0,0 @@ -" Polyglot Syntax -"---------------- - -let g:terraform_fmt_on_save=1 " Formats with terraform plugin -let g:rustfmt_autosave = 1 " Formats with rust plugin diff --git a/nvim.configlink/settings/quickscope.vim b/nvim.configlink/settings/quickscope.vim deleted file mode 100644 index 4841112..0000000 --- a/nvim.configlink/settings/quickscope.vim +++ /dev/null @@ -1,5 +0,0 @@ -" Quickscope -"----------- - -" Only highlight on keypress -let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] diff --git a/nvim.configlink/settings/snippets.vim b/nvim.configlink/settings/snippets.vim deleted file mode 100644 index b2988ed..0000000 --- a/nvim.configlink/settings/snippets.vim +++ /dev/null @@ -1,18 +0,0 @@ -" Snippets -"--------- - -" Basic programming files -nnoremap ,sh :-1read $DOTS/templates/programs/skeleton.shGdd03kC -nnoremap ,py :-1read $DOTS/templates/programs/skeleton.pyGdd08kC - -" Kubernetes -nnoremap ,cm :-1read $DOTS/templates/kubernetes/configmap.yamlGdd0gg -nnoremap ,sec :-1read $DOTS/templates/kubernetes/secret.yamlGdd0gg -nnoremap ,dep :-1read $DOTS/templates/kubernetes/deployment.yamlGdd0gg -nnoremap ,svc :-1read $DOTS/templates/kubernetes/service.yamlGdd0gg -nnoremap ,ing :-1read $DOTS/templates/kubernetes/ingress.yamlGdd0gg -nnoremap ,cro :-1read $DOTS/templates/kubernetes/clusterrole.yamlGdd0gg -nnoremap ,crb :-1read $DOTS/templates/kubernetes/clusterrolebinding.yamlGdd0gg -nnoremap ,ro :-1read $DOTS/templates/kubernetes/role.yamlGdd0gg -nnoremap ,rb :-1read $DOTS/templates/kubernetes/rolebinding.yamlGdd0gg -nnoremap ,sa :-1read $DOTS/templates/kubernetes/serviceaccount.yamlGdd0gg diff --git a/nvim.configlink/settings/vimwiki.vim b/nvim.configlink/settings/vimwiki.vim deleted file mode 100644 index 3569ae7..0000000 --- a/nvim.configlink/settings/vimwiki.vim +++ /dev/null @@ -1,30 +0,0 @@ -" VimWiki -"-------- - -let g:vimwiki_list = [ - \ { - \ 'path': $NOTES_PATH, - \ 'syntax': 'markdown', - \ 'index': 'home', - \ 'ext': '.md' - \ } - \ ] -let g:vimwiki_key_mappings = - \ { - \ 'all_maps': 1, - \ 'mouse': 1, - \ } -let g:vimwiki_auto_chdir = 1 " Set local dir to Wiki when open -let g:vimwiki_create_link = 0 " Don't automatically create new links -let g:vimwiki_listsyms = ' x' " Set checkbox symbol progression -let g:vimwiki_table_mappings = 0 " VimWiki table keybinds interfere with tab completion - -" Insert from command-mode into buffer -function! PInsert(item) - let @z=a:item - norm "zpx -endfunction - -command! AddTag call fzf#run({'source': 'rg "#[\w/]+[ |\$]" -o --no-filename --no-line-number | sort | uniq', 'sink': function('PInsert')}) - -autocmd FileType markdown inoremap ;tt :AddTag