Skip to content

Instantly share code, notes, and snippets.

@alpharaoh
Created October 14, 2021 15:26
Show Gist options
  • Save alpharaoh/881ed5faffe42f79f5a51af347636f3e to your computer and use it in GitHub Desktop.
Save alpharaoh/881ed5faffe42f79f5a51af347636f3e to your computer and use it in GitHub Desktop.
Neovim config
" Download nvim
" curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage; chmod u+x nvim.appimage; mv ./nvim.appimage /usr/local/bin/nvim
" Clone this file to ~/.config/nvim/init.vim
" After finishing config, run nvim +PlugInstall
call plug#begin("~/.vim/plugged")
" Plugin Section
Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
Plug 'scrooloose/nerdtree'
Plug 'ryanoasis/vim-devicons'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
call plug#end()
"Config Section
let g:tokyonight_style = "night"
let g:tokyonight_italic_functions = 1
let g:tokyonight_transparent_sidebar = 1
let g:tokyonight_transparent = 1
colorscheme tokyonight
"File explorer
let g:NERDTreeShowHidden = 1
let g:NERDTreeMinimalUI = 1
let g:NERDTreeIgnore = []
let g:NERDTreeStatusline = ''
" Automaticaly close nvim if NERDTree is only thing left open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Toggle
nnoremap <silent> <C-b> :NERDTreeToggle<CR>
" open new split panes to right and below
set splitright
set splitbelow
" turn terminal to normal mode with escape
tnoremap <Esc> <C-\><C-n>
" start terminal in insert mode
au BufEnter * if &buftype == 'terminal' | :startinsert | endif
" open terminal on ctrl+n
function! OpenTerminal()
split term://bash
resize 10
endfunction
nnoremap <c-n> :call OpenTerminal()<CR>
" use alt+hjkl to move between split/vsplit panels
tnoremap <A-h> <C-\><C-n><C-w>h
tnoremap <A-j> <C-\><C-n><C-w>j
tnoremap <A-k> <C-\><C-n><C-w>k
tnoremap <A-l> <C-\><C-n><C-w>l
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l
"File searching
nnoremap <C-p> :FZF<CR>
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\}
set relativenumber
set number
syntax on
set autoindent
set softtabstop=4
imap kj <Esc>
set tabstop=4
set shiftwidth=4
set expandtab
" let $FZF_DEFAULT_COMMAND = 'ag -g ""'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment