dblume commited on 2022-03-01 16:48:10
Showing 1 changed files, with 23 additions and 33 deletions.
| ... | ... |
@@ -149,6 +149,27 @@ vnoremap <leader>s :sort<cr> |
| 149 | 149 |
vnoremap < <gv |
| 150 | 150 |
vnoremap > >gv |
| 151 | 151 |
|
| 152 |
+" Make <C-W>o toggle maximizing a window. |
|
| 153 |
+" https://vim.fandom.com/wiki/Maximize_window_and_return_to_previous_split_structure |
|
| 154 |
+nnoremap <C-W>o :call MaximizeToggle()<CR> |
|
| 155 |
+function! MaximizeToggle() |
|
| 156 |
+ if exists("s:maximize_session")
|
|
| 157 |
+ exec "source " . s:maximize_session |
|
| 158 |
+ call delete(s:maximize_session) |
|
| 159 |
+ unlet s:maximize_session |
|
| 160 |
+ let &hidden=s:maximize_hidden_save |
|
| 161 |
+ unlet s:maximize_hidden_save |
|
| 162 |
+ " ColorColumn highlight gets changed. Workaround: unset it. |
|
| 163 |
+ highlight clear ColorColumn |
|
| 164 |
+ else |
|
| 165 |
+ let s:maximize_hidden_save = &hidden |
|
| 166 |
+ let s:maximize_session = tempname() |
|
| 167 |
+ set hidden |
|
| 168 |
+ exec "mksession! " . s:maximize_session |
|
| 169 |
+ only |
|
| 170 |
+ endif |
|
| 171 |
+endfunction |
|
| 172 |
+ |
|
| 152 | 173 |
" If too many file system events are getting triggered. |
| 153 | 174 |
set nobackup " ~ files |
| 154 | 175 |
set nowritebackup " Don't write buff to temp, delete orig, rename temp to orig |
| ... | ... |
@@ -266,39 +287,8 @@ set omnifunc=syntaxcomplete#Complete |
| 266 | 287 |
" set omnifunc=pythoncomplete#Complete |
| 267 | 288 |
" inoremap <Nul> <C-x><C-o> |
| 268 | 289 |
|
| 269 |
-" This function attempts to reuse the same scratch |
|
| 270 |
-" buffer over and over, so you always see output in |
|
| 271 |
-" the same location in your window layout. |
|
| 272 |
-function! ExecuteFileIntoScratchBuffer() |
|
| 273 |
- write |
|
| 274 |
- let f=expand("%:p")
|
|
| 275 |
- let cur_win = winnr() |
|
| 276 |
- if buflisted("_vim_output")
|
|
| 277 |
- exe bufwinnr("_vim_output") . "wincmd w"
|
|
| 278 |
- enew |
|
| 279 |
- else |
|
| 280 |
- vnew |
|
| 281 |
- let cur_win = cur_win+1 |
|
| 282 |
- endif |
|
| 283 |
- setlocal buftype=nofile |
|
| 284 |
- setlocal bufhidden=delete |
|
| 285 |
- setlocal noswapfile |
|
| 286 |
- silent file _vim_output |
|
| 287 |
- execute '.! "'.f.'"' |
|
| 288 |
- exe cur_win . "wincmd w" |
|
| 289 |
-endfunc |
|
| 290 |
-nmap <F5> :call ExecuteFileIntoScratchBuffer()<cr> |
|
| 291 |
- |
|
| 292 |
-" Execute a selection of code |
|
| 293 |
-" Use Visual to select a range and then hit ctrl-h to execute it. |
|
| 294 |
-if has("python")
|
|
| 295 |
-python << EOL |
|
| 296 |
-import vim |
|
| 297 |
-def EvaluateCurrentRange(): |
|
| 298 |
- eval(compile('\n'.join(vim.current.range),'','exec'),globals())
|
|
| 299 |
-EOL |
|
| 300 |
-vnoremap <C-h> :py EvaluateCurrentRange()<cr> |
|
| 301 |
-endif |
|
| 290 |
+" See git history for ExecuteFileIntoScratchBuffer. |
|
| 291 |
+" Instead use: tmux and entr to run code after saving edits. |
|
| 302 | 292 |
|
| 303 | 293 |
" cscope |
| 304 | 294 |
if has("cscope")
|
| 305 | 295 |