diff --git a/2.vim b/2.vim index bd9b1711..40a9caa8 100644 --- a/2.vim +++ b/2.vim @@ -12,8 +12,10 @@ inoremap coc#pum#visible() ? coc#pum#next(0) : coc#inline inoremap coc#pum#visible() ? coc#pum#prev(1) : coc#inline#visible() ? coc#inline#prev() : "\" inoremap coc#pum#visible() ? coc#pum#next(1) : coc#inline#visible() ? coc#inline#next() : "\" nnoremap  :NERDTreeFind +snoremap  c nnoremap  :NERDTree nmap  (ctrlp) +snoremap  "_c nnoremap  :NERDTreeToggle xmap \T (table-mode-tableize-delimiter) xmap \tt (table-mode-tableize) @@ -26,6 +28,10 @@ nnoremap \1 :call SN("1") nmap \rn (coc-rename) xmap gx NetrwBrowseXVis nmap gx NetrwBrowseX +snoremap "_c +snoremap c +snoremap c +snoremap c nnoremap GitGutterPreviewHunk :call gitgutter#utility#warn('Please change your map GitGutterPreviewHunk to (GitGutterPreviewHunk)') nnoremap (GitGutterPreviewHunk) :GitGutterPreviewHunk nnoremap GitGutterUndoHunk :call gitgutter#utility#warn('Please change your map GitGutterUndoHunk to (GitGutterUndoHunk)') @@ -132,8 +138,6 @@ set shiftwidth=4 set smarttab set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.snap set updatetime=500 -set winminheight=0 -set winminwidth=0 let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 let v:this_session=expand(":p") silent only @@ -149,17 +153,14 @@ else endif badd +1 build/sw.js badd +1 build/version.txt -badd +135 src/Model/Chat/chatModel.ts -badd +211 src/ViewModel/Chat/chatViewModel.ts -badd +205 src/ViewModel/Chat/chatMessageViewModel.ts -badd +1 src/Model/Chat/chatListModel.ts -badd +1 src/ViewModel/Pages/settingsPageViewModel.ts +badd +87 src/Model/Global/fileTransferModel.ts +badd +1 node_modules/uuid/dist/parse.js +badd +246 src/Model/Utility/utility.ts +badd +0 src/Model/Global/storageModel.ts argglobal %argdel -$argadd src/ViewModel/Pages/settingsPageViewModel.ts set stal=2 tabnew +setlocal\ bufhidden=wipe -tabnew +setlocal\ bufhidden=wipe tabrewind edit build/sw.js let s:save_splitbelow = &splitbelow @@ -181,13 +182,13 @@ set winminheight=0 set winheight=1 set winminwidth=0 set winwidth=1 -exe 'vert 1resize ' . ((&columns * 31 + 103) / 207) -exe 'vert 2resize ' . ((&columns * 95 + 103) / 207) -exe 'vert 3resize ' . ((&columns * 95 + 103) / 207) +exe 'vert 1resize ' . ((&columns * 31 + 137) / 274) +exe 'vert 2resize ' . ((&columns * 120 + 137) / 274) +exe 'vert 3resize ' . ((&columns * 121 + 137) / 274) argglobal enew -file NERD_tree_tab_1 -balt build/sw.js +file NERD_tree_tab_2 +balt build/version.txt let s:cpo_save=&cpo set cpo&vim nnoremap :call nerdtree#ui_glue#invokeKeyMap("") @@ -210,14 +211,6 @@ nnoremap R :call nerdtree#ui_glue#invokeKeyMap("R") nnoremap T :call nerdtree#ui_glue#invokeKeyMap("T") nnoremap U :call nerdtree#ui_glue#invokeKeyMap("U") nnoremap X :call nerdtree#ui_glue#invokeKeyMap("X") -nmap [c (GitGutterPrevHunk) -nmap \hp (GitGutterPreviewHunk) -nmap \hu (GitGutterUndoHunk) -nmap \hs (GitGutterStageHunk) -xmap \hs (GitGutterStageHunk) -nmap ]c (GitGutterNextHunk) -xmap ac (GitGutterTextObjectOuterVisual) -omap ac (GitGutterTextObjectOuterPending) nnoremap cd :call nerdtree#ui_glue#invokeKeyMap("cd") nnoremap e :call nerdtree#ui_glue#invokeKeyMap("e") nnoremap f :call nerdtree#ui_glue#invokeKeyMap("f") @@ -225,8 +218,6 @@ nnoremap go :call nerdtree#ui_glue#invokeKeyMap("go") nnoremap gb :call nerdtree#ui_glue#invokeKeyMap("gb") nnoremap gi :call nerdtree#ui_glue#invokeKeyMap("gi") nnoremap gs :call nerdtree#ui_glue#invokeKeyMap("gs") -xmap ic (GitGutterTextObjectInnerVisual) -omap ic (GitGutterTextObjectInnerPending) nnoremap i :call nerdtree#ui_glue#invokeKeyMap("i") nnoremap m :call nerdtree#ui_glue#invokeKeyMap("m") nnoremap o :call nerdtree#ui_glue#invokeKeyMap("o") @@ -524,12 +515,12 @@ setlocal wrap setlocal wrapmargin=0 silent! normal! zE let &fdl = &fdl -let s:l = 1 - ((0 * winheight(0) + 16) / 33) +let s:l = 23 - ((22 * winheight(0) + 15) / 31) if s:l < 1 | let s:l = 1 | endif keepjumps exe s:l normal! zt -keepjumps 1 -normal! 032| +keepjumps 23 +normal! 028| wincmd w argglobal if bufexists(fnamemodify("build/version.txt", ":p")) | buffer build/version.txt | else | edit build/version.txt | endif @@ -681,27 +672,24 @@ setlocal wrap setlocal wrapmargin=0 silent! normal! zE let &fdl = &fdl -let s:l = 1 - ((0 * winheight(0) + 16) / 33) +let s:l = 1 - ((0 * winheight(0) + 15) / 31) if s:l < 1 | let s:l = 1 | endif keepjumps exe s:l normal! zt keepjumps 1 -normal! 014| +normal! 015| wincmd w -exe 'vert 1resize ' . ((&columns * 31 + 103) / 207) -exe 'vert 2resize ' . ((&columns * 95 + 103) / 207) -exe 'vert 3resize ' . ((&columns * 95 + 103) / 207) +exe 'vert 1resize ' . ((&columns * 31 + 137) / 274) +exe 'vert 2resize ' . ((&columns * 120 + 137) / 274) +exe 'vert 3resize ' . ((&columns * 121 + 137) / 274) tabnext -edit src/Model/Chat/chatListModel.ts +edit src/Model/Global/fileTransferModel.ts let s:save_splitbelow = &splitbelow let s:save_splitright = &splitright set splitbelow splitright wincmd _ | wincmd | vsplit -wincmd _ | wincmd | -vsplit -2wincmd h -wincmd w +1wincmd h wincmd w let &splitbelow = s:save_splitbelow let &splitright = s:save_splitright @@ -712,192 +700,10 @@ set winminheight=0 set winheight=1 set winminwidth=0 set winwidth=1 -exe 'vert 1resize ' . ((&columns * 31 + 103) / 207) -exe 'vert 2resize ' . ((&columns * 87 + 103) / 207) -exe 'vert 3resize ' . ((&columns * 87 + 103) / 207) +exe 'vert 1resize ' . ((&columns * 136 + 137) / 274) +exe 'vert 2resize ' . ((&columns * 137 + 137) / 274) argglobal -enew -file NERD_tree_tab_2 -let s:cpo_save=&cpo -set cpo&vim -nnoremap :call nerdtree#ui_glue#invokeKeyMap("") -nnoremap  :call nerdtree#ui_glue#invokeKeyMap("") -nnoremap  :call nerdtree#ui_glue#invokeKeyMap("") -nnoremap ? :call nerdtree#ui_glue#invokeKeyMap("?") -nnoremap A :call nerdtree#ui_glue#invokeKeyMap("A") -nnoremap B :call nerdtree#ui_glue#invokeKeyMap("B") -nnoremap C :call nerdtree#ui_glue#invokeKeyMap("C") -nnoremap CD :call nerdtree#ui_glue#invokeKeyMap("CD") -nnoremap D :call nerdtree#ui_glue#invokeKeyMap("D") -nnoremap FL :call nerdtree#ui_glue#invokeKeyMap("FL") -nnoremap F :call nerdtree#ui_glue#invokeKeyMap("F") -nnoremap I :call nerdtree#ui_glue#invokeKeyMap("I") -nnoremap J :call nerdtree#ui_glue#invokeKeyMap("J") -nnoremap K :call nerdtree#ui_glue#invokeKeyMap("K") -nnoremap O :call nerdtree#ui_glue#invokeKeyMap("O") -nnoremap P :call nerdtree#ui_glue#invokeKeyMap("P") -nnoremap R :call nerdtree#ui_glue#invokeKeyMap("R") -nnoremap T :call nerdtree#ui_glue#invokeKeyMap("T") -nnoremap U :call nerdtree#ui_glue#invokeKeyMap("U") -nnoremap X :call nerdtree#ui_glue#invokeKeyMap("X") -nnoremap cd :call nerdtree#ui_glue#invokeKeyMap("cd") -nnoremap e :call nerdtree#ui_glue#invokeKeyMap("e") -nnoremap f :call nerdtree#ui_glue#invokeKeyMap("f") -nnoremap go :call nerdtree#ui_glue#invokeKeyMap("go") -nnoremap gb :call nerdtree#ui_glue#invokeKeyMap("gb") -nnoremap gi :call nerdtree#ui_glue#invokeKeyMap("gi") -nnoremap gs :call nerdtree#ui_glue#invokeKeyMap("gs") -nnoremap i :call nerdtree#ui_glue#invokeKeyMap("i") -nnoremap m :call nerdtree#ui_glue#invokeKeyMap("m") -nnoremap o :call nerdtree#ui_glue#invokeKeyMap("o") -nnoremap p :call nerdtree#ui_glue#invokeKeyMap("p") -nnoremap q :call nerdtree#ui_glue#invokeKeyMap("q") -nnoremap r :call nerdtree#ui_glue#invokeKeyMap("r") -nnoremap s :call nerdtree#ui_glue#invokeKeyMap("s") -nnoremap t :call nerdtree#ui_glue#invokeKeyMap("t") -nnoremap u :call nerdtree#ui_glue#invokeKeyMap("u") -nnoremap x :call nerdtree#ui_glue#invokeKeyMap("x") -nnoremap :call nerdtree#ui_glue#invokeKeyMap("") -nnoremap <2-LeftMouse> :call nerdtree#ui_glue#invokeKeyMap("<2-LeftMouse>") -nnoremap :call nerdtree#ui_glue#invokeKeyMap("") -nnoremap :call nerdtree#ui_glue#invokeKeyMap("") -nnoremap :call nerdtree#ui_glue#invokeKeyMap("") -let &cpo=s:cpo_save -unlet s:cpo_save -setlocal keymap= -setlocal noarabic -setlocal noautoindent -setlocal backupcopy= -setlocal balloonexpr= -setlocal nobinary -setlocal nobreakindent -setlocal breakindentopt= -setlocal bufhidden=hide -setlocal nobuflisted -setlocal buftype=nofile -setlocal nocindent -setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e -setlocal cinoptions= -setlocal cinscopedecls=public,protected,private -setlocal cinwords=if,else,while,do,for,switch -setlocal colorcolumn= -setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:- -setlocal commentstring=/*%s*/ -setlocal complete=.,w,b,u,t,i -setlocal concealcursor=nvic -setlocal conceallevel=2 -setlocal completefunc= -setlocal nocopyindent -setlocal cryptmethod= -setlocal nocursorbind -setlocal nocursorcolumn -setlocal cursorline -setlocal cursorlineopt=both -setlocal define= -setlocal dictionary= -setlocal nodiff -setlocal equalprg= -setlocal errorformat= -setlocal noexpandtab -if &filetype != 'nerdtree' -setlocal filetype=nerdtree -endif -setlocal fillchars= -setlocal fixendofline -setlocal foldcolumn=0 -setlocal nofoldenable -setlocal foldexpr=0 -setlocal foldignore=# -setlocal foldlevel=0 -setlocal foldmarker={{{,}}} -setlocal foldmethod=manual -setlocal foldminlines=1 -setlocal foldnestmax=20 -setlocal foldtext=foldtext() -setlocal formatexpr= -setlocal formatoptions=tcq -setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s* -setlocal formatprg= -setlocal grepprg= -setlocal iminsert=0 -setlocal imsearch=-1 -setlocal include= -setlocal includeexpr= -setlocal indentexpr= -setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e -setlocal noinfercase -setlocal iskeyword=@,48-57,_,192-255 -setlocal keywordprg= -setlocal nolinebreak -setlocal nolisp -setlocal lispoptions= -setlocal lispwords= -setlocal nolist -setlocal listchars= -setlocal makeencoding= -setlocal makeprg= -setlocal matchpairs=(:),{:},[:] -setlocal nomodeline -setlocal nomodifiable -setlocal nrformats=bin,octal,hex -set number -setlocal nonumber -setlocal numberwidth=4 -setlocal omnifunc= -setlocal path= -setlocal nopreserveindent -setlocal nopreviewwindow -setlocal quoteescape=\\ -setlocal readonly -setlocal norelativenumber -setlocal norightleft -setlocal rightleftcmd=search -setlocal noscrollbind -setlocal scrolloff=-1 -setlocal shiftwidth=4 -setlocal noshortname -setlocal showbreak= -setlocal sidescrolloff=-1 -set signcolumn=yes -setlocal signcolumn=yes -setlocal nosmartindent -setlocal nosmoothscroll -setlocal softtabstop=0 -setlocal nospell -setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+ -setlocal spellfile= -setlocal spelllang=en -setlocal spelloptions= -setlocal statusline=%{exists('b:NERDTree')?b:NERDTree.root.path.str():''} -setlocal suffixesadd= -setlocal noswapfile -setlocal synmaxcol=3000 -if &syntax != 'nerdtree' -setlocal syntax=nerdtree -endif -setlocal tabstop=8 -setlocal tagcase= -setlocal tagfunc= -setlocal tags= -setlocal termwinkey= -setlocal termwinscroll=10000 -setlocal termwinsize= -setlocal textwidth=0 -setlocal thesaurus= -setlocal thesaurusfunc= -setlocal noundofile -setlocal undolevels=-123456 -setlocal varsofttabstop= -setlocal vartabstop= -setlocal virtualedit= -setlocal wincolor= -setlocal nowinfixheight -setlocal winfixwidth -setlocal nowrap -setlocal wrapmargin=0 -wincmd w -argglobal -balt src/ViewModel/Chat/chatMessageViewModel.ts +balt build/sw.js let s:cpo_save=&cpo set cpo&vim nmap [c (GitGutterPrevHunk) @@ -1045,331 +851,173 @@ setlocal wrap setlocal wrapmargin=0 silent! normal! zE let &fdl = &fdl -let s:l = 105 - ((0 * winheight(0) + 16) / 33) +let s:l = 115 - ((15 * winheight(0) + 15) / 31) if s:l < 1 | let s:l = 1 | endif keepjumps exe s:l normal! zt -keepjumps 105 -normal! $ -wincmd w -argglobal -if bufexists(fnamemodify("src/Model/Chat/chatModel.ts", ":p")) | buffer src/Model/Chat/chatModel.ts | else | edit src/Model/Chat/chatModel.ts | endif -balt src/Model/Chat/chatListModel.ts -let s:cpo_save=&cpo -set cpo&vim -nmap [c (GitGutterPrevHunk) -nmap \hp (GitGutterPreviewHunk) -nmap \hu (GitGutterUndoHunk) -nmap \hs (GitGutterStageHunk) -xmap \hs (GitGutterStageHunk) -nmap ]c (GitGutterNextHunk) -xmap ac (GitGutterTextObjectOuterVisual) -omap ac (GitGutterTextObjectOuterPending) -xmap ic (GitGutterTextObjectInnerVisual) -omap ic (GitGutterTextObjectInnerPending) -let &cpo=s:cpo_save -unlet s:cpo_save -setlocal keymap= -setlocal noarabic -setlocal autoindent -setlocal backupcopy= -setlocal balloonexpr= -setlocal nobinary -setlocal nobreakindent -setlocal breakindentopt= -setlocal bufhidden= -setlocal buflisted -setlocal buftype= -setlocal nocindent -setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e -setlocal cinoptions= -setlocal cinscopedecls=public,protected,private -setlocal cinwords=if,else,while,do,for,switch -setlocal colorcolumn= -setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:- -setlocal commentstring=//\ %s -setlocal complete=.,w,b,u,t,i -setlocal concealcursor= -setlocal conceallevel=0 -setlocal completefunc= -setlocal nocopyindent -setlocal cryptmethod= -setlocal nocursorbind -setlocal nocursorcolumn -setlocal nocursorline -setlocal cursorlineopt=both -setlocal define= -setlocal dictionary= -setlocal nodiff -setlocal equalprg= -setlocal errorformat=%+A\ %#%f\ %#(%l\\,%c):\ %m,%C%m -setlocal noexpandtab -if &filetype != 'typescript' -setlocal filetype=typescript -endif -setlocal fillchars= -setlocal fixendofline -setlocal foldcolumn=0 -setlocal foldenable -setlocal foldexpr=0 -setlocal foldignore=# -setlocal foldlevel=0 -setlocal foldmarker={{{,}}} -setlocal foldmethod=manual -setlocal foldminlines=1 -setlocal foldnestmax=20 -setlocal foldtext=foldtext() -setlocal formatexpr= -setlocal formatoptions=croql -setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s* -setlocal formatprg= -setlocal grepprg= -setlocal iminsert=0 -setlocal imsearch=-1 -setlocal include= -setlocal includeexpr= -setlocal indentexpr=GetTypescriptIndent() -setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e,0],0) -setlocal noinfercase -setlocal iskeyword=@,48-57,_,192-255,$ -setlocal keywordprg= -setlocal nolinebreak -setlocal nolisp -setlocal lispoptions= -setlocal lispwords= -setlocal nolist -setlocal listchars= -setlocal makeencoding= -setlocal makeprg=tsc\ \ $*\ % -setlocal matchpairs=(:),{:},[:] -setlocal nomodeline -setlocal modifiable -setlocal nrformats=bin,octal,hex -set number -setlocal number -setlocal numberwidth=4 -setlocal omnifunc= -setlocal path= -setlocal nopreserveindent -setlocal nopreviewwindow -setlocal quoteescape=\\ -setlocal noreadonly -setlocal norelativenumber -setlocal norightleft -setlocal rightleftcmd=search -setlocal noscrollbind -setlocal scrolloff=-1 -setlocal shiftwidth=4 -setlocal noshortname -setlocal showbreak= -setlocal sidescrolloff=-1 -set signcolumn=yes -setlocal signcolumn=yes -setlocal nosmartindent -setlocal nosmoothscroll -setlocal softtabstop=0 -setlocal nospell -setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+ -setlocal spellfile= -setlocal spelllang=en -setlocal spelloptions= -setlocal statusline= -setlocal suffixesadd=.ts,.tsx -setlocal swapfile -setlocal synmaxcol=3000 -if &syntax != 'typescript' -setlocal syntax=typescript -endif -setlocal tabstop=8 -setlocal tagcase= -setlocal tagfunc= -setlocal tags= -setlocal termwinkey= -setlocal termwinscroll=10000 -setlocal termwinsize= -setlocal textwidth=0 -setlocal thesaurus= -setlocal thesaurusfunc= -setlocal noundofile -setlocal undolevels=-123456 -setlocal varsofttabstop= -setlocal vartabstop= -setlocal virtualedit= -setlocal wincolor= -setlocal nowinfixheight -setlocal nowinfixwidth -setlocal wrap -setlocal wrapmargin=0 -silent! normal! zE -let &fdl = &fdl -let s:l = 56 - ((20 * winheight(0) + 16) / 33) -if s:l < 1 | let s:l = 1 | endif -keepjumps exe s:l -normal! zt -keepjumps 56 -normal! $ -wincmd w -3wincmd w -exe 'vert 1resize ' . ((&columns * 31 + 103) / 207) -exe 'vert 2resize ' . ((&columns * 87 + 103) / 207) -exe 'vert 3resize ' . ((&columns * 87 + 103) / 207) -tabnext -edit src/ViewModel/Pages/settingsPageViewModel.ts -argglobal -balt src/Model/Chat/chatModel.ts -let s:cpo_save=&cpo -set cpo&vim -nmap [c (GitGutterPrevHunk) -nmap \hp (GitGutterPreviewHunk) -nmap \hu (GitGutterUndoHunk) -nmap \hs (GitGutterStageHunk) -xmap \hs (GitGutterStageHunk) -nmap ]c (GitGutterNextHunk) -xmap ac (GitGutterTextObjectOuterVisual) -omap ac (GitGutterTextObjectOuterPending) -xmap ic (GitGutterTextObjectInnerVisual) -omap ic (GitGutterTextObjectInnerPending) -let &cpo=s:cpo_save -unlet s:cpo_save -setlocal keymap= -setlocal noarabic -setlocal autoindent -setlocal backupcopy= -setlocal balloonexpr= -setlocal nobinary -setlocal nobreakindent -setlocal breakindentopt= -setlocal bufhidden= -setlocal buflisted -setlocal buftype= -setlocal nocindent -setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e -setlocal cinoptions= -setlocal cinscopedecls=public,protected,private -setlocal cinwords=if,else,while,do,for,switch -setlocal colorcolumn= -setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:- -setlocal commentstring=//\ %s -setlocal complete=.,w,b,u,t,i -setlocal concealcursor= -setlocal conceallevel=0 -setlocal completefunc= -setlocal nocopyindent -setlocal cryptmethod= -setlocal nocursorbind -setlocal nocursorcolumn -setlocal nocursorline -setlocal cursorlineopt=both -setlocal define= -setlocal dictionary= -setlocal nodiff -setlocal equalprg= -setlocal errorformat=%+A\ %#%f\ %#(%l\\,%c):\ %m,%C%m -setlocal noexpandtab -if &filetype != 'typescript' -setlocal filetype=typescript -endif -setlocal fillchars= -setlocal fixendofline -setlocal foldcolumn=0 -setlocal foldenable -setlocal foldexpr=0 -setlocal foldignore=# -setlocal foldlevel=0 -setlocal foldmarker={{{,}}} -setlocal foldmethod=manual -setlocal foldminlines=1 -setlocal foldnestmax=20 -setlocal foldtext=foldtext() -setlocal formatexpr= -setlocal formatoptions=croql -setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s* -setlocal formatprg= -setlocal grepprg= -setlocal iminsert=0 -setlocal imsearch=-1 -setlocal include= -setlocal includeexpr= -setlocal indentexpr=GetTypescriptIndent() -setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e,0],0) -setlocal noinfercase -setlocal iskeyword=@,48-57,_,192-255,$ -setlocal keywordprg= -setlocal nolinebreak -setlocal nolisp -setlocal lispoptions= -setlocal lispwords= -setlocal nolist -setlocal listchars= -setlocal makeencoding= -setlocal makeprg=tsc\ \ $*\ % -setlocal matchpairs=(:),{:},[:] -setlocal nomodeline -setlocal modifiable -setlocal nrformats=bin,octal,hex -set number -setlocal number -setlocal numberwidth=4 -setlocal omnifunc= -setlocal path= -setlocal nopreserveindent -setlocal nopreviewwindow -setlocal quoteescape=\\ -setlocal noreadonly -setlocal norelativenumber -setlocal norightleft -setlocal rightleftcmd=search -setlocal noscrollbind -setlocal scrolloff=-1 -setlocal shiftwidth=4 -setlocal noshortname -setlocal showbreak= -setlocal sidescrolloff=-1 -set signcolumn=yes -setlocal signcolumn=yes -setlocal nosmartindent -setlocal nosmoothscroll -setlocal softtabstop=0 -setlocal nospell -setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+ -setlocal spellfile= -setlocal spelllang=en -setlocal spelloptions= -setlocal statusline= -setlocal suffixesadd=.ts,.tsx -setlocal swapfile -setlocal synmaxcol=3000 -if &syntax != 'typescript' -setlocal syntax=typescript -endif -setlocal tabstop=8 -setlocal tagcase= -setlocal tagfunc= -setlocal tags= -setlocal termwinkey= -setlocal termwinscroll=10000 -setlocal termwinsize= -setlocal textwidth=0 -setlocal thesaurus= -setlocal thesaurusfunc= -setlocal noundofile -setlocal undolevels=-123456 -setlocal varsofttabstop= -setlocal vartabstop= -setlocal virtualedit= -setlocal wincolor= -setlocal nowinfixheight -setlocal nowinfixwidth -setlocal wrap -setlocal wrapmargin=0 -silent! normal! zE -let &fdl = &fdl -let s:l = 1 - ((0 * winheight(0) + 17) / 34) -if s:l < 1 | let s:l = 1 | endif -keepjumps exe s:l -normal! zt -keepjumps 1 +keepjumps 115 normal! 0 +wincmd w +argglobal +if bufexists(fnamemodify("src/Model/Global/storageModel.ts", ":p")) | buffer src/Model/Global/storageModel.ts | else | edit src/Model/Global/storageModel.ts | endif +balt src/Model/Utility/utility.ts +let s:cpo_save=&cpo +set cpo&vim +nmap [c (GitGutterPrevHunk) +nmap \hp (GitGutterPreviewHunk) +nmap \hu (GitGutterUndoHunk) +nmap \hs (GitGutterStageHunk) +xmap \hs (GitGutterStageHunk) +nmap ]c (GitGutterNextHunk) +xmap ac (GitGutterTextObjectOuterVisual) +omap ac (GitGutterTextObjectOuterPending) +xmap ic (GitGutterTextObjectInnerVisual) +omap ic (GitGutterTextObjectInnerPending) +let &cpo=s:cpo_save +unlet s:cpo_save +setlocal keymap= +setlocal noarabic +setlocal autoindent +setlocal backupcopy= +setlocal balloonexpr= +setlocal nobinary +setlocal nobreakindent +setlocal breakindentopt= +setlocal bufhidden= +setlocal buflisted +setlocal buftype= +setlocal nocindent +setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e +setlocal cinoptions= +setlocal cinscopedecls=public,protected,private +setlocal cinwords=if,else,while,do,for,switch +setlocal colorcolumn= +setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:- +setlocal commentstring=//\ %s +setlocal complete=.,w,b,u,t,i +setlocal concealcursor= +setlocal conceallevel=0 +setlocal completefunc= +setlocal nocopyindent +setlocal cryptmethod= +setlocal nocursorbind +setlocal nocursorcolumn +setlocal nocursorline +setlocal cursorlineopt=both +setlocal define= +setlocal dictionary= +setlocal nodiff +setlocal equalprg= +setlocal errorformat=%+A\ %#%f\ %#(%l\\,%c):\ %m,%C%m +setlocal noexpandtab +if &filetype != 'typescript' +setlocal filetype=typescript +endif +setlocal fillchars= +setlocal fixendofline +setlocal foldcolumn=0 +setlocal foldenable +setlocal foldexpr=0 +setlocal foldignore=# +setlocal foldlevel=0 +setlocal foldmarker={{{,}}} +setlocal foldmethod=manual +setlocal foldminlines=1 +setlocal foldnestmax=20 +setlocal foldtext=foldtext() +setlocal formatexpr= +setlocal formatoptions=croql +setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s* +setlocal formatprg= +setlocal grepprg= +setlocal iminsert=0 +setlocal imsearch=-1 +setlocal include= +setlocal includeexpr= +setlocal indentexpr=GetTypescriptIndent() +setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e,0],0) +setlocal noinfercase +setlocal iskeyword=@,48-57,_,192-255,$ +setlocal keywordprg= +setlocal nolinebreak +setlocal nolisp +setlocal lispoptions= +setlocal lispwords= +setlocal nolist +setlocal listchars= +setlocal makeencoding= +setlocal makeprg=tsc\ \ $*\ % +setlocal matchpairs=(:),{:},[:] +setlocal nomodeline +setlocal modifiable +setlocal nrformats=bin,octal,hex +set number +setlocal number +setlocal numberwidth=4 +setlocal omnifunc= +setlocal path= +setlocal nopreserveindent +setlocal nopreviewwindow +setlocal quoteescape=\\ +setlocal noreadonly +setlocal norelativenumber +setlocal norightleft +setlocal rightleftcmd=search +setlocal noscrollbind +setlocal scrolloff=-1 +setlocal shiftwidth=4 +setlocal noshortname +setlocal showbreak= +setlocal sidescrolloff=-1 +set signcolumn=yes +setlocal signcolumn=yes +setlocal nosmartindent +setlocal nosmoothscroll +setlocal softtabstop=0 +setlocal nospell +setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+ +setlocal spellfile= +setlocal spelllang=en +setlocal spelloptions= +setlocal statusline= +setlocal suffixesadd=.ts,.tsx +setlocal swapfile +setlocal synmaxcol=3000 +if &syntax != 'typescript' +setlocal syntax=typescript +endif +setlocal tabstop=8 +setlocal tagcase= +setlocal tagfunc= +setlocal tags= +setlocal termwinkey= +setlocal termwinscroll=10000 +setlocal termwinsize= +setlocal textwidth=0 +setlocal thesaurus= +setlocal thesaurusfunc= +setlocal noundofile +setlocal undolevels=-123456 +setlocal varsofttabstop= +setlocal vartabstop= +setlocal virtualedit= +setlocal wincolor= +setlocal nowinfixheight +setlocal nowinfixwidth +setlocal wrap +setlocal wrapmargin=0 +silent! normal! zE +let &fdl = &fdl +let s:l = 220 - ((16 * winheight(0) + 15) / 31) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 220 +normal! 027| +wincmd w +2wincmd w +exe 'vert 1resize ' . ((&columns * 136 + 137) / 274) +exe 'vert 2resize ' . ((&columns * 137 + 137) / 274) tabnext 2 set stal=1 if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 @@ -1385,7 +1033,6 @@ if filereadable(s:sx) exe "source " . fnameescape(s:sx) endif let &g:so = s:so_save | let &g:siso = s:siso_save -nohlsearch doautoall SessionLoadPost unlet SessionLoad " vim: set ft=vim : diff --git a/src/Model/Chat/chatModel.ts b/src/Model/Chat/chatModel.ts index c9fc7dde..b78d39be 100644 --- a/src/Model/Chat/chatModel.ts +++ b/src/Model/Chat/chatModel.ts @@ -166,7 +166,7 @@ export default class ChatModel { // message if (chatMessage.body != "") { - const messagePath: string[] = this.getMessagePath(chatMessage.id); + const messagePath: string[] = this.getMessagePath(chatMessage.fileId); this.storageModel.writeStringifiable(messagePath, chatMessage); this.chatMessageHandlerManager.trigger(chatMessage); } @@ -210,7 +210,7 @@ export default class ChatModel { this.addMessage(chatMessage); this.connectionModel.sendMessageOrStore(chatMessage); - return chatMessage.id; + return chatMessage.fileId; }; readonly decryptMessage = async ( @@ -397,10 +397,10 @@ export default class ChatModel { inlineReplyId?: string, fileContent?: FileContent, ): Promise => { - const chatMessage: ChatMessage = { - dataVersion: DATA_VERSION, + const messageFileContent = FileModel.createFileContent(v4(), "message"); - id: v4(), + const chatMessage: ChatMessage = { + ...messageFileContent, channel, senderName, @@ -488,9 +488,7 @@ export enum ChatMessageStatuses { Other = "other", } -export interface ChatMessage extends ValidObject { - readonly id: string; - +export interface ChatMessage extends FileContent<"message"> { readonly channel: string; readonly senderId: string; readonly senderName: string; @@ -504,7 +502,7 @@ export interface ChatMessage extends ValidObject { } export interface ChatMessageReaction - extends ValidObject, FileContent<"reaction"> { + extends FileContent<"reaction"> { readonly messageId: string; readonly senderId: string; readonly senderName: string; @@ -533,8 +531,11 @@ export const ChatInfoReference: ChatInfoFileContent = { export const ChatMessageReference: ChatMessage = { dataVersion: DATA_VERSION, - - id: "", + + fileId: "", + fileContentId: "", + creationDate: "", + type: "message", channel: "", senderName: "", diff --git a/src/Model/Global/connectionModel.ts b/src/Model/Global/connectionModel.ts index 74ac3b6e..f4283d54 100644 --- a/src/Model/Global/connectionModel.ts +++ b/src/Model/Global/connectionModel.ts @@ -149,12 +149,12 @@ export default class ConnectionModel { }; readonly addToOutbox = (chatMessage: ChatMessage): void => { - const messagePath: string[] = [...this.getOutboxPath(), chatMessage.id]; + const messagePath: string[] = [...this.getOutboxPath(), chatMessage.fileId]; this.storageModel.writeStringifiable(messagePath, chatMessage); }; readonly removeFromOutbox = (chatMessage: ChatMessage): void => { - const messagePath: string[] = [...this.getOutboxPath(), chatMessage.id]; + const messagePath: string[] = [...this.getOutboxPath(), chatMessage.fileId]; this.storageModel.remove(messagePath); }; diff --git a/src/Model/Global/fileTransferModel.ts b/src/Model/Global/fileTransferModel.ts index c9d98bda..d37f2759 100644 --- a/src/Model/Global/fileTransferModel.ts +++ b/src/Model/Global/fileTransferModel.ts @@ -104,6 +104,7 @@ export default class FileTransferModel { readonly handleDecryptedFile = (data: string): void => { const parsed: any = parse(data); + const isFileData: boolean = checkMatchesObjectStructure( parsed, FileDataReference, @@ -111,6 +112,7 @@ export default class FileTransferModel { if (isFileData == false) throw "not file data"; const fileData: FileData = parsed; + this.storageModel.write(fileData.path, fileData.body); const pathString: string = StorageModel.pathComponentsToString( diff --git a/src/Model/Global/storageModel.ts b/src/Model/Global/storageModel.ts index 68924682..b8ac0f15 100644 --- a/src/Model/Global/storageModel.ts +++ b/src/Model/Global/storageModel.ts @@ -1,6 +1,7 @@ import { bytesToMB, localeCompare, + parse, parseValidObject, stringify, } from "../Utility/utility"; @@ -214,46 +215,61 @@ export default class StorageModel { return stringify(this.storageEntryTree); }; + // upgrade + readonly upgrade = (): void => { + const v2To2610 = () => { + this.recurse(["v2"], (path) => { + const body = this.read(path); + if (!body) return; + const parsed = parse(body); + console.log(parsed.type); + }); + } + + v2To2610(); + } + // init constructor() { this.initializeTree(); + this.upgrade(); } // utility static getFileName = (pathComponents: string[]): string => { - return pathComponents[pathComponents.length - 1] || "\\"; + return pathComponents[pathComponents.length - 1] || "\\"; }; static getFileNameFromString = (pathString: string): string => { - const pathComponents: string[] = - this.stringToPathComponents(pathString); - return pathComponents[pathComponents.length - 1] || "\\"; + const pathComponents: string[] = + this.stringToPathComponents(pathString); + return pathComponents[pathComponents.length - 1] || "\\"; }; static pathComponentsToString = (...pathComponents: string[]): string => { - return pathComponents - .filter((x) => x != "") - .join(PATH_COMPONENT_SEPARATOR); + return pathComponents + .filter((x) => x != "") + .join(PATH_COMPONENT_SEPARATOR); }; static stringToPathComponents = (string: string): string[] => { - return string.split(PATH_COMPONENT_SEPARATOR).filter((x) => x != ""); + return string.split(PATH_COMPONENT_SEPARATOR).filter((x) => x != ""); }; static join = (...items: string[]): string => { - let allComponents: string[] = []; - for (const item of items) { - const parts = this.stringToPathComponents(item); - allComponents.push(...parts); - } - return StorageModel.pathComponentsToString(...allComponents); + let allComponents: string[] = []; + for (const item of items) { + const parts = this.stringToPathComponents(item); + allComponents.push(...parts); + } + return StorageModel.pathComponentsToString(...allComponents); }; static getPath( - locationName: StorageModelSubPaths, - filePath: string[], + locationName: StorageModelSubPaths, + filePath: string[], ): string[] { - return [DATA_VERSION, locationName, ...filePath]; + return [DATA_VERSION, locationName, ...filePath]; } } @@ -264,52 +280,52 @@ export type StorageEntry = { [key: string]: StorageEntry }; export enum StorageModelSubPaths { Chat = "chat", - ConnectionModel = "connection", - NotificationModel = "notifications", - SettingsModel = "settings", - ContactsModel = "contacts", + ConnectionModel = "connection", + NotificationModel = "notifications", + SettingsModel = "settings", + ContactsModel = "contacts", } export const filePaths = { connectionModel: { - socketAddress: ["socket-address"], - reconnectAddress: ["reconnect-address"], - outbox: ["outbox"], - mailboxes: ["mailboxes"], + socketAddress: ["socket-address"], + reconnectAddress: ["reconnect-address"], + outbox: ["outbox"], + mailboxes: ["mailboxes"], - previousAddresses: ["previous-addresses"], + previousAddresses: ["previous-addresses"], }, chat: { - base: [], - chatBase: (id: string) => [id], - info: (id: string) => [...filePaths.chat.chatBase(id), "info"], - color: (id: string) => [...filePaths.chat.chatBase(id), "color"], - messages: (id: string) => [...filePaths.chat.chatBase(id), "messages"], - reactions: (id: string) => [ - ...filePaths.chat.chatBase(id), - "reactions", - ], - previousFilter: (id: string) => [ - ...filePaths.chat.chatBase(id), - "previous-filter", - ], - lastUsedPage: (id: string) => [ - ...filePaths.chat.chatBase(id), - "last-used-page", - ], - files: (id: string) => [...filePaths.chat.chatBase(id), "files"], + base: [], + chatBase: (id: string) => [id], + info: (id: string) => [...filePaths.chat.chatBase(id), "info"], + color: (id: string) => [...filePaths.chat.chatBase(id), "color"], + messages: (id: string) => [...filePaths.chat.chatBase(id), "messages"], + reactions: (id: string) => [ + ...filePaths.chat.chatBase(id), + "reactions", + ], + previousFilter: (id: string) => [ + ...filePaths.chat.chatBase(id), + "previous-filter", + ], + lastUsedPage: (id: string) => [ + ...filePaths.chat.chatBase(id), + "last-used-page", + ], + files: (id: string) => [...filePaths.chat.chatBase(id), "files"], }, notificationModel: { - base: [], + base: [], }, settingsModel: { - username: ["user-name"], - userid: ["user-id"], - firstDayOfWeek: ["first-day-of-week"], - language: ["language"], - theme: ["theme"], + username: ["user-name"], + userid: ["user-id"], + firstDayOfWeek: ["first-day-of-week"], + language: ["language"], + theme: ["theme"], }, }; diff --git a/src/View/Components/inlineReply.tsx b/src/View/Components/inlineReply.tsx index 8863141f..31442298 100644 --- a/src/View/Components/inlineReply.tsx +++ b/src/View/Components/inlineReply.tsx @@ -7,7 +7,7 @@ export function InlineReply(chatMessageViewModel: ChatMessageViewModel) { if (reply == undefined) return
; const scroll = () => { - ViewController.scrollToView(reply.chatMessage.id); + ViewController.scrollToView(reply.chatMessage.fileId); }; return ( diff --git a/src/ViewModel/Chat/chatMessageViewModel.ts b/src/ViewModel/Chat/chatMessageViewModel.ts index 9d96d270..0090d592 100644 --- a/src/ViewModel/Chat/chatMessageViewModel.ts +++ b/src/ViewModel/Chat/chatMessageViewModel.ts @@ -175,7 +175,7 @@ export default class ChatMessageViewModel { sendReaction = (content: ReactionSymbols, isDeleting: boolean): void => { this.messagePageViewModel.sendReaction( - this.chatMessage.id, + this.chatMessage.fileId, content, isDeleting, ); @@ -194,7 +194,7 @@ export default class ChatMessageViewModel { this.messagePageViewModel.chatMessageViewModels.value.get( this.chatMessage.inlineReplyId, ); - this.inlineReply?.replies.set(this.chatMessage.id, this); + this.inlineReply?.replies.set(this.chatMessage.fileId, this); } }; diff --git a/src/ViewModel/Global/notificationViewModel.ts b/src/ViewModel/Global/notificationViewModel.ts index f88dfba9..8bdb0ac7 100644 --- a/src/ViewModel/Global/notificationViewModel.ts +++ b/src/ViewModel/Global/notificationViewModel.ts @@ -13,7 +13,7 @@ export default class NotificationViewModel { // main showNotification = (message: ChatMessage): void => { - if (this.seenMessageIds.has(message.id)) return; + if (this.seenMessageIds.has(message.fileId)) return; if (this.chatListViewModel.selectedChat.value == undefined) return; const notification: Notification = this.createNotification(message); @@ -84,7 +84,7 @@ export default class NotificationViewModel { const fullChannel = ChatModel.splitChannel(message.channel)[0]; const chat = this.chatListViewModel.getDisplayName(fullChannel); return { - messageId: message.id, + messageId: message.fileId, chat, fullChannel, sender: message.senderName, diff --git a/src/ViewModel/Pages/messagePageViewModel.ts b/src/ViewModel/Pages/messagePageViewModel.ts index f306c959..5865a323 100644 --- a/src/ViewModel/Pages/messagePageViewModel.ts +++ b/src/ViewModel/Pages/messagePageViewModel.ts @@ -59,7 +59,7 @@ export default class MessagePageViewModel extends Context { sendMessageFromBody = (body: string): Promise => { let replyId: string | undefined = undefined; if (this.replyingMessage.value) { - replyId = this.replyingMessage.value.chatMessage.id; + replyId = this.replyingMessage.value.chatMessage.fileId; } const id = this.chatViewModel.chatModel.sendMessage(body, replyId); @@ -118,13 +118,13 @@ export default class MessagePageViewModel extends Context { ); const existingChatMessageViewModel: ChatMessageViewModel | undefined = - this.chatMessageViewModels.value.get(chatMessage.id); + this.chatMessageViewModels.value.get(chatMessage.fileId); if (existingChatMessageViewModel != undefined) { existingChatMessageViewModel.body.value = chatMessage.body; existingChatMessageViewModel.status.value = chatMessage.status; } else { this.chatMessageViewModels.set( - chatMessage.id, + chatMessage.fileId, chatMessageViewModel, ); }