Created
July 29, 2021 06:45
-
-
Save angrox/d464f546d938385f530c8590a83a9672 to your computer and use it in GitHub Desktop.
my first nvim 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
" Hints: https://github.com/davidmytton/dotfiles/blob/main/dot_vimrc | |
" https://console.dev/reviews/neovim-best-code-editor-ide-for-developers/ | |
" https://gist.github.com/synasius/5cdc75c1c8171732c817 | |
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) | |
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
endif | |
" vim-plug {{{ | |
call plug#begin() | |
" color scheme | |
Plug 'arcticicestudio/nord-vim' | |
Plug 'morhetz/gruvbox' | |
Plug 'joshdick/onedark.vim' | |
" status line | |
Plug 'itchyny/lightline.vim' | |
" File browser with git indicators | |
Plug 'preservim/nerdtree' | |
Plug 'vim-scripts/The-NERD-tree' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
" TabsG | |
Plug 'jistr/vim-nerdtree-tabs' | |
" navigation/search file | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'dkprice/vim-easygrep' | |
Plug 'jremmen/vim-ripgrep' | |
" Autostart page | |
Plug 'mhinz/vim-startify' | |
" Git stuff | |
Plug 'airblade/vim-gitgutter' " indicator | |
" Syntax checker | |
Plug 'vim-syntastic/syntastic' | |
call plug#end() | |
" }}} vim-plug | |
" {{{ Setup gruvbox theme | |
function! SetupGruvbox() | |
" Set coloring to 256 | |
set t_Co=256 | |
colorscheme gruvbox | |
"highlight current=line | |
hi CursorLine term=bold cterm=bold ctermbg=darkgrey ctermfg=white guibg=darkgrey guifg=white | |
hi CursorColumn term=bold cterm=bold ctermbg=darkgrey ctermfg=white guibg=darkgrey guifg=white | |
endfunction | |
" }}} Setup gruvbox | |
" Noshowmode | |
"set noshowmode | |
" code folding | |
set foldmethod=indent | |
set foldlevel=99 | |
" Colors {{{ | |
if (has("nvim")) | |
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
endif | |
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > | |
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > | |
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
syntax enable " enable syntax processing | |
colorscheme onedark | |
"call SetupGruvbox() | |
set background=dark | |
" Lightline color mode | |
let g:lightline = { 'colorscheme': 'onedark' } | |
filetype on | |
filetype plugin indent on | |
" }}} Colors | |
" Spaces & Tabs {{{ | |
set tabstop=4 " number of visual spaces per TAB | |
set softtabstop=4 " number of spaces in tab when editing | |
set shiftwidth=4 " number of spaces to use for autoindent | |
set expandtab " tabs are space | |
set autoindent | |
set copyindent " copy indent from the previous line | |
" }}} Spaces & Tabs | |
" {{{ Sane text files | |
set fileformat=unix | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
" }}} Sane text files | |
" UI Config {{{ | |
set hidden | |
set number " show line number | |
set showcmd " show command in bottom bar | |
set cursorline " highlight current line | |
set wildmenu " visual autocomplete for command menu | |
set showmatch " highlight matching brace | |
set laststatus=2 " window will always have a status line | |
set nobackup | |
set noswapfile | |
"let &colorcolumn="80,".join(range(119,999),",") | |
" }}} UI Config | |
" set change updatetime from filesysem to 1000ms | |
set updatetime=1000 | |
" Leader & Mappings {{{ | |
let mapleader="," " leader is comma | |
" edit/reload vimrc | |
nmap <leader>ev :e $MYVIMRC<CR> | |
nmap <leader>sv :so $MYVIMRC<CR> | |
" better ESC | |
inoremap jj <esc> | |
" Toggle line numbers | |
nmap <leader>l :set number!<CR> | |
" fast save and close | |
nmap <leader>w :w<CR> | |
nmap <leader>x :x<CR> | |
nmap <leader>q :q<CR> | |
" fzf | |
nnoremap <c-p> :FZF<CR> | |
" NERDTree mappings {{{ | |
map <C-n> :NERDTreeToggle<CR> | |
" turn off search highlights | |
nnoremap <leader><space> :nohlsearch<CR> | |
" }}} | |
" }}} Leader & Mappings | |
" NERDTree {{{ | |
let NERDTreeShowHidden=1 | |
let NERDTreeIgnore = ['\.pyc$', '__pycache__'] | |
let NERDTreeMinimalUI = 1 | |
let g:nerdtree_open = 0 | |
" NERDTree setting defaults to work around http://github.com/scrooloose/nerdtree/issues/489 | |
let g:NERDTreeDirArrows = 1 | |
let g:NERDTreeDirArrowExpandable = '▸' | |
let g:NERDTreeDirArrowCollapsible = '▾' | |
let g:NERDTreeGlyphReadOnly = "RO" | |
" }}} | |
" Search {{{ | |
set incsearch " search as characters are entered | |
set hlsearch " highlight matche | |
set ignorecase " ignore case when searching | |
set smartcase " ignore case if search pattern is lower case | |
" case-sensitive otherwise | |
" set Ag as the grep command | |
if executable('ag') | |
" Note we extract the column as well as the file and line number | |
set grepprg=ag\ --nogroup\ --nocolor\ --column | |
set grepformat=%f:%l:%c%m | |
endif | |
" }}} Search | |
" {{{ Configure Syntastic | |
set statusline+=%#warningmsg# | |
" set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_enable_signs=1 | |
"let g:syntastic_quiet_messages = {'level': 'warnings'} | |
let g:syntastic_auto_loc_list=1 | |
"To enable Just puppet-lint and disable the parser uncomment next line | |
" let g:syntastic_puppet_checkers=['puppetlint'] | |
let g:syntastic_yaml_checkers = ['yamllint'] | |
let g:syntastic_python_checkers = ['pylint'] | |
let g:syntastic_shell_checkers = ['shellcheck'] | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
" }}} Configure Syntastic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment