" Define leader key to space " and call leader mapper nnoremap let g:mapleader = " " "==============================================" "========================================" " " " Custom Key Mappings " " " " b = Buffer Menu " " f = File Menu " " g = Git Menu " " p = Plugin Menu " " r = Runner Menu " " s = Session Menu " " T = Toggle Menu " " w = Window Menu " " " " TAB = Cycle buffers " " ESC = Search highlighting off " " F2 = Toggle Tagbar " " F3 = Toggle Tree Explorer " " F4 = Toggle Minimap " " F5 = Toggle distraction-free " " F6 = Run dot-http " " " "========================================" "==============================================" "===========================" " LSP Keybindings " "===========================" " https://github.com/hrsh7th/nvim-compe#mappings inoremap compe#complete() inoremap compe#confirm('') inoremap compe#close('') inoremap compe#scroll({ 'delta': +4 }) inoremap compe#scroll({ 'delta': -4 }) "===========================" " Leader Keybindings " "===========================" " - LSP Menu " Show type definition nnoremap lD lua vim.lsp.buf.type_definition() " Show line diagnostics nnoremap le lua vim.lsp.diagnostic.show_line_diagnostics() " Diagnostics into location list nnoremap lq lua vim.lsp.diagnostic.set_loclist() " - Git Menu " Open LazyGit nnoremap go :LazyGit " Pull nnoremap gP :TermExec git pull " Push nnoremap gp :TermExec git push " Status nnoremap gs :TermExec git status " - Plugins Menu " Clean disabled or unused plugins nnoremap pc :PackerClean " Install missing plugins nnoremap pi :PackerInstall " Performs PackerClean and then PackerUpdate nnoremap ps :PackerSync " Update your plugins nnoremap pu :PackerUpdate " - Buffer Menu " Go to buffer 1 nnoremap b1 :BufferGoto 1 " Go to buffer 2 nnoremap b2 :BufferGoto 2 " Go to buffer 3 nnoremap b3 :BufferGoto 3 " Go to buffer 4 nnoremap b4 :BufferGoto 4 " Go to buffer 5 nnoremap b5 :BufferGoto 5 " Go to buffer 6 nnoremap b6 :BufferGoto 6 " Go to buffer 7 nnoremap b7 :BufferGoto 7 " Go to buffer 8 nnoremap b8 :BufferGoto 8 " Go to last buffer nnoremap b9 :BufferLast " Close current buffer nnoremap bc :BufferClose " Format buffer nnoremap bf :Neoformat " Next buffer nnoremap bn :BufferNext " Pick buffer nnoremap bP :BufferPick " Previous buffer nnoremap bp :BufferPrevious " - Order buffer menu " Sort by directory nnoremap od :BufferOrderByDirectory " Sort by language nnoremap ol :BufferOrderByLanguage " Re-order buffer to next nnoremap on :BufferMoveNext " Re-order buffer to previous nnoremap op :BufferMovePrevious " - File Menu " Bookmarks nnoremap fb :Telescope marks " Edit Neovim configuration nnoremap fc :e $MYVIMRC " Find file nnoremap ff :Telescope find_files " Find word nnoremap fg :Telescope live_grep " Help tags nnoremap ft :Telescope help_tags " Write file with sudo permissions (For unwritable files) nnoremap fw :SudaWrite " Re-open file with sudo permissions (For unreadable files only!) nnoremap fr :SudaRead " Override existing telescope fh mapping autocmd VimEnter * noremap fh :Telescope oldfiles " Recently opened files nnoremap fh :Telescope oldfiles " Create a new unnamed buffer nnoremap fn :new " - Window Menu " Close all other windows nnoremap wC :only " Close current window nnoremap wc :close " Split horizontally nnoremap wh :split " Split vertically nnoremap wv :vsplit " - Runner Menu " Run dot-http on the line that the cursor is currently on nnoremap rh :DotHttp " - Session Menu " Save session nmap ss :SessionSave " Load session nmap sl :SessionLoad " ToggleTerm custom function to avoid having " line numbers inside the terminal buffer " because that is not from God. function ToggleTerm() execute "ToggleTerm" set nonumber norelativenumber endfunction " Toggle Menu " Change colorscheme nnoremap tc :DashboardChangeColorscheme " Toggle Tree Explorer nnoremap te :NvimTreeToggle " Toggle Minimap nnoremap tm :MinimapToggle " Toggle Line Numbers nnoremap tn :set number! relativenumber! " Open start screen nnoremap ts :Dashboard " Toggle Tags view nnoremap tT :Vista!! " Open a new terminal nnoremap tt :call ToggleTerm() " tab to cycle buffers too, why not? nnoremap :bnext nnoremap :bprevious " esc to turn off search highlighting nnoremap :noh " F keybindings nnoremap :Vista!! nnoremap :NvimTreeToggle nnoremap :MinimapToggle nnoremap :Goyo nnoremap :DotHttp "=====================" " Disable keys " "=====================" " disable accidentally pressing ctrl-z and suspending nnoremap " disable ex mode nnoremap Q " disable recording nnoremap q " Fast exit from Doom Nvim nnoremap ZZ :call doom#functions#quit_doom(1,1) " Set-up vim_buffer_ previewer autocmd User TelescopePreviewerLoaded setlocal wrap