diff options
author | Yigit Sever | 2021-10-08 13:50:04 +0300 |
---|---|---|
committer | Yigit Sever | 2021-10-08 13:50:04 +0300 |
commit | 1c0aa32806e097a2a0c30b760ae4cad481e758c6 (patch) | |
tree | 853e8f17dec94f0c42e88003b1d906abfb7f28ec | |
parent | 484188c99b21e668f40b84b21d1b21f5b9ce8d9e (diff) | |
download | dotfiles-1c0aa32806e097a2a0c30b760ae4cad481e758c6.tar.gz dotfiles-1c0aa32806e097a2a0c30b760ae4cad481e758c6.tar.bz2 dotfiles-1c0aa32806e097a2a0c30b760ae4cad481e758c6.zip |
nvim: ported wiki functions
-rw-r--r-- | .config/nvim/after/plugin/autocmds.vim | 2 | ||||
-rw-r--r-- | .config/nvim/after/plugin/functions.vim | 28 | ||||
-rw-r--r-- | .config/nvim/after/plugin/tabular_extra.vim | 14 | ||||
-rw-r--r-- | .config/nvim/lua/mappings.lua | 21 | ||||
-rw-r--r-- | .config/nvim/lua/plugin_settings.lua | 16 |
5 files changed, 72 insertions, 9 deletions
diff --git a/.config/nvim/after/plugin/autocmds.vim b/.config/nvim/after/plugin/autocmds.vim new file mode 100644 index 0000000..ae55046 --- /dev/null +++ b/.config/nvim/after/plugin/autocmds.vim | |||
@@ -0,0 +1,2 @@ | |||
1 | " I don't know how to port this yet | ||
2 | autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif | ||
diff --git a/.config/nvim/after/plugin/functions.vim b/.config/nvim/after/plugin/functions.vim new file mode 100644 index 0000000..87a1072 --- /dev/null +++ b/.config/nvim/after/plugin/functions.vim | |||
@@ -0,0 +1,28 @@ | |||
1 | " Will learn to port promise | ||
2 | function! CreateNote() | ||
3 | py3 import uuid | ||
4 | exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/box/" . py3eval('str(uuid.uuid4())[:6]') . ".wiki") | ||
5 | let l:text="= up =\n\n= down =\n\n= keywords =\n\n" | ||
6 | put =l:text | ||
7 | norm gg | ||
8 | endfunction | ||
9 | |||
10 | function! CreatePaper(citekey) | ||
11 | exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/papers/" . a:citekey . ".wiki") | ||
12 | |||
13 | let l:timestap="%date " . strftime("%F") | ||
14 | let l:text="= Came From =\n\n= Takeaways =\n\n= Might Go To =\n\n" | ||
15 | |||
16 | put! =l:timestap | ||
17 | put =l:text | ||
18 | endfunction | ||
19 | |||
20 | function! CreateReference(citekey) | ||
21 | exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/reference/" . a:citekey . ".wiki") | ||
22 | |||
23 | let l:timestap="%date " . strftime("%F") | ||
24 | let l:text="= Literature Notes =\n\n= Citation =\n\n" | ||
25 | |||
26 | put! =l:timestap | ||
27 | put =l:text | ||
28 | endfunction | ||
diff --git a/.config/nvim/after/plugin/tabular_extra.vim b/.config/nvim/after/plugin/tabular_extra.vim new file mode 100644 index 0000000..28713ca --- /dev/null +++ b/.config/nvim/after/plugin/tabular_extra.vim | |||
@@ -0,0 +1,14 @@ | |||
1 | " after/plugin/my_tabular_commands.vim | ||
2 | " Provides extra :Tabularize commands | ||
3 | |||
4 | if !exists(':Tabularize') | ||
5 | finish " Give up here; the Tabular plugin musn't have been loaded | ||
6 | endif | ||
7 | |||
8 | nmap <Leader>t= :Tabularize /=<CR> | ||
9 | vmap <Leader>t= :Tabularize /=<CR> | ||
10 | nmap <Leader>t: :Tabularize /:\zs<CR> | ||
11 | vmap <Leader>t: :Tabularize /:\zs<CR> | ||
12 | |||
13 | AddTabularPattern first_comma /^[^,]*\zs,/r0c0l0 | ||
14 | AddTabularPattern first_colon /^[^:]*\zs:/r0c0l0 | ||
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index fe59a99..f27ac1b 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua | |||
@@ -84,6 +84,18 @@ map('n', '<Leader>cd', ':cd %:p:h<CR>:pwd<CR>') | |||
84 | -- press \g and start writing prose | 84 | -- press \g and start writing prose |
85 | map('n', '<Leader>g', ':Goyo<CR>') | 85 | map('n', '<Leader>g', ':Goyo<CR>') |
86 | 86 | ||
87 | -- call CreatePaper on word below cursor | ||
88 | map('n', '<leader>np', 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>') | ||
89 | |||
90 | -- link paper | ||
91 | map('n', '<leader>lp', 'gewi[[/papers/<ESC>Ea]]<ESC>') | ||
92 | |||
93 | -- call CreateReference on word below cursor | ||
94 | map('n', '<leader>nr', ':call CreateReference(expand("<cword>"))<CR>') | ||
95 | |||
96 | -- create a new note | ||
97 | map('n', '<leader>nn', ':call CreateNote()<CR>') | ||
98 | |||
87 | -- plug mappings {{{1 -- | 99 | -- plug mappings {{{1 -- |
88 | 100 | ||
89 | -- <Plug> mappings should not be noremap | 101 | -- <Plug> mappings should not be noremap |
@@ -101,8 +113,8 @@ plugmap('n', '<Leader>`', '<Plug>Sneak_S') | |||
101 | plugmap('n', "'", '`') | 113 | plugmap('n', "'", '`') |
102 | 114 | ||
103 | -- use the special yoink paste that rotates | 115 | -- use the special yoink paste that rotates |
104 | plugmap('n', 'p', '<Plug>(YoinkPaste_p)') | 116 | plugmap('n', 'p', '<Plug>(YoinkPaste_p)') |
105 | plugmap('n', 'P', '<Plug>(YoinkPaste_P)') | 117 | plugmap('n', 'P', '<Plug>(YoinkPaste_P)') |
106 | 118 | ||
107 | -- substitute from yank | 119 | -- substitute from yank |
108 | plugmap('n', '<Leader>ys', '<plug>(SubversiveSubstitute)') | 120 | plugmap('n', '<Leader>ys', '<plug>(SubversiveSubstitute)') |
@@ -128,4 +140,9 @@ plugmap('i', '<c-x><c-k>', '<plug>(fzf-complete-word)') | |||
128 | plugmap('i', '<c-x><c-f>', '<plug>(fzf-complete-path)') | 140 | plugmap('i', '<c-x><c-f>', '<plug>(fzf-complete-path)') |
129 | plugmap('i', '<c-x><c-l>', '<plug>(fzf-complete-line)') | 141 | plugmap('i', '<c-x><c-l>', '<plug>(fzf-complete-line)') |
130 | 142 | ||
143 | -- checkmarks on vimwiki | ||
144 | plugmap('n', '<leader>v', '<Plug>VimwikiToggleListItem') | ||
145 | -- add/increase header level | ||
146 | plugmap('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel') | ||
147 | |||
131 | -- 1}}} -- | 148 | -- 1}}} -- |
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index b10a002..4e28726 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua | |||
@@ -101,13 +101,6 @@ g.UltiSnipsExpandTrigger = "<C-l>" | |||
101 | g.UltiSnipsEnableSnipMate = "1" | 101 | g.UltiSnipsEnableSnipMate = "1" |
102 | -- }}} UltiSnips -- | 102 | -- }}} UltiSnips -- |
103 | 103 | ||
104 | -- float preview | ||
105 | g["float_preview#docked"] = 0 | ||
106 | |||
107 | -- highlight on yank | ||
108 | cmd('highlight HighlightedyankRegion cterm=reverse gui=reverse') | ||
109 | g.highlightedyank_highlight_duration = 200 | ||
110 | |||
111 | -- beacon {{{ -- | 104 | -- beacon {{{ -- |
112 | g.beacon_size = 100 | 105 | g.beacon_size = 100 |
113 | g.beacon_shrink = 1 | 106 | g.beacon_shrink = 1 |
@@ -124,3 +117,12 @@ g.slime_paste_file = "/home/yigit/.slime_paste" | |||
124 | g.vimtex_view_method = 'zathura' | 117 | g.vimtex_view_method = 'zathura' |
125 | g.vimtex_quickfix_mode = 0 | 118 | g.vimtex_quickfix_mode = 0 |
126 | -- }}} vimtex -- | 119 | -- }}} vimtex -- |
120 | |||
121 | vim.g.polyglot_disabled={'latex', 'tex'} | ||
122 | |||
123 | -- float preview | ||
124 | g["float_preview#docked"] = 0 | ||
125 | |||
126 | -- highlight on yank | ||
127 | cmd('highlight HighlightedyankRegion cterm=reverse gui=reverse') | ||
128 | g.highlightedyank_highlight_duration = 200 | ||