diff --git a/.config/nvim/.netrwhist b/.config/nvim/.netrwhist new file mode 100644 index 0000000..c83080f --- /dev/null +++ b/.config/nvim/.netrwhist @@ -0,0 +1,12 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhistcnt =1 +let g:netrw_dirhist_1='/home/brodie' +let g:netrw_dirhist_0='/home/brodie/.abduco' +let g:netrw_dirhist_9='/home/brodie/scripts/alsa' +let g:netrw_dirhist_8='/home/brodie/repos/bookmenu' +let g:netrw_dirhist_7='/home/brodie' +let g:netrw_dirhist_6='/home/brodie/.config/mpd' +let g:netrw_dirhist_5='/home/brodie' +let g:netrw_dirhist_4='/home/brodie/repos/dotfiles/config/nvim' +let g:netrw_dirhist_3='/home/brodie/repos/dotfiles/config/cointop' +let g:netrw_dirhist_2='/home/brodie' diff --git a/.config/nvim/basic-setting.vim b/.config/nvim/basic-setting.vim new file mode 100644 index 0000000..ea858e6 --- /dev/null +++ b/.config/nvim/basic-setting.vim @@ -0,0 +1,22 @@ + "set termguicolors +colorscheme codedark +vmap < >gv +set showmatch " show matching +set ignorecase " case insensitive +set hlsearch " highlight search +set incsearch " incremental search +set tabstop=4 " number of columns occupied by a tab +set softtabstop=4 " see multiple spaces as tabstops so does the right thing +set expandtab " converts tabs to white space +set shiftwidth=4 " width for autoindents +" set autoindent " indent a new line the same amount as the line just typed +" set mouse=v " middle-click paste with +" set mouse=a " enable mouse click +" set clipboard=unnamedplus " using system clipboard +filetype plugin on +set cursorline " highlight current cursorline +set ttyfast " Speed up scrolling in Vim +" set spell " enable spell check (may need to download language package) +" set noswapfile " disable creating swap file +" set backupdir=~/.cache/vim " Directory to store backup files. diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json new file mode 100644 index 0000000..ad735f0 --- /dev/null +++ b/.config/nvim/coc-settings.json @@ -0,0 +1,74 @@ +{ + "pairs.enableCharacters": ["(", "[", "{", "'", "\"", "`"], + "suggest.noselect": false, + "coc.preferences.formatOnSaveFiletypes": [ + "javascript", + "typescript", + "typescriptreact", + "json", + "javascriptreact", + "typescript.tsx", + "graphql" + ], + "explorer.icon.enableNerdfont": true, + "explorer.quitOnOpen": true, + "explorer.position": "left", + "explorer.file.showHiddenFiles": true, + "explorer.file.column.clip.copy": "", + "explorer.file.column.clip.cut": "", + "explorer.keyMappings": { + "gk": "expandablePrev", + "gj": "expandableNext", + + "": "toggleSelection", + "": "actionMenu", + + "h": "collapse", + "l": ["expandable?", "expand", "open"], + "J": ["toggleSelection", "nodeNext"], + "K": ["toggleSelection", "nodePrev"], + "<2-LeftMouse>": [ + "expandable?", + ["expanded?", "collapse", "expand"], + "open" + ], + "o": ["expanded?", "collapse", "expand"], + "": ["expandable?", "cd", "open"], + "H": "open:split", + "S": "open:split:plain", + "V": "open:vsplit", + "": "gotoParent", + + "Y": "copyFile", + "X": "cutFile", + "P": "pasteFile", + "dd": "delete", + + "mf": "addFile", + "md": "addDirectory", + "r": "rename", + + ".": "toggleHidden", + "R": "refresh", + + "?": "help", + "q": "quit", + "": "esc", + "!": "systemExecute", + "gd": "listDrive", + + "f": "search", + "F": "searchRecursive", + + "gf": "gotoSource:file", + "gb": "gotoSource:buffer", + + "[[": "sourcePrev", + "]]": "sourceNext", + + "gp": "gitPrev", + "gn": "gitNext", + "ga": "gitStage", + "gr": "gitUnstage" + } +} diff --git a/.config/nvim/ftdetect/ftdetect.vim b/.config/nvim/ftdetect/ftdetect.vim new file mode 100644 index 0000000..5539e91 --- /dev/null +++ b/.config/nvim/ftdetect/ftdetect.vim @@ -0,0 +1,6 @@ +" Fix tex file type set +autocmd BufRead,BufNewFile *.tex set filetype=tex +autocmd BufRead,BufNewFile *.md set filetype=markdown +autocmd BufRead,BufNewFile *.tp set filetype=type +autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown + diff --git a/.config/nvim/ftplugin/markdown.vim b/.config/nvim/ftplugin/markdown.vim new file mode 100644 index 0000000..404fe39 --- /dev/null +++ b/.config/nvim/ftplugin/markdown.vim @@ -0,0 +1 @@ +setlocal spell spelllang=en_au diff --git a/.config/nvim/ftplugin/tex.vim b/.config/nvim/ftplugin/tex.vim new file mode 100644 index 0000000..404fe39 --- /dev/null +++ b/.config/nvim/ftplugin/tex.vim @@ -0,0 +1 @@ +setlocal spell spelllang=en_au diff --git a/.config/nvim/ftplugin/vimwiki.vim b/.config/nvim/ftplugin/vimwiki.vim new file mode 100644 index 0000000..404fe39 --- /dev/null +++ b/.config/nvim/ftplugin/vimwiki.vim @@ -0,0 +1 @@ +setlocal spell spelllang=en_au diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..5175610 --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,19 @@ +if !exists('g:vscode') + source ~/.config/nvim/basic-setting.vim + source ~/.config/nvim/plugconfig/indentline.vim + source ~/.config/nvim/plugconfig/vifm.vim + source ~/.config/nvim/plugconfig/vimwiki.vim + source ~/.config/nvim/plugconfig/easy-motion.vim + source ~/.config/nvim/plugconfig/undotree.vim + source ~/.config/nvim/plugconfig/emmet.vim + source ~/.config/nvim/plugconfig/table-mode.vim + source ~/.config/nvim/plugconfig/goyo.vim + source ~/.config/nvim/plugconfig/git-gutter.vim + source ~/.config/nvim/plugconfig/vim-airline.vim + source ~/.config/nvim/plugconfig/vim-hexokinase.vim + source ~/.config/nvim/plugconfig/vim-fzf.vim + source ~/.config/nvim/plugconfig/fern.vim + source ~/.config/nvim/plugconfig/vim-closetag.vim + source ~/.config/nvim/plugconfig/coc.vim + source ~/.config/nvim/plugconfig/netrw.vim +endif diff --git a/.config/nvim/plugconfig/coc.vim b/.config/nvim/plugconfig/coc.vim new file mode 100644 index 0000000..e5dbfcf --- /dev/null +++ b/.config/nvim/plugconfig/coc.vim @@ -0,0 +1,113 @@ +" prettier command for coc +command! -nargs=0 Prettier :CocCommand prettier.formatFile +let g:coc_global_extensions = [ + \ 'coc-snippets', + \ 'coc-pairs', + \ 'coc-prettier', + \ 'coc-tsserver', + \ 'coc-html', + \ 'coc-css', + \ 'coc-json', + \ 'coc-angular', + \ 'coc-explorer', + \ 'coc-vimtex', + \ 'coc-python', + \ 'coc-marketplace' + \ ] + +noremap :CocCommand explorer + +" From Coc Readme +set updatetime=300 + +" Some servers have issues with backup files, see #649 +set nobackup +set nowritebackup + +" don't give |ins-completion-menu| messages. +set shortmess+=c + +" always show signcolumns +set signcolumn=yes + +" Use tab for trigger completion with characters ahead and navigate. +" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +inoremap coc#refresh() + +" Use to confirm completion, `u` means break undo chain at current position. +" Coc only does snippet and additional edit on confirm. +inoremap pumvisible() ? "\" : "\u\" +" Or use `complete_info` if your vim support it, like: +" inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" + +" Use `[g` and `]g` to navigate diagnostics +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Remap for rename current word +nmap (coc-rename) + +" Remap for format selected region +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Remap for do codeAction of selected region, ex: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) +" Fix autofix problem of current line +nmap qf (coc-fix-current) + +" Create mappings for function text object, requires document symbols feature of languageserver. +xmap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap if (coc-funcobj-i) +omap af (coc-funcobj-a) + +" Use `:Format` to format current buffer +command! -nargs=0 Format :call CocAction('format') + +" Use `:Fold` to fold current buffer +command! -nargs=? Fold :call CocAction('fold', ) + +" use `:OR` for organize import of current buffer +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') + +" Add status line support, for integration with other plugin, checkout `:h coc-status` +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} diff --git a/.config/nvim/plugconfig/easy-motion.vim b/.config/nvim/plugconfig/easy-motion.vim new file mode 100644 index 0000000..9757d92 --- /dev/null +++ b/.config/nvim/plugconfig/easy-motion.vim @@ -0,0 +1,5 @@ +map . (easymotion-repeat) +map f (easymotion-overwin-f) +map j (easymotion-overwin-line) +map k (easymotion-overwin-line) +map w (easymotion-overwin-w) diff --git a/.config/nvim/plugconfig/emmet.vim b/.config/nvim/plugconfig/emmet.vim new file mode 100644 index 0000000..32934c3 --- /dev/null +++ b/.config/nvim/plugconfig/emmet.vim @@ -0,0 +1 @@ +let g:user_emmet_leader_key='' diff --git a/.config/nvim/plugconfig/fern.vim b/.config/nvim/plugconfig/fern.vim new file mode 100644 index 0000000..52e7ab8 --- /dev/null +++ b/.config/nvim/plugconfig/fern.vim @@ -0,0 +1,26 @@ +let g:fern#drawer_width = 30 +let g:fern#default_hidden = 1 +let g:fern#disable_drawer_auto_quit = 1 + +"noremap :Fern . -drawer -toggle + +function! s:init_fern() abort + nmap H (fern-action-open:split) + nmap V (fern-action-open:vsplit) + nmap R (fern-action-rename) + nmap M (fern-action-move) + nmap C (fern-action-copy) + nmap N (fern-action-new-path) + nmap T (fern-action-new-file) + nmap D (fern-action-new-dir) + nmap S (fern-action-hidden-toggle) + nmap dd (fern-action-trash) + nmap (fern-action-mark) +endfunction + +augroup fern-custom + autocmd! * + autocmd FileType fern call s:init_fern() +augroup END + +let g:fern#renderer = "nerdfont" diff --git a/.config/nvim/plugconfig/git-gutter.vim b/.config/nvim/plugconfig/git-gutter.vim new file mode 100644 index 0000000..332f25e --- /dev/null +++ b/.config/nvim/plugconfig/git-gutter.vim @@ -0,0 +1,5 @@ +nmap ) (GitGutterNextHunk) +nmap ( (GitGutterPrevHunk) +let g:gitgutter_enabled = 1 +let g:gitgutter_map_keys = 0 +let g:gitgutter_highlight_linenrs = 1 diff --git a/.config/nvim/plugconfig/goyo.vim b/.config/nvim/plugconfig/goyo.vim new file mode 100644 index 0000000..9cb91cf --- /dev/null +++ b/.config/nvim/plugconfig/goyo.vim @@ -0,0 +1 @@ +noremap g :Goyo diff --git a/.config/nvim/plugconfig/indentline.vim b/.config/nvim/plugconfig/indentline.vim new file mode 100644 index 0000000..d89394c --- /dev/null +++ b/.config/nvim/plugconfig/indentline.vim @@ -0,0 +1,35 @@ +"let g:indentLine_showFirstIndentLevel = 1 +"let g:indentLine_fileType = ['javascript', 'c'] +let g:indentLine_fileTypeExclude = ["vimwiki", "coc-explorer", "help", "undotree", "diff"] +let g:indentLine_bufTypeExclude = ["help", "terminal"] +"let g:indentLine_bufNameExclude = [] +let g:indentLine_indentLevel = 10 + +" Conceal settings +let g:indentLine_setConceal = 1 +let g:indentLine_concealcursor = "incv" +let g:indentLine_conceallevel = 2 + +let g:indentLine_char = '|' +"let g:indentLine_char_list = ['|', '¦', '┆', '┊'] + +" Leading Space +"let g:indentLine_leadingSpaceEnabled = 1 +let g:indentLine_leadingSpaceChar = "•" + +" Use Theme Colors +"let g:indentLine_setColors = 0 + +" 16 Color +let g:indentLine_color_tty_light = 7 " (default: 4) +let g:indentLine_color_dark = 1 " (default: 2) + +" 256 +let g:indentLine_color_term = 239 + +" True Color +let g:indentLine_color_gui = '#616161' + +" Background (256, True) +"let g:indentLine_bgcolor_term = 202 +"let g:indentLine_bgcolor_gui = '#FF5F00' diff --git a/.config/nvim/plugconfig/netrw.vim b/.config/nvim/plugconfig/netrw.vim new file mode 100644 index 0000000..a9451ff --- /dev/null +++ b/.config/nvim/plugconfig/netrw.vim @@ -0,0 +1,82 @@ +let g:netrw_banner = 0 +let g:netrw_liststyle = 3 +let g:netrw_browse_split = 4 +let g:netrw_winsize = 20 + +function! OpenToRight() + :normal v + let g:path=expand('%:p') + execute 'q!' + execute 'belowright vnew' g:path + :normal l +endfunction + +function! OpenBelow() + :normal v + let g:path=expand('%:p') + execute 'q!' + execute 'belowright new' g:path + :normal l +endfunction + +function! OpenTab() + :normal v + let g:path=expand('%:p') + execute 'q!' + execute 'tabedit' g:path + :normal l +endfunction + +function! NetrwMappings() + " Hack fix to make ctrl-l work properly + noremap l + noremap l + noremap :call ToggleNetrw() + noremap :call ToggleNetrw() + noremap V :call OpenToRight() + noremap H :call OpenBelow() + noremap T :call OpenTab() +endfunction + +augroup netrw_mappings + autocmd! + autocmd filetype netrw call NetrwMappings() +augroup END + +" Allow for netrw to be toggled +function! ToggleNetrw() + if g:NetrwIsOpen + let i = bufnr("$") + while (i >= 1) + if (getbufvar(i, "&filetype") == "netrw") + silent exe "bwipeout " . i + endif + let i-=1 + endwhile + let g:NetrwIsOpen=0 + else + let g:NetrwIsOpen=1 + silent Lexplore + endif +endfunction + +" Check before opening buffer on any file +function! NetrwOnBufferOpen() + if exists('b:noNetrw') + return + endif + call ToggleNetrw() +endfun + +" Close Netrw if it's the only buffer open +autocmd WinEnter * if winnr('$') == 1 && getbufvar(winbufnr(winnr()), "&filetype") == "netrw" || &buftype == 'quickfix' |q|endif + +" Make netrw act like a project Draw +augroup ProjectDrawer + autocmd! + " Don't open Netrw + autocmd VimEnter ~/.config/joplin/tmp/*,/tmp/calcurse*,~/.calcurse/notes/*,~/vimwiki/*,*/.git/COMMIT_EDITMSG let b:noNetrw=1 + autocmd VimEnter * :call NetrwOnBufferOpen() +augroup END + +let g:NetrwIsOpen=0 diff --git a/.config/nvim/plugconfig/plugins.vim b/.config/nvim/plugconfig/plugins.vim new file mode 100644 index 0000000..4fa9f68 --- /dev/null +++ b/.config/nvim/plugconfig/plugins.vim @@ -0,0 +1,38 @@ +call plug#begin('~/.config/nvim/plugged') + +" Themes +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'tomasiser/vim-code-dark' +" Code Completion +Plug 'neoclide/coc.nvim', {'branch': 'release'} +" Tags +Plug 'alvan/vim-closetag' +Plug 'tpope/vim-surround' +Plug 'mattn/emmet-vim' +" Commenting +Plug 'tpope/vim-commentary' +" Syntax highlighting +Plug 'HerringtonDarkholme/yats.vim' +Plug 'yuezk/vim-js' +Plug 'maxmellon/vim-jsx-pretty' +Plug 'rust-lang/rust.vim' +" Motions +Plug 'easymotion/vim-easymotion' +" Git +Plug 'airblade/vim-gitgutter' +Plug 'tpope/vim-fugitive' +" Misc +Plug 'junegunn/fzf.vim' +Plug 'junegunn/goyo.vim' +Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' } +Plug 'vimwiki/vimwiki' +Plug 'tpope/vim-repeat' +Plug 'dhruvasagar/vim-table-mode' +Plug 'itchyny/calendar.vim' +Plug 'mbbill/undotree' +"Plug 'lambdalisue/fern.vim' +Plug 'lambdalisue/nerdfont.vim' +Plug 'lambdalisue/fern-renderer-nerdfont.vim' + +call plug#end() diff --git a/.config/nvim/plugconfig/table-mode.vim b/.config/nvim/plugconfig/table-mode.vim new file mode 100644 index 0000000..dae8457 --- /dev/null +++ b/.config/nvim/plugconfig/table-mode.vim @@ -0,0 +1 @@ +let g:table_mode_delete_row_map = "tdr" diff --git a/.config/nvim/plugconfig/undotree.vim b/.config/nvim/plugconfig/undotree.vim new file mode 100644 index 0000000..4b0fa84 --- /dev/null +++ b/.config/nvim/plugconfig/undotree.vim @@ -0,0 +1,11 @@ +nnoremap :UndotreeToggle + +let g:undotree_RelativeTimestamp = 1 +let g:undotree_ShortIndicators = 1 +let g:undotree_HelpLine = 0 +let g:undotree_WindowLayout = 2 + +if has("persistent_undo") + set undodir=$HOME/.local/share/nvim/undodir + set undofile +endif diff --git a/.config/nvim/plugconfig/vifm.vim b/.config/nvim/plugconfig/vifm.vim new file mode 100644 index 0000000..7a67190 --- /dev/null +++ b/.config/nvim/plugconfig/vifm.vim @@ -0,0 +1,6 @@ +let g:vifm_replace_netrw = 1 +let g:vifm_replace_netrw_cmd = "Vifm" +"let g:vifm_embed_term = 1 +"let g:vifm_embed_split = 1 + +"let g:vifm_exec_args = diff --git a/.config/nvim/plugconfig/vim-airline.vim b/.config/nvim/plugconfig/vim-airline.vim new file mode 100644 index 0000000..a4d7e47 --- /dev/null +++ b/.config/nvim/plugconfig/vim-airline.vim @@ -0,0 +1,3 @@ +let g:airline#extensions#wordcount#enabled = 1 +let g:airline#extensions#hunks#non_zero_only = 1 +let g:airline_theme = 'codedark' diff --git a/.config/nvim/plugconfig/vim-closetag.vim b/.config/nvim/plugconfig/vim-closetag.vim new file mode 100644 index 0000000..ceef7ed --- /dev/null +++ b/.config/nvim/plugconfig/vim-closetag.vim @@ -0,0 +1,31 @@ +" filenames like *.xml, *.html, *.xhtml, ... +" These are the file extensions where this plugin is enabled. +let g:closetag_filenames = '*.html,*.xhtml,*.jsx,*.js,*.tsx' + +" filenames like *.xml, *.xhtml, ... +" This will make the list of non-closing tags self-closing in the specified files. +let g:closetag_xhtml_filenames = '*.xml,*.xhtml,*.jsx,*.js,*.tsx' + +" filetypes like xml, html, xhtml, ... +" These are the file types where this plugin is enabled. +let g:closetag_filetypes = 'html,xhtml,jsx,js,tsx' + +" filetypes like xml, xhtml, ... +" This will make the list of non-closing tags self-closing in the specified files. +let g:closetag_xhtml_filetypes = 'xml,xhtml,jsx,js,tsx' + +" integer value [0|1] +" This will make the list of non-closing tags case-sensitive (e.g. `` will be closed while `` won't.) +let g:closetag_emptyTags_caseSensitive = 1 + +" Disables auto-close if not in a "valid" region (based on filetype) +let g:closetag_regions = { + \ 'typescript.tsx': 'jsxRegion,tsxRegion', + \ 'javascript.jsx': 'jsxRegion', + \ } + +" Shortcut for closing tags, default is '>' +let g:closetag_shortcut = '>' + +" Add > at current position without closing the current tag, default is '' +let g:closetag_close_shortcut = '>' diff --git a/.config/nvim/plugconfig/vim-fzf.vim b/.config/nvim/plugconfig/vim-fzf.vim new file mode 100644 index 0000000..7404847 --- /dev/null +++ b/.config/nvim/plugconfig/vim-fzf.vim @@ -0,0 +1,7 @@ +nnoremap :GFiles +nnoremap :Files + +command! -bang -nargs=? -complete=dir Files + \ call fzf#vim#files(, {'options': ['--preview', 'preview {}']}, 0) +command! -bang -nargs=? -complete=dir GFiles + \ call fzf#vim#gitfiles(, {'options': ['--preview', 'preview {}']}, 0) diff --git a/.config/nvim/plugconfig/vim-hexokinase.vim b/.config/nvim/plugconfig/vim-hexokinase.vim new file mode 100644 index 0000000..3f007b4 --- /dev/null +++ b/.config/nvim/plugconfig/vim-hexokinase.vim @@ -0,0 +1,16 @@ +let g:Hexokinase_refreshEvents = ['InsertLeave'] + +let g:Hexokinase_optInPatterns = [ +\ 'full_hex', +\ 'triple_hex', +\ 'rgb', +\ 'rgba', +\ 'hsl', +\ 'hsla', +\ 'colour_names' +\ ] + +let g:Hexokinase_highlighters = ['backgroundfull'] + +" Reenable hexokinase on enter +autocmd VimEnter * HexokinaseTurnOn diff --git a/.config/nvim/plugconfig/vimwiki.vim b/.config/nvim/plugconfig/vimwiki.vim new file mode 100644 index 0000000..88f7c24 --- /dev/null +++ b/.config/nvim/plugconfig/vimwiki.vim @@ -0,0 +1 @@ +let g:vimwiki_list = [{'path': '~/.local/share/vimwiki/', 'auto_diary_index': 1}] diff --git a/.config/nvim/plugin/abbreviations.vim b/.config/nvim/plugin/abbreviations.vim new file mode 100644 index 0000000..5384137 --- /dev/null +++ b/.config/nvim/plugin/abbreviations.vim @@ -0,0 +1,10 @@ +cnoreabbrev W! w! +cnoreabbrev Q! q! +cnoreabbrev Qall! qall! +cnoreabbrev Wq wq +cnoreabbrev Wa wa +cnoreabbrev wQ wq +cnoreabbrev WQ wq +cnoreabbrev W w +cnoreabbrev Q q +cnoreabbrev Qall qall diff --git a/.config/nvim/plugin/basic-autocmd.vim b/.config/nvim/plugin/basic-autocmd.vim new file mode 100644 index 0000000..fd34c84 --- /dev/null +++ b/.config/nvim/plugin/basic-autocmd.vim @@ -0,0 +1,7 @@ + +" Vertically center document when entering insert mode +autocmd InsertEnter * norm zz + +" Remove trailing whitespace on save +autocmd BufWritePre * %s/\s\+$//e + diff --git a/.config/nvim/plugin/basic-setting.vim b/.config/nvim/plugin/basic-setting.vim new file mode 100644 index 0000000..b0a3057 --- /dev/null +++ b/.config/nvim/plugin/basic-setting.vim @@ -0,0 +1,29 @@ +let mapleader=" " + +" Use system clipboard +set clipboard+=unnamedplus + +set mouse=v +syntax on +set ignorecase +set smartcase +set encoding=utf-8 +set number relativenumber + +" Tab Settings +set expandtab +set shiftwidth=2 +set softtabstop=2 +set tabstop=2 + +set path=.,,** + +" Autocompletion +set wildmode=longest,list,full + +" Fix splitting +set splitbelow splitright + +" Cursor line +set cursorline +set cursorcolumn diff --git a/.config/nvim/plugin/gitgutter.vim b/.config/nvim/plugin/gitgutter.vim new file mode 100644 index 0000000..3ffff3b --- /dev/null +++ b/.config/nvim/plugin/gitgutter.vim @@ -0,0 +1,3 @@ +highlight GitGutterAdd guifg=#009900 ctermfg=Green +highlight GitGutterChange guifg=#bbbb00 ctermfg=Yellow +highlight GitGutterDelete guifg=#ff2222 ctermfg=Red diff --git a/.config/nvim/plugin/guide-map.vim b/.config/nvim/plugin/guide-map.vim new file mode 100644 index 0000000..9316676 --- /dev/null +++ b/.config/nvim/plugin/guide-map.vim @@ -0,0 +1,8 @@ +" Guide navigation +noremap /<++>"_c4l +inoremap /<++>"_c4l +vnoremap /<++>"_c4l + +" general insert commands +inoremap ;g <++> + diff --git a/.config/nvim/plugin/markdown-map.vim b/.config/nvim/plugin/markdown-map.vim new file mode 100644 index 0000000..fd87be7 --- /dev/null +++ b/.config/nvim/plugin/markdown-map.vim @@ -0,0 +1,11 @@ +autocmd FileType markdown noremap r i---title:<++>author:"Brodie Robertson"geometry:-top=30mm-left=20mm-right=20mm-bottom=30mmheader-includes:\|\usepackage{float}\let\origfigure\figure\let\endorigfigure\endfigure\renewenvironment{figure}[1][2]{\expandafter\origfigure\expandafter[H]}{\endorigfigure}--- +autocmd FileType markdown inoremap ,i ![](<++>){#fig:<++>}<++>kkF]i +autocmd FileType markdown inoremap ,a [](<++>)<++>F]i +autocmd FileType markdown inoremap ,1 #<++>2k +autocmd FileType markdown inoremap ,2 ##<++>2k +autocmd FileType markdown inoremap ,3 ###<++>2k +autocmd FileType markdown inoremap ,4 ####<++>2k +autocmd FileType markdown inoremap ,5 #####<++>2k +autocmd FileType markdown inoremap ,u +<++>1k +autocmd FileType markdown inoremap ,o 1.<++>1k +autocmd FileType markdown inoremap ,f +@fig: diff --git a/.config/nvim/plugin/shell-map.vim b/.config/nvim/plugin/shell-map.vim new file mode 100644 index 0000000..53333a0 --- /dev/null +++ b/.config/nvim/plugin/shell-map.vim @@ -0,0 +1,6 @@ +map b i#!/bin/sh +autocmd FileType sh inoremap ,f (){<++>}<++>?() +autocmd FileType sh inoremap ,i if[];then<++>fi<++>?];hi +autocmd FileType sh inoremap ,ei elif[];then<++>?];hi +autocmd FileType sh inoremap ,sw case""in<++>)<++>;;<++>esac<++>?"i +autocmd FileType sh inoremap ,ca )<++>;;<++>?)i diff --git a/.config/nvim/plugin/standard-map.vim b/.config/nvim/plugin/standard-map.vim new file mode 100644 index 0000000..d794802 --- /dev/null +++ b/.config/nvim/plugin/standard-map.vim @@ -0,0 +1,64 @@ +map +imap + +" Basic file system commands +nnoremap :!touch +nnoremap :!crf +nnoremap :!mkdir +nnoremap :!mv% + +" Tab +nnoremap gt +nnoremap gT +nnoremap :tabnew +nnoremap :tabmove + +nnoremap :tabmove - + +" center screen after search +nnoremap n nzzzv +nnoremap N Nzzzv + +" Fix Y behaviour +nmap Y y$ + +" Fix indenting visual block +vmap < >gv + +" Enable and disable auto comment +map c :setlocal formatoptions-=cro +map C :setlocal formatoptions=cro + +" Enable spell checking, s for spell check +map s :setlocal spell! spelllang=en_au + +" Enable Disable Auto Indent +map i :setlocal autoindent +map I :setlocal noautoindent + +" Shell check +map p :!clear && shellcheck % + +" Compile and open output +map G :w! \| !comp % +map o :!opout % + +" Shortcutting split navigation +map h +map j +map k +map l + +" Tab shortcuts +nnoremap :tabp +nnoremap :tabn + +" Alias replace all to +nnoremap :%s//gI + +" Alias write and quit to Q +nnoremap q :wq +nnoremap w :w + +" Save file as sudo when no sudo permissions +cmap w!! w !sudo tee > /dev/null % diff --git a/.config/nvim/session/test.vim b/.config/nvim/session/test.vim new file mode 100644 index 0000000..511a87c --- /dev/null +++ b/.config/nvim/session/test.vim @@ -0,0 +1,77 @@ +let SessionLoad = 1 +let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0 +let v:this_session=expand(":p") +silent only +cd ~/ +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +set shortmess=aoO +badd +1 ~/.zshenv +badd +0 ~/.bash_profile +argglobal +%argdel +edit ~/.zshenv +set splitbelow splitright +wincmd _ | wincmd | +vsplit +1wincmd h +wincmd w +wincmd t +set winminheight=0 +set winheight=1 +set winminwidth=0 +set winwidth=1 +exe 'vert 1resize ' . ((&columns * 72 + 72) / 145) +exe 'vert 2resize ' . ((&columns * 72 + 72) / 145) +argglobal +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let s:l = 1 - ((0 * winheight(0) + 17) / 34) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +1 +normal! 0 +wincmd w +argglobal +if bufexists("~/.bash_profile") | buffer ~/.bash_profile | else | edit ~/.bash_profile | endif +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let s:l = 1 - ((0 * winheight(0) + 17) / 34) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +1 +normal! 01| +wincmd w +exe 'vert 1resize ' . ((&columns * 72 + 72) / 145) +exe 'vert 2resize ' . ((&columns * 72 + 72) / 145) +tabnext 1 +if exists('s:wipebuf') && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 winminheight=1 winminwidth=1 shortmess=filnxtToOFc +let s:sx = expand(":p:r")."x.vim" +if file_readable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &so = s:so_save | let &siso = s:siso_save +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/.config/nvim/session/workspace.vim b/.config/nvim/session/workspace.vim new file mode 100644 index 0000000..0848eb3 --- /dev/null +++ b/.config/nvim/session/workspace.vim @@ -0,0 +1,83 @@ +let SessionLoad = 1 +let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0 +let v:this_session=expand(":p") +silent only +cd ~/ +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +set shortmess=aoO +argglobal +%argdel +set splitbelow splitright +wincmd _ | wincmd | +vsplit +1wincmd h +wincmd w +wincmd _ | wincmd | +split +1wincmd k +wincmd w +wincmd t +set winminheight=0 +set winheight=1 +set winminwidth=0 +set winwidth=1 +exe 'vert 1resize ' . ((&columns * 72 + 72) / 145) +exe '2resize ' . ((&lines * 16 + 17) / 35) +exe 'vert 2resize ' . ((&columns * 72 + 72) / 145) +exe '3resize ' . ((&lines * 16 + 17) / 35) +exe 'vert 3resize ' . ((&columns * 72 + 72) / 145) +argglobal +enew +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +wincmd w +argglobal +enew +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +wincmd w +argglobal +enew +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +wincmd w +3wincmd w +exe 'vert 1resize ' . ((&columns * 72 + 72) / 145) +exe '2resize ' . ((&lines * 16 + 17) / 35) +exe 'vert 2resize ' . ((&columns * 72 + 72) / 145) +exe '3resize ' . ((&lines * 16 + 17) / 35) +exe 'vert 3resize ' . ((&columns * 72 + 72) / 145) +tabnext 1 +if exists('s:wipebuf') && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 winminheight=1 winminwidth=1 shortmess=filnxtToOFc +let s:sx = expand(":p:r")."x.vim" +if file_readable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &so = s:so_save | let &siso = s:siso_save +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/.config/nvim/shada/test.vim b/.config/nvim/shada/test.vim new file mode 100644 index 0000000..43841d4 Binary files /dev/null and b/.config/nvim/shada/test.vim differ diff --git a/.config/nvim/vim-code-dark b/.config/nvim/vim-code-dark new file mode 160000 index 0000000..e56e528 --- /dev/null +++ b/.config/nvim/vim-code-dark @@ -0,0 +1 @@ +Subproject commit e56e5285ecaf5d0df1a383c432bccdbc0d464b2f diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..0338ff2 --- /dev/null +++ b/.zshrc @@ -0,0 +1,126 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +# Use powerline +USE_POWERLINE="true" +# Source manjaro-zsh-configuration +if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then + source /usr/share/zsh/manjaro-zsh-config +fi +# Use manjaro zsh prompt +if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then + source /usr/share/zsh/manjaro-zsh-prompt +fi + +# vim: set ft=zsh sw=2 et : +# Via https://tanguy.ortolo.eu/blog/article25/shrc +# +# Zsh always executes zshenv. Then, depending on the case: +# - run as a login shell, it executes zprofile; +# - run as an interactive, it executes zshrc; +# - run as a login shell, it executes zlogin. +# +# At the end of a login session, it executes zlogout, but in reverse order, the +# user-specific file first, then the system-wide one, constituting a chiasmus +# with the zlogin files. + +# Thanks to https://github.com/elifarley/shellbase/blob/master/.zshrc +alias make='nocorrect make' + +setopt appendhistory +setopt autocd +setopt correct_all +setopt extendedglob +setopt hist_expire_dups_first +setopt hist_find_no_dups +setopt hist_ignore_all_dups +setopt hist_save_no_dups +setopt interactive_comments +setopt pushd_ignore_dups +setopt promptsubst + +# EMACS mode +bindkey -e +# TODO: This might be neat: http://unix.stackexchange.com/a/47425 +# TODO: Nice list of bindings: http://zshwiki.org/home/zle/bindkeys +# Make CTRL+Arrow skip words +# rxvt +bindkey "^[Od" backward-word +bindkey "^[Oc" forward-word +# xterm +bindkey "^[[1;5D" backward-word +bindkey "^[[1;5C" forward-word +# gnome-terminal +bindkey "^[OD" backward-word +bindkey "^[OC" forward-word + +# Ctrl+U to delete the current line before cursor +bindkey "^U" backward-kill-line +# Ctrl+Q to save the current command and switch to a new one +bindkey "^Q" push-line-or-edit + +# Ignore interactive commands from history +export HISTORY_IGNORE="(ls|bg|fg|pwd|exit|cd ..|cd -|pushd|popd)" + +# FIXME: check first if they are available +export LC_ALL=en_US.UTF-8 + +fpath=(/usr/share/zsh/vendor-completions/ $fpath) + +if [ -f $HOME/.nix-profile/init.zsh ]; then + source $HOME/.nix-profile/init.zsh + + zplug "plugins/ssh-agent", from:oh-my-zsh, ignore:oh-my-zsh.sh + # Load after ssh-agent + zplug "plugins/gpg-agent", from:oh-my-zsh, ignore:oh-my-zsh.sh + + zplug "oconnor663/zsh-sensible" + zplug "zsh-users/zsh-completions" + zplug "zsh-users/zsh-history-substring-search" + zplug "zsh-users/zsh-syntax-highlighting", defer:2 + + # Interactive Git + zplug 'wfxr/forgit' + + # Install plugins if there are plugins that have not been installed + if ! zplug check --verbose; then + printf "Install zsh plugins? [y/N]: " + if read -q; then + echo; zplug install + fi + fi + + # Then, source plugins and add commands to $PATH + zplug load # --verbose +fi + +test -r ~/.shell-common && source ~/.shell-common +test -r ~/.shell-env && source ~/.shell-env +test -r ~/.shell-aliases && source ~/.shell-aliases + +if [ -d $BREW_PREFIX ]; then + eval "$($BREW_PREFIX/bin/brew shellenv)" + fpath=($BREW_PREFIX/share/zsh/site-functions $fpath) +fi + +if [ -d $HOME/.nix-profile ]; then + . $HOME/.nix-profile/etc/profile.d/nix.sh + fpath=($HOME/.nix-profile/share/zsh/site-functions $fpath) +fi + +if [ -n "${commands[fzf-share]}" ]; then + source "$(fzf-share)/key-bindings.zsh" + source "$(fzf-share)/completion.zsh" +fi + +eval "$(direnv hook zsh)" +# Lean doesn't work great with Linux shell (in an actual tty), gonna check how +# this Starship behaves +eval "$(starship init zsh)" + +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh