├── .gitignore ├── coc-settings.json ├── ftplugin ├── javascript.vim ├── python.vim ├── html.vim └── htmldjango.vim ├── image └── NeoVim.png ├── README.md ├── themes └── onedark.vim ├── LICENSE └── init.vim /.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /coc-settings.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ftplugin/javascript.vim: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ftplugin/python.vim: -------------------------------------------------------------------------------- 1 | set foldmethod=indent 2 | set foldlevel=99 3 | -------------------------------------------------------------------------------- /image/NeoVim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iam-benyamin/customize-neovim-configuration/HEAD/image/NeoVim.png -------------------------------------------------------------------------------- /ftplugin/html.vim: -------------------------------------------------------------------------------- 1 | syn region djangotagmarkers start="{{" end="}}" 2 | syn region djangovariablemarkers start="{%" end="%}" 3 | command! -nargs=+ HiLink hi def link 4 | HiLink djangotagmarkers PreProc 5 | HiLink djangovariablemarkers PreProc 6 | delcommand HiLink 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # neovim config 2 | 3 | ![vim screenshot](./image/NeoVim.png) 4 | 5 | 6 | ## installation 7 | 1. install vim plug 8 | 2. clone this repo into your ~/.config/nvim/ 9 | 3. install coc on your system 10 | 4. install vim plugins with :PlugInstall 11 | -------------------------------------------------------------------------------- /ftplugin/htmldjango.vim: -------------------------------------------------------------------------------- 1 | " https://code.djangoproject.com/wiki/UsingVimWithDjango in Surround Mappings 2 | let b:surround_{char2nr("v")} = "{{ \r }}" 3 | let b:surround_{char2nr("{")} = "{{ \r }}" 4 | let b:surround_{char2nr("%")} = "{% \r %}" 5 | let b:surround_{char2nr("b")} = "{% block \1block name: \1 %}\r{% endblock \1\1 %}" 6 | let b:surround_{char2nr("i")} = "{% if \1condition: \1 %}\r{% endif %}" 7 | let b:surround_{char2nr("w")} = "{% with \1with: \1 %}\r{% endwith %}" 8 | let b:surround_{char2nr("f")} = "{% for \1for loop: \1 %}\r{% endfor %}" 9 | let b:surround_{char2nr("c")} = "{% comment %}\r{% endcomment %}" 10 | -------------------------------------------------------------------------------- /themes/onedark.vim: -------------------------------------------------------------------------------- 1 | " onedark.vim override: Don't set a background color when running in a terminal; 2 | if (has("autocmd") && !has("gui_running")) 3 | augroup colorset 4 | autocmd! 5 | let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" } 6 | autocmd ColorScheme * call onedark#set_highlight("Normal", { "fg": s:white }) " `bg` will not be styled since there is no `bg` setting 7 | augroup END 8 | endif 9 | 10 | hi Comment cterm=italic 11 | let g:onedark_hide_endofbuffer=1 12 | let g:onedark_terminal_italics=1 13 | let g:onedark_termcolors=256 14 | 15 | syntax on 16 | 17 | " checks if your terminal has 24-bit color support 18 | if (has("termguicolors")) 19 | set termguicolors 20 | hi LineNr ctermbg=NONE guibg=NONE 21 | endif 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Benyamin Mahmoudyan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /init.vim: -------------------------------------------------------------------------------- 1 | " syntax hightlight 2 | syntax on 3 | syntax enable 4 | 5 | " can config neovim by file type 6 | filetype plugin on 7 | filetype on 8 | 9 | " automaticly save files 10 | set autowrite 11 | 12 | set encoding=UTF-8 13 | 14 | " tabs and indentation 15 | set smartindent 16 | set smartcase 17 | set autoindent 18 | set tabstop=4 19 | set smarttab 20 | set softtabstop=4 21 | set shiftwidth=4 22 | set expandtab 23 | 24 | set nobackup 25 | set noswapfile 26 | 27 | set undodir=~/.vim/undodir 28 | set undofile 29 | 30 | set number 31 | set relativenumber 32 | 33 | " set extra line before the number for show errors 34 | set signcolumn=yes 35 | 36 | " vertical line hightlight at column 80 37 | set colorcolumn=79 38 | " highlight ColorColumn ctermbg=0 guibg=lightgrey 39 | 40 | " Enable cursor line position tracking: 41 | set cursorline 42 | 43 | " cursor always be in middel of screen 44 | set scrolloff=5 45 | 46 | " can use mouse 47 | set mouse=a 48 | 49 | " no wrap lines 50 | set nowrap 51 | 52 | " use system clipboard 53 | set clipboard=unnamed 54 | 55 | " Makes search act like search in modern browsers 56 | set incsearch 57 | " uper or lower case is important in searches 58 | set ignorecase 59 | 60 | " Give more space for displaying messages. 61 | set cmdheight=1 62 | 63 | " Enable folding 64 | set foldmethod=indent 65 | set foldlevel=99 66 | 67 | set history=10 68 | 69 | " vim-plug from 'https://github.com/junegunn/vim-plug' 70 | call plug#begin() 71 | 72 | Plug 'vim-airline/vim-airline' " vim air line 73 | Plug 'preservim/nerdtree' " NERDTree 74 | Plug 'tpope/vim-commentary' " For Commenting gcc & gc 75 | Plug 'ap/vim-css-color' " CSS Color Preview 76 | " Plug 'terryma/vim-multiple-cursors' " CTRL + N for multiple cursors 77 | Plug 'ryanoasis/vim-devicons' " Developer Icons 78 | 79 | " color schemes 80 | Plug 'morhetz/gruvbox' " gruvbox 81 | Plug 'rafi/awesome-vim-colorschemes' " Retro 82 | Plug 'joshdick/onedark.vim' " onedark 83 | 84 | " repo url is 'https://github.com/neoclide/coc.nvim' 85 | " google 'coc' for install autocomplition for your programming language 86 | Plug 'neoclide/coc.nvim', {'branch': 'release'} " coc autocomplition for vim 87 | 88 | " javascript 89 | Plug 'neovim/nvim-lspconfig' 90 | 91 | " XML 92 | Plug 'sukima/xmledit' 93 | 94 | " git 95 | Plug 'tpope/vim-fugitive' 96 | 97 | " jsx Syntax Highlighting 98 | Plug 'mxw/vim-jsx' 99 | Plug 'pangloss/vim-javascript' 100 | 101 | " Asynchronous Lint Engine 102 | " Plug 'dense-analysis/ale' 103 | 104 | " typescript 105 | Plug 'leafgarland/typescript-vim' 106 | 107 | Plug '907th/vim-auto-save' 108 | 109 | " git 110 | Plug 'airblade/vim-gitgutter' 111 | 112 | " copilot 113 | " Plug 'github/copilot.vim' 114 | 115 | " telescope (https://github.com/nvim-telescope/telescope.nvim) and dependency 116 | Plug 'nvim-lua/plenary.nvim' 117 | " install https://github.com/BurntSushi/ripgrep 118 | " https://github.com/nvim-telescope/telescope-fzf-native.nvim 119 | Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } 120 | Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} 121 | " icons by filetype 122 | Plug 'nvim-tree/nvim-web-devicons' 123 | 124 | Plug 'nvim-lua/plenary.nvim' 125 | Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' } 126 | 127 | call plug#end() 128 | 129 | " color scheme setting 130 | colorscheme gruvbox 131 | set background=dark 132 | " colorscheme afterglow 133 | " colorscheme onedark 134 | 135 | " transparent background 136 | hi Normal guibg=NONE ctermbg=NONE 137 | 138 | " if you wont to use onedark theme un comment next to lines 139 | " next line you have to enter your theme config path 140 | " source $HOME/.config/nvim/themes/onedark.vim 141 | 142 | " Exit Vim if NERDTree is the only window remaining in the only tab. 143 | " autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif 144 | 145 | " next two function work on delete extra unnecessary white space 146 | fun! TrimWhitespace() 147 | let l:save = winsaveview() 148 | keeppatterns %s/\s\+$//e 149 | call winrestview(l:save) 150 | endfun 151 | 152 | augroup THE_PRIMEAGEN 153 | autocmd! 154 | autocmd BufWritePre * :call TrimWhitespace() 155 | augroup END 156 | 157 | " fzf pop up window 158 | let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.9 } } 159 | " let $FZF_DEFAULT_OPTS='--reverse' 160 | 161 | 162 | " airline configrautions 163 | " let g:airline_theme='onedark' 164 | let g:airline_theme='onedark' 165 | " let g:airline#extensions#tabline#enabled=1 166 | let g:airline#extensions#tabline#formatter='unique_tail' 167 | let g:airline_powerline_fonts=1 168 | 169 | " nerdtree config 170 | " show hidden files 171 | let NERDTreeShowHidden=1 172 | 173 | " this line do auto complite with tab and use coc for this perpose 174 | " inoremap pumvisible() ? coc#_select_confirm() : "" 175 | " navigate completion list 176 | " inoremap coc#pum#visible() ? coc#pum#next(1) : "\" 177 | 178 | " confirm highlight itme with tab 179 | inoremap coc#pum#visible() ? coc#_select_confirm() : "\u\" 180 | 181 | " Use to trigger completion. 182 | inoremap coc#refresh() 183 | 184 | " coc set file type config for scss from coc-css extention 185 | autocmd FileType scss setl iskeyword+=@-@ 186 | 187 | " Use fontawesome icons as signs 188 | let g:gitgutter_sign_added = '+' 189 | let g:gitgutter_sign_modified = '>' 190 | let g:gitgutter_sign_removed = '-' 191 | let g:gitgutter_sign_removed_first_line = '^' 192 | let g:gitgutter_sign_modified_removed = '<' 193 | 194 | let g:gitgutter_override_sign_column_highlight = 1 195 | " highlight SignColumn guibg=bg 196 | " highlight SignColumn ctermbg=bg 197 | 198 | " Update sign column every quarter second 199 | set updatetime=250 200 | 201 | 202 | " auto save 203 | let g:auto_save = 1 " enable AutoSave on Vim startup 204 | let g:auto_save_silent = 0 " do not display the auto-save notification 205 | 206 | " Find files using Telescope command-line sugar. 207 | nnoremap tf :Telescope find_files 208 | nnoremap tg :Telescope live_grep 209 | nnoremap tb :Telescope buffers 210 | --------------------------------------------------------------------------------