Created
April 5, 2021 14:57
-
-
Save teito-dev/3c90c6cd267f9d3269ba746a253f4bcf to your computer and use it in GitHub Desktop.
Neovim Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" This is to install plug.vim incase its not present | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
"Plug-ins | |
call plug#begin('~/.config/nvim/plugged') | |
" Tools | |
Plug 'junegunn/goyo.vim' | |
Plug 'junegunn/limelight.vim' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'dart-lang/dart-vim-plugin' | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'cespare/vim-toml' | |
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} | |
" Syntax | |
Plug 'tpope/vim-markdown' | |
Plug 'ap/vim-css-color' "Displays a preview of colors with CSS | |
Plug 'vim-scripts/fountain.vim' | |
" Color-schemes | |
Plug 'ayu-theme/ayu-vim' | |
" Snippet Engine | |
Plug 'SirVer/ultisnips' | |
" Git Browsing | |
Plug 'tpope/vim-fugitive' | |
Plug 'junegunn/gv.vim' | |
call plug#end() | |
"General Settings | |
set encoding=UTF-8 | |
filetype plugin indent on "Enabling Plugin & Indent | |
syntax on "Turning Syntax on | |
set autoread wildmode=longest,list,full | |
set backspace=indent,eol,start confirm | |
set shiftwidth=4 autoindent smartindent tabstop=4 softtabstop=4 expandtab | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
set hls is ic | |
set laststatus=2 cmdheight=1 | |
au BufRead,BufNewFile *.fountain set filetype=fountain | |
set splitbelow splitright | |
set nobackup nowritebackup | |
set tabstop=4 " tabs are expanded to 4 spaces in the file | |
set shiftwidth=4 " 4 spaces for each indent | |
set softtabstop=4 " tabs are displayed as 4 spaces on screen | |
set nohlsearch | |
"Status-line | |
set statusline= | |
set statusline+=%#IncSearch# | |
set statusline+=\ %y | |
set statusline+=\ %r | |
set statusline+=%#CursorLineNr# | |
set statusline+=\ %F | |
set statusline+=%= "Right side settings | |
set statusline+=%#Search# | |
set statusline+=\ %l/%L | |
set statusline+=\ [%c] | |
set foldminlines=0 "minimum foldable lines set to 0 | |
" use <tab> for trigger completion and navigate to the next complete item | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~ '\s' | |
endfunction | |
inoremap <silent><expr> <Tab> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<Tab>" : | |
\ coc#refresh() | |
"Key-bindings | |
let mapleader=" " | |
nnoremap <leader>n :Explore<CR> | |
" ctrlp Fuzzy finder plugin | |
nnoremap <leader><Space> :CtrlPTag<CR> | |
let g:ctrlp_cmd = 'CtrlPTag' | |
" python-provider | |
let g:loaded_python_provider = 0 | |
let g:python3_host_prog = '/usr/bin/python3.6' | |
" UltiSnip config | |
let g:UltiSnipsEditSplit="vertical" | |
let g:UltiSnipsJumpForwardTrigger="<c-b>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-z>" | |
let g:UltiSnipsExpandTrigger="<F2>" | |
" dart-vim-plugin | |
let g:dart_format_on_save = 1 | |
" Keybinding of coc-code-action | |
nnoremap <leader>n :call CocAction('diagnosticNext')<CR> | |
nnoremap <leader>N :call CocAction('diagnosticPrevious')<CR> | |
vnoremap <leader>a <Plug>(coc-codeaction-selected) | |
nnoremap <leader>a :call CocAction("doHover")<CR> | |
nnoremap <leader>e :call CocAction("diagnosticToggle")<CR> | |
" git browse plugin (gv) | |
nnoremap <leader>g :GV!<CR> | |
vnoremap <leader>g :GV<CR> | |
nnoremap <leader>G :GV?<CR> | |
vnoremap <leader>G :GV?<CR> | |
" F2 remaps | |
nnoremap <F2> @ | |
" Goyo Plugin keybinding , to take aesthetic notes | |
" in a custom view | |
nnoremap <leader><ENTER> :Goyo<CR> | |
nnoremap <leader>, :vsplit <CR> | |
nnoremap <C-h> :set hlsearch!<CR> | |
nnoremap <C-s> :source ~/.config/nvim/init.vim<CR> | |
" Remap NewLine added | |
nnoremap o o<Esc> | |
nnoremap O O<Esc> | |
" Remap Escape Key | |
imap jj <Esc> | |
" To Open Terminal | |
nnoremap <leader>t :terminal <CR> | |
tnoremap <F2> <C-\><C-n> | |
nnoremap <Up> :resize +2<CR> | |
nnoremap <Down> :resize -2<CR> | |
nnoremap <Left> :vertical resize +2<CR> | |
nnoremap <Right> :vertical resize -2<CR> | |
xnoremap K :move '<-2<CR>gv-gv | |
xnoremap J :move '>+1<CR>gv-gv | |
vnoremap <C-c> "+y | |
nnoremap Q <nop> | |
nnoremap <C-l> :set number!<CR> :set relativenumber!<CR> | |
" Python3 Keybindings | |
nnoremap <leader>f :%!flake8 | |
nnoremap <leader>p :%!autopep8 %<CR> | |
" xdg-open | |
nnoremap <leader>o :!xdg-open %<CR> | |
" Diff between file and its buffer | |
nnoremap <leader>d :DiffSaved <CR> | |
" Tab Navigation Shortcuts | |
nnoremap <tab>t :tabnew<CR> | |
nnoremap <tab>k :tabl<CR> | |
nnoremap <tab>j :tabr<CR> | |
nnoremap <tab>h :tabp<CR> | |
nnoremap <tab>l :tabn<CR> | |
nnoremap <tab>w :tabc<CR> | |
nnoremap <leader>h <C-W>h | |
nnoremap <leader>j <C-W>j | |
nnoremap <leader>k <C-W>k | |
nnoremap <leader>l <C-W>l | |
map <F1> :colorscheme ayu<CR> | |
"Color Settings | |
hi! Normal ctermbg=NONE guibg=NONE | |
hi! NonText ctermbg=NONE guibg=NONE guifg=NONE ctermfg=NONE | |
let g:limelight_conceal_ctermfg = 'gray' | |
let g:limelight_conceal_ctermfg = 240 | |
let g:limelight_conceal_guifg = 'DarkGray' | |
let g:limelight_conceal_guifg = '#777777' | |
"Netrw settings | |
let g:netrw_banner = 0 | |
"Goyo settings | |
function! s:goyo_enter() | |
set noshowmode | |
set noshowcmd | |
set nocursorline | |
CocDisable | |
Limelight | |
endfunction | |
function! s:goyo_leave() | |
set showmode | |
set showcmd | |
set cursorline | |
CocEnable | |
Limelight! | |
endfunction | |
" Diff between buffer | |
" and original file function | |
function! s:DiffWithSaved() | |
let filetype=&ft | |
diffthis | |
vnew | r # | normal! 1Gdd | |
diffthis | |
exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype | |
endfunction | |
com! DiffSaved call s:DiffWithSaved() | |
autocmd! User GoyoEnter nested call <SID>goyo_enter() | |
autocmd! User GoyoLeave nested call <SID>goyo_leave() | |
set background=dark cursorline termguicolors | |
let ayucolor = "dark" | |
colorscheme ayu | |
set cursorline | |
set showmode | |
set showcmd | |
set wildmenu | |
" Apply Highlighting to tab bar | |
hi TabLine guifg=#333 guibg=#222 gui=none ctermfg=254 ctermbg=238 cterm=none | |
hi TabLineSel guifg=#666 guibg=#464D5E gui=bold ctermfg=231 ctermbg=235 cterm=bold | |
hi TabLineFill guifg=#999 guibg=#222 gui=none ctermfg=254 ctermbg=238 cterm=none | |
" Shortcuts | |
" :% ! xxd | |
" Allows you to output the hex dump of the file using | |
" xxd cli tool to get the hex file or to revert it | |
" back to binary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment