remove old nvim settings

This commit is contained in:
Noah Masur 2021-05-13 17:45:49 -04:00
parent 1567128d43
commit f2c79dbab6
11 changed files with 0 additions and 384 deletions

View File

@ -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 <Space> <Leader>
" Unsets the search pattern register by hitting return
nnoremap <silent> <CR> :noh<CR><CR>
" Shuffle lines around
nnoremap <A-j> :m .+1<CR>==
nnoremap <A-k> :m .-2<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
" Jump to text in this directory
nnoremap <Leader>/ :Rg<CR>
" Quit vim
nnoremap <Leader>q :quit<cr>
nnoremap <Leader>Q :quitall<cr>
" Save file
nnoremap <Leader>fs :write<cr>
" Make file executable
nnoremap <silent> <Leader>fe :!chmod 755 %<cr><cr>
" Make file normal permissions
nnoremap <silent> <Leader>fn :!chmod 644 %<cr><cr>
" Open file in this directory
nnoremap <Leader>ff :Files<cr>
" Change directory to this file
nnoremap <silent> <Leader>fd :lcd %:p:h<cr>
" Back up directory
nnoremap <silent> <Leader>fu :lcd ..<cr>
" Open a recent file
nnoremap <Leader>fr :History<cr>
" Switch between multiple open files
nnoremap <Leader>b :Buffers<cr>
" Switch between two open files
nnoremap <Leader><Tab> :b#<cr>
" Jump to text in this file
nnoremap <Leader>s :BLines<cr>
" Toggle Git gutter (by line numbers)
nnoremap <Leader>` :GitGutterToggle<cr>
" Git repo
nnoremap <silent> <Leader>gr :!gh repo view -w<cr><cr>
" Split window
nnoremap <Leader>wv :vsplit<cr>
nnoremap <Leader>wh :split<cr>
" Close all other splits
nnoremap <Leader>wm :only<cr>
" Jump around
nnoremap <Leader><Space> :HopWord<cr>
" 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 <silent> <leader>z :ZoomToggle<CR>
" Exit terminal mode
tnoremap <A-CR> <C-\><C-n>
lua << EOF
-- Y yank until the end of line
vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true})
EOF
" Reload Vimrc settings
nnoremap <Leader>rr :Refresh<cr>
nnoremap <Leader>rp :Refresh<cr> :PlugInstall<cr>
" Tabularize
noremap <Leader>ta :Tabularize /
noremap <Leader>t# :Tabularize /#<CR>
noremap <Leader>t" :Tabularize /"<CR>
" Read todo comments
nnoremap <Leader>td /# \?TODO:\?<CR>

View File

@ -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 <TAB> 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=<F3> " 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
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

View File

@ -1,4 +0,0 @@
" Gitgutter plugin
"----------------
let g:gitgutter_enabled = 1 " Enabled on start

View File

@ -1,10 +0,0 @@
" LaTeX Settings
"---------------
" LaTeX Hotkeys
autocmd FileType tex inoremap ;bf \textbf{}<Esc>i
" Jump to the next occurence of <> and replace it with insert mode
autocmd FileType tex nnoremap <Leader><Space> /<><Esc>:noh<CR>c2l
" Autocompile LaTeX on save
autocmd BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!

View File

@ -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'
\ },
\ }

View File

@ -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

View File

@ -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 "<C-n>"
elseif vim.fn.call("vsnip#available", {1}) == 1 then
return t "<Plug>(vsnip-expand-or-jump)"
elseif check_back_space() then
return t "<Tab>"
else
return vim.fn['compe#complete']()
end
end
_G.s_tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-p>"
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
return t "<Plug>(vsnip-jump-prev)"
else
return t "<S-Tab>"
end
end
_G.cr_complete = function()
-- if vim.fn.pumvisible() == 1
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
EOF

View File

@ -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

View File

@ -1,5 +0,0 @@
" Quickscope
"-----------
" Only highlight on keypress
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']

View File

@ -1,18 +0,0 @@
" Snippets
"---------
" Basic programming files
nnoremap ,sh :-1read $DOTS/templates/programs/skeleton.sh<CR>Gdd03kC
nnoremap ,py :-1read $DOTS/templates/programs/skeleton.py<CR>Gdd08kC
" Kubernetes
nnoremap ,cm :-1read $DOTS/templates/kubernetes/configmap.yaml<CR>Gdd0gg
nnoremap ,sec :-1read $DOTS/templates/kubernetes/secret.yaml<CR>Gdd0gg
nnoremap ,dep :-1read $DOTS/templates/kubernetes/deployment.yaml<CR>Gdd0gg
nnoremap ,svc :-1read $DOTS/templates/kubernetes/service.yaml<CR>Gdd0gg
nnoremap ,ing :-1read $DOTS/templates/kubernetes/ingress.yaml<CR>Gdd0gg
nnoremap ,cro :-1read $DOTS/templates/kubernetes/clusterrole.yaml<CR>Gdd0gg
nnoremap ,crb :-1read $DOTS/templates/kubernetes/clusterrolebinding.yaml<CR>Gdd0gg
nnoremap ,ro :-1read $DOTS/templates/kubernetes/role.yaml<CR>Gdd0gg
nnoremap ,rb :-1read $DOTS/templates/kubernetes/rolebinding.yaml<CR>Gdd0gg
nnoremap ,sa :-1read $DOTS/templates/kubernetes/serviceaccount.yaml<CR>Gdd0gg

View File

@ -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 <Esc>:AddTag<CR>