Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Load packer.nvim and LSP
- lua require('plugins')
- lua require('lsp')
- lua require('lsp-config')
- " Make packer.nvim auto compile
- augroup packer_user_config
- autocmd!
- autocmd BufWritePost plugins.lua source <afile> | PackerCompile
- augroup end
- " Set leader key to space
- let mapleader = "\<Space>"
- " Some initial configs
- set hidden
- set nobackup
- set nowritebackup
- set cmdheight=2
- set updatetime=300
- set shortmess+=c
- set signcolumn=yes
- set number
- set mouse=a
- au BufWinEnter * match ExtraWhitespace /\s\+$/
- au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
- au InsertLeave * match ExtraWhitespace /\s\+$/
- au BufWinLeave * call clearmatches()
- set nocompatible
- set showmatch
- set hlsearch
- set incsearch
- set tabstop=4
- set softtabstop=4
- set expandtab
- set shiftwidth=4
- set autoindent
- set wildmode=longest, list
- filetype plugin indent on
- set clipboard=unnamedplus
- set cursorline
- set ttyfast
- set spell
- " Copy to clipboard
- nnoremap <leader>Y "+yg_
- vnoremap <leader>y "+y
- nnoremap <leader>y "+y
- nnoremap <leader>yy "+yy
- " Paste from clipboard
- nnoremap <leader>p "+p
- nnoremap <leader>P "+p
- vnoremap <leader>p "+p
- vnoremap <leader>P "+p
- " Put some packer.nvim shortcuts
- nnoremap <silent> <leader>u <cmd>PackerUpdate<CR>
- nnoremap <silent> <leader>i <cmd>PackerInstall<CR>
- vnoremap <silent> <leader>i <cmd>PackerUpdate<CR>
- vnoremap <silent> <leader>u <cmd>PackerInstall<CR>
- " Set save key
- inoremap <silent> <C-s> <cmd>w<CR>
- nnoremap <silent> <C-s> <cmd>w<CR>
- vnoremap <silent> <C-s> <cmd>w<CR>
- " Quick edit this file
- nnoremap <silent> <leader>s <cmd>e $MYVIMRC<CR>
- vnoremap <silent> <leader>s <Esc>e $MYVIMRC<CR>
- " Quickly edit plugins file
- nnoremap <silent> <leader>p <cmd>e ~/.config/nvim/lua/plugins.lua<CR>
- vnoremap <silent> <leader>p <cmd>e ~/.config/nvim/lua/plugins.lua<CR>
- " Quickly edit xmonad.hs
- nnoremap <silent> <leader>x <cmd>e ~/.config/xmonad/xmonad.hs<CR>
- vnoremap <silent> <leader>x <cmd>e ~/.config/xmonad/xmonad.hs<CR>
- " Quickly edit ~/.xmobarrc
- nnoremap <silent> <leader>a <cmd>e ~/.xmobarrc<CR>
- vnoremap <silent> <leader>a <cmd>e ~/.xmobarrc<CR>
- " Add/remove/update a lsp
- nnoremap <silent> <leader>l <cmd>e ~/.config/nvim/lua/lsp.lua<CR>
- vnoremap <silent> <leader>l <cmd>e ~/.config/nvim/lua/lsp.lua<CR>
- " Work on lsp-config
- nnoremap <silent> <leader>c <cmd>e ~/.config/nvim/lua/lsp-config.lua<CR>
- nnoremap <silent> <leader>c <cmd>e ~/.config/nvim/lua/lsp-config.lua<CR>
- " setup mapping to call :LazyGit and :LazyGitConfig
- nnoremap <silent> <leader>g :LazyGit<CR>
- nnoremap <silent> <leader>gc :LazyGitConfig<CR>
- if executable('nvr')
- let $GIT_EDITOR = "nvr -cc split --remote-wait +'set bufhidden=wipe'"
- endif
- " Remove all trailing whitespaces
- nnoremap <silent> <leader>rs :let _s=@/ <Bar> :%s/\s\+$//e <Bar> :let @/=_s <Bar> :nohl <Bar> :unlet _s <CR>
- " Cppman config
- function! s:JbzCppMan()
- let old_isk = &iskeyword
- setl iskeyword+=:
- let str = expand("<cword>")
- let &l:iskeyword = old_isk
- execute 'Man ' . str
- endfunction
- command! JbzCppMan :call s:JbzCppMan()
- au FileType cpp nnoremap <buffer>K :JbzCppMan<CR>
- " OpenBrowser config
- let g:openbrowser_search_engines = extend(
- \ get(g:, 'openbrowser_search_engines', {}),
- \ {
- \ 'cppreference': 'https://en.cppreference.com/mwiki/index.php?title=Special%3ASearch&search={query}',
- \ 'qt': 'https://doc.qt.io/qt-5/search-results.html?q={query}',
- \ 'stackoverflow': 'https://stackoverflow.com/search?q={query}',
- \ 'cpp': 'cplusplus.com/search.do?q={query}',
- \ 'python': 'https://docs.python.org/3/search.html?q={query}&check_keywords=yes&area=default',
- \ 'rust': 'https://doc.rust-lang.org/std/index.html?search={query}',
- \ 'google': 'https://www.google.com/search?q={query}'
- \ },
- \ 'keep'
- \)
- nnoremap <silent> <leader>sc :call openbrowser#smart_search(expand('<cword>'), "cppreference")<CR>
- nnoremap <silent> <leader>sq :call openbrowser#smart_search(expand('<cword>'), "qt")<CR>
- nnoremap <silent> <leader>sd :call openbrowser#smart_search(expand('<cword>'), "cpp")<CR>
- nnoremap <silent> <leader>ss :call openbrowser#smart_search(expand('<cword>'), "stackoverflow")<CR>
- nnoremap <silent> <leader>sp :call openbrowser#smart_search(expand('<cword>'), "python")<CR>
- nnoremap <silent> <leader>sr :call openbrowser#smart_search(expand('<cword>'), "rust")<CR>
- nnoremap <silent> <leader>sg :call openbrowser#smart_search(expand('<cword>'), "google")<CR>
- " Vim-Gutentags + Gutentags-plus config
- set tags=./tags;
- let g:gutentags_ctags_exclude_wildignore = 1
- let g:gutentags_ctags_exclude = [
- \'node_modules', '_build', 'build', 'CMakeFiles', '.mypy_cache', 'venv',
- \'*.md', '*.tex', '*.css', '*.html', '*.json', '*.xml', '*.xmls', '*.ui']
- let g:gutentags_modules = ['ctags', 'gtags_cscope']
- let g:gutentags_project_root = ['.root']
- let g:gutentags_cache_dir = expand('~/.cache/tags')
- let g:gutentags_plus_switch = 1
- " Vista.vim configs
- nnoremap <silent> <leader>v :Vista!!<CR>
- function! NearestMethodOrFunction() abort
- return get(b:, 'vista_nearest_method_or_function', '')
- endfunction
- set statusline+=%{NearestMethodOrFunction()}
- " By default vista.vim never run if you don't call it explicitly.
- "
- " If you want to show the nearest function in your statusline automatically,
- " you can add the following line to your vimrc
- autocmd VimEnter * call vista#RunForNearestMethodOrFunction()
- " Vim-spector configs
- let g:vimspector_enable_mappings = 'HUMAN'
- nnoremap <leader>b <Plug>VimspectorBaloonEval
- vnoremap <leader>b <Plug>VimspectorBaloonEval
- " Set color theme
- set termguicolors
- colorscheme bluewery
- let g:lightline = { 'colorscheme': 'bluewery' }
- " Vifm toggle keybinding
- nnoremap <silent> <leader>m <cmd>Vifm .<CR>
- " Find files using Telescope command-line sugar.
- nnoremap <leader>ff <cmd>Telescope find_files<cr>
- nnoremap <leader>fg <cmd>Telescope live_grep<cr>
- nnoremap <leader>fb <cmd>Telescope buffers<cr>
- nnoremap <leader>fh <cmd>Telescope help_tags<cr>
- " Discord presence
- " General options
- let g:presence_auto_update = 1
- let g:presence_neovim_image_text = "The One True Text Editor"
- let g:presence_main_image = "neovim"
- let g:presence_client_id = "793271441293967371"
- let g:presence_log_level = "debug"
- let g:presence_debounce_timeout = 10
- let g:presence_enable_line_number = 1
- let g:presence_blacklist = []
- let g:presence_buttons = 1
- let g:presence_file_assets = {}
- " Rich Presence text options
- let g:presence_editing_text = "Editing %s"
- let g:presence_file_explorer_text = "Browsing %s"
- let g:presence_git_commit_text = "Committing changes"
- let g:presence_plugin_manager_text = "Managing plugins"
- let g:presence_reading_text = "Reading %s"
- let g:presence_workspace_text = "Working on %s"
- let g:presence_line_number_text = "Line %s out of %s"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement