Skip to content

Instantly share code, notes, and snippets.

@hG3n
Last active December 22, 2023 16:37
Show Gist options
  • Save hG3n/f56d2115525a50b7bdd2ec6c92df2259 to your computer and use it in GitHub Desktop.
Save hG3n/f56d2115525a50b7bdd2ec6c92df2259 to your computer and use it in GitHub Desktop.
Neovim config
" ===========================================================================
" > GENERAL
" ===========================================================================
scriptencoding utf-8
set enc=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf8,prc
set backspace=indent,eol,start "in case bcksp isnt working well"
set tabstop=4
set shiftwidth=4
set softtabstop=4 "set Tabvalue=4"dd
" set ruler "always show actual position"
set nu "side indexnunbers"
set history=1000
set undolevels=1000
set noswapfile "disable creating stupid .swp files"
set nobackup
set nowritebackup
set autoindent
set title "sets filename on top of the open window"
set wildmenu "sets the autocomplete in commandline"
set showmode "shows the actual mode"
set mouse=a "enables Mouse in vim"
set clipboard=unnamed "use the system clipboard for copying and pasting
set showcmd "show partial commands in status line and
"selected characters/lines in visual mode"
set showmatch "show matching brackets/parenthesis
set incsearch "find as you type search"
set hlsearch "highlights searched objects"
set expandtab "set tabs to spaces
let mapleader = "," "creates mapleader do do more key combinations
let g:mapleader = ","
set termguicolors "nvim so that feline works
" enables codefolding"
set foldmethod=indent
set foldnestmax=10
set foldcolumn=2
set nofoldenable
set foldlevel=1
"soft wrap and indent lines
set breakindent
set showbreak=\
" scroll down with five lines visible
set scrolloff=5
" show the numbers od lines
" set relativenumber
"enables syntax detection"
syntax on
"colorscheme"
set t_Co=256
" set to autoread if a file is changed from the outside
set autoread
set modeline
" ===========================================================================
" > REMAPS
" ===========================================================================
" clearing highlighted search
nmap <silent> <leader>/ :nohlsearch<CR>
" switch to insert mode when typing 'jk' in insert mode
" BEST MAP EVER
inoremap jk <esc>
" temporarily disable escape and cursor keys key
inoremap <esc> <nop>
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" movement
nmap H 0
vmap H 0
nmap L $
vmap L $
" Stupid shift key fixes & helper"
cmap X x
cmap W wj
cmap Q q
cmap WQ wq
cmap wQ wq
cmap Tabe tabe
cmap qq q!
cmap xx x!
cmap ww w!
" faster mapping to get into normal mode
vmap ; :norm
"Yank from the cursor to the end of the line, to be consistent with C and D"
nnoremap Y y$
"pane switching done easily
nmap <tab> <C-w><C-w>
"tab movement
nmap tn :tabnew<CR>
nmap tq :tabclose<CR>
nmap <S-tab> :tabnext<CR>
" cycle through buffers
nmap B :bnext<CR>
" center current search result
nmap n nzz
nmap N Nzz
"Sudo to write
cnoremap w!! w !sudo tee % >/dev/null
"return to the same line if reopen a file"
augroup line_return
au!
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ execute 'normal! g`"zvzz' |
\ endif
augroup END
" ===========================================================================
" > PLUGINS
" ===========================================================================
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
call plug#begin('~/.local/share/nvim/site/plugged')
Plug 'freddiehaddad/feline.nvim'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'doums/darcula'
Plug 'godlygeek/tabular'
Plug 'declancm/cinnamon.nvim'
Plug 'karb94/neoscroll.nvim'
Plug 'luukvbaal/nnn.nvim'
call plug#end()
" ===========================================================================
" > PLUGIN SETTINGS
" ===========================================================================
" >>> FELINE
lua require('feline').setup()
" >>> web devicons
lua require('nvim-web-devicons').setup()
" >>> colorscheme
colorscheme darcula
" >>> cinnamon
" lua require('declancm/cinnamon.nvim').setup()
lua require('neoscroll').setup()
lua require('nnn').setup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment