From c488cf3d75570d76ae0e94a946fd32855ffb0ef1 Mon Sep 17 00:00:00 2001 From: Daan Vanoverloop Date: Wed, 16 Oct 2019 11:40:19 +0200 Subject: [PATCH 1/6] Enable tabnine --- .vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vimrc b/.vimrc index cb7ba34..033b077 100644 --- a/.vimrc +++ b/.vimrc @@ -17,7 +17,7 @@ call plug#begin() Plug 'Shougo/deoplete.nvim' Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' - "Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' } + Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' } Plug 'jpalardy/vim-slime' Plug 'autozimu/LanguageClient-neovim', { \ 'branch': 'next', From 20a11a6baf5b785fdfcda9ee1356e146aa500e0f Mon Sep 17 00:00:00 2001 From: Daan Vanoverloop Date: Wed, 16 Oct 2019 12:05:20 +0200 Subject: [PATCH 2/6] .vimrc cleanup --- .vimrc | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/.vimrc b/.vimrc index 033b077..f80b684 100644 --- a/.vimrc +++ b/.vimrc @@ -9,10 +9,8 @@ call plug#begin() Plug 'arcticicestudio/nord-vim' Plug 'scrooloose/nerdtree' Plug 'jistr/vim-nerdtree-tabs' - Plug 'fweep/vim-tabber.git' Plug 'rhysd/vim-clang-format' Plug 'kana/vim-operator-user' - Plug 'https://github.com/antoyo/vim-licenses' Plug 'rust-lang/rust.vim' Plug 'Shougo/deoplete.nvim' Plug 'roxma/nvim-yarp' @@ -56,10 +54,6 @@ endfunction map :call ToggleGUICruft() -set tabline=%!tabber#TabLine() -let g:tabber_filename_style = 'filename' " README.md\ -let g:tabber_divider_style = 'compatible' - set number set linebreak set nobackup @@ -77,31 +71,16 @@ nnoremap K runtime! ftplugin/man.vim nnoremap K :Man -noremap :update -vnoremap :update -inoremap :update - set mouse=a set nu -let g:clang_format#code_style="webkit" +let g:clang_format#code_style="llvm" -set spell spelllang=en_us set clipboard=unnamed - set backspace=indent,eol,start " allow backspacing over everything in insert mode -" Allow saving of files as sudo when I forgot to start vim using sudo. cmap w!! w !sudo tee > /dev/null % -"spell checking -" Spell check on -set spell spelllang=en_us -setlocal spell spelllang=en_us - -" where it should get the dictionary files -let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' - set laststatus=2 let g:nord_uniform_diff_background = 1 let g:nord_cursor_line_number_background = 1 From a8916b36940328263874c585b63ae993d55584a0 Mon Sep 17 00:00:00 2001 From: Daan Vanoverloop Date: Wed, 16 Oct 2019 20:29:00 +0200 Subject: [PATCH 3/6] Better task switcher --- .config/awesome/rc.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 7f64d40..2eb4828 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -524,6 +524,7 @@ function start_switcher () for _, tag in ipairs(root.tags()) do layout_table[tag] = tag.layout tag.layout = switcher_layout + tag.selected = true end -- Enable all bars @@ -546,6 +547,9 @@ function end_switcher () -- Restore layout of all tags for _, tag in ipairs(root.tags()) do tag.layout = layout_table[tag] + if tag ~= client.focus.first_tag then + tag.selected = false + end end -- Set the master window @@ -790,6 +794,12 @@ clientkeys = gears.table.join( {description = "close", group = "client"}), awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , {description = "toggle floating", group = "client"}), + awful.key({ modkey, "Control", "Shift" }, "space", function (c) + c.maximized = false + c.maximized_vertical = false + c.maximized_horizontal = false + end, + {description = "toggle floating", group = "client"}), awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, {description = "move to master", group = "client"}), awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, @@ -891,7 +901,11 @@ awful.rules.rules = { keys = clientkeys, buttons = clientbuttons, screen = awful.screen.preferred, - placement = awful.placement.no_overlap+awful.placement.no_offscreen + placement = awful.placement.no_overlap+awful.placement.no_offscreen, + maximized_vertical = false, + maximized_horizontal = false, + floating = false, + maximized = false } }, From 016e54ff3459aec75fffe3a21f75172cd26f8408 Mon Sep 17 00:00:00 2001 From: Daan Vanoverloop Date: Thu, 17 Oct 2019 11:44:48 +0200 Subject: [PATCH 4/6] VIM is now an IDE --- .vimrc | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/.vimrc b/.vimrc index f80b684..f56083e 100644 --- a/.vimrc +++ b/.vimrc @@ -15,7 +15,7 @@ call plug#begin() Plug 'Shougo/deoplete.nvim' Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' - Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' } + "Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' } Plug 'jpalardy/vim-slime' Plug 'autozimu/LanguageClient-neovim', { \ 'branch': 'next', @@ -33,12 +33,46 @@ let g:LanguageClient_serverCommands = { let g:deoplete#enable_at_startup = 1 set tags+=./.tags - + + +" Session management + +set switchbuf=useopen,usetab + + +fu! SaveSess() + execute 'mksession! ' . getcwd() . '/.session.vim' +endfunction + +fu! RestoreSess() +if filereadable(getcwd() . '/.session.vim') + let initial_args = argv() + execute 'so ' . getcwd() . '/.session.vim' + for file in initial_args + if bufloaded(file) != 1 + execute 'tabnew ' . getcwd() . '/' . file + else + execute 'sb ' . file + endif + endfor +endif +endfunction + +" Save session on quitting Vim +autocmd VimLeave * NERDTreeTabsClose +autocmd VimLeave * call SaveSess() + +" Restore session on starting Vim +autocmd VimEnter * nested call RestoreSess() + "---------------------- " move between tabs - nnoremap :tabprevious - nnoremap :tabnext +nnoremap :tabprevious +nnoremap :tabnext + + + map :NERDTreeMirrorToggle " prevent mouse vanishing set nomousehide From 6ff1a2241d0e66dc23cb6df64befb9feeac02978 Mon Sep 17 00:00:00 2001 From: Daan Vanoverloop Date: Thu, 17 Oct 2019 12:48:47 +0200 Subject: [PATCH 5/6] awesome fix --- .config/awesome/rc.lua | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 2eb4828..33302a0 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -507,12 +507,19 @@ root.buttons(gears.table.join( )) -- }}} +function table.copy(t) + local u = { } + for k, v in pairs(t) do u[k] = v end + return setmetatable(u, getmetatable(t)) +end + switcher_layout = awful.layout.suit.fair switcher_mode = false switcher_timer = timer({ timeout = 1 }) switcher_timer:connect_signal("timeout", function () end_switcher() end) layout_table = {} +previous_tags = {} function start_switcher () if switcher_timer.started then switcher_timer:stop() end @@ -531,6 +538,7 @@ function start_switcher () for s in screen do s.topwibox.visible = true s.bottomwibox.visible = true + for k,v in pairs(s.selected_tags) do table.insert(previous_tags, v) end end for _, c in ipairs(client.get()) do @@ -547,18 +555,23 @@ function end_switcher () -- Restore layout of all tags for _, tag in ipairs(root.tags()) do tag.layout = layout_table[tag] - if tag ~= client.focus.first_tag then + if client.focus and tag ~= client.focus.first_tag or client.focus == nil then tag.selected = false end end - -- Set the master window for _, c in ipairs(client.get()) do remove_borders(c) end -- Set focused client as master - if client.focus then client.focus:swap(awful.client.getmaster()) end + if client.focus then + client.focus:swap(awful.client.getmaster()) + else + for _, tag in ipairs(previous_tags) do + tag.selected = true + end + end -- Disable all bars for s in screen do @@ -566,6 +579,8 @@ function end_switcher () s.bottomwibox.visible = false end + previous_tags = {} + --rofi_kill() end From de1473b8a3677023e398f245f4314877beb28745 Mon Sep 17 00:00:00 2001 From: Daan Vanoverloop Date: Thu, 17 Oct 2019 13:13:00 +0200 Subject: [PATCH 6/6] Better UX --- .config/awesome/rc.lua | 48 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 33302a0..7422a9b 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -490,12 +490,12 @@ awful.screen.connect_for_each_screen(function(s) s.dock_trigger = wibox({ bg = "#00000000", opacity = 0, ontop = true, visible = true }) s.dock_trigger:geometry({ width = 3, height = 3 }) - s.topwibox:connect_signal("mouse::enter", function() start_switcher() end) - s.topwibox:connect_signal("mouse::leave", function() switcher_timer:again() end) - s.bottomwibox:connect_signal("mouse::enter", function() start_switcher() end) - s.bottomwibox:connect_signal("mouse::leave", function() switcher_timer:again() end) - s.dock_trigger:connect_signal("mouse::enter", function() start_switcher() end) - s.dock_trigger:connect_signal("mouse::leave", function() switcher_timer:again() end) + s.topwibox:connect_signal("mouse::enter", function() enable_bars() end) + s.topwibox:connect_signal("mouse::leave", function() bar_timer:again() end) + s.bottomwibox:connect_signal("mouse::enter", function() enable_bars() end) + s.bottomwibox:connect_signal("mouse::leave", function() bar_timer:again() end) + s.dock_trigger:connect_signal("mouse::enter", function() enable_bars() end) + s.dock_trigger:connect_signal("mouse::leave", function() bar_timer:again() end) end) -- }}} @@ -518,6 +518,9 @@ switcher_layout = awful.layout.suit.fair switcher_mode = false switcher_timer = timer({ timeout = 1 }) switcher_timer:connect_signal("timeout", function () end_switcher() end) +bar_timer = timer({ timeout = 1 }) +bar_timer:connect_signal("timeout", function () disable_bars() end) +bar_mode = false layout_table = {} previous_tags = {} @@ -534,13 +537,12 @@ function start_switcher () tag.selected = true end - -- Enable all bars for s in screen do - s.topwibox.visible = true - s.bottomwibox.visible = true for k,v in pairs(s.selected_tags) do table.insert(previous_tags, v) end end + enable_bars() + for _, c in ipairs(client.get()) do set_borders(c) end @@ -573,21 +575,35 @@ function end_switcher () end end - -- Disable all bars - for s in screen do - s.topwibox.visible = false - s.bottomwibox.visible = false - end + disable_bars() previous_tags = {} - - --rofi_kill() end function toggle_switcher () if switcher_mode then end_switcher() else start_switcher() end end +function enable_bars () + if bar_timer.started then bar_timer:stop() end + if bar_mode == true then return else bar_mode = true end + + for s in screen do + s.topwibox.visible = true + s.bottomwibox.visible = true + end +end + +function disable_bars () + if bar_timer.started then bar_timer:stop() end + if bar_mode == false then return else bar_mode = false end + + for s in screen do + s.topwibox.visible = false + s.bottomwibox.visible = false + end +end + function set_borders (c) c.border_width = beautiful.border_width awful.titlebar.show(c)