21 files changed,
169 insertions(+),
129 deletions(-)
Author:
Smirnov Alexander
ss2316544@gmail.com
Committed at:
2021-06-21 19:44:12 +0300
Parent:
093639a
jump to
M
config/nvim/README.md
··· 5 5 yay -S neovim-nightly-bin 6 6 ``` 7 7 8 -## Install plugin manager(`vim-plug`) 8 +## Install plugin manager(`packer`) 9 9 ```bash 10 -sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ 11 - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' 10 +git clone https://github.com/wbthomason/packer.nvim\ 11 + ~/.local/share/nvim/site/pack/packer/start/packer.nvim 12 12 ``` 13 13 14 14 ## Install LSP servers 15 15 ```bash 16 -# tsserver(JS/TS) 17 -npm i -g typescript typescript-language-server 18 - 19 16 # Go(gopls) 20 17 go get golang.org/x/tools/gopls@latest 21 18 22 19 # Python(pyls) 23 20 pip install python-language-server 21 + 22 +# JS/TS 23 +nvim +"LspInstall typescript" 24 24 ```
M
config/nvim/init.vim
··· 1 - call plug#begin('~/.vim/plugged') 2 - Plug 'Smirnov-O/nten.vim' 1 +call plug#begin('~/.vim/plugged') 3 2 Plug 'b3nj5m1n/kommentary' 4 - " Plug 'mattn/emmet-vim', {'on': 'EmmetInstall'} 5 3 Plug 'nvim-lua/plenary.nvim' 6 - Plug 'nvim-lua/popup.nvim' 7 - " Plug 'editorconfig/editorconfig-vim' 8 - Plug 'norcalli/nvim-colorizer.lua' 9 - Plug 'kyazdani42/nvim-web-devicons' 10 - " Status line && Tab line 4 + Plug 'kyazdani42/nvim-tree.lua', {'on': 'NvimTreeToggle'} 5 + Plug 'junegunn/fzf.vim', {'on': ['Files', 'GFiles']} 6 + " Appereance 7 + Plug 'Smirnov-O/nten.vim' 11 8 Plug 'hoob3rt/lualine.nvim' 12 9 Plug 'romgrk/barbar.nvim' 13 - " LSP && Completion 10 + " LSP 14 11 Plug 'neovim/nvim-lspconfig' 12 + Plug 'kabouzeid/nvim-lspinstall' 15 13 Plug 'hrsh7th/nvim-compe' 16 14 Plug 'jiangmiao/auto-pairs' 17 15 " Git 18 16 Plug 'TimUntersberger/neogit' 19 17 Plug 'lewis6991/gitsigns.nvim' 20 - " File explorer 21 - Plug 'kyazdani42/nvim-tree.lua' 22 - Plug 'nvim-telescope/telescope.nvim' 23 - " Better syntax hl 18 + " Syntax 24 19 Plug 'sheerun/vim-polyglot' 25 20 Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} 21 + 22 + " Plug 'mattn/emmet-vim', {'on': 'EmmetInstall'} 23 + " Plug 'norcalli/nvim-colorizer.lua' 26 24 call plug#end() 27 25 28 26 colo codedark 29 27 let mapleader=";" 30 -set termguicolors 28 + 29 +"== Config 30 +set termguicolors " GUI colors 31 +set nu rnu nocul " Line numbers & cursor line highlight 32 +set nolbr nowrap " Line wrap 33 +set mouse=a mh " Mouse 34 +set history=500 " Set history size 35 +set autoread " Auto read file on change 36 +set hidden " Change buffet without warning 37 +set visualbell t_vb= " Disable sounds 38 +set pumheight=8 " Maximum items in pop up 39 +set modeline " Enable modeline 40 +set nosmd " Disable show mode 41 +set nobk noswf noudf " Swap files 42 +set is ic scs " Search 43 +set spr " Split 44 +set enc=utf-8 fenc=utf-8 " Encoding 45 +set scrolloff=3 " Scroll padding 46 +set list listchars=tab:\|·,trail:~,space:· 47 +set completeopt=menuone,noselect 48 + 49 +"== Netrw file tree 50 +let g:netrw_liststyle = 3 51 +let g:netrw_banner = 0 52 +let g:netrw_dirhistmax = 0 31 53 32 54 "== Tab(or spaces) 33 55 set ts=4 sw=4 sts=4 ··· 36 58 "== Custom commands 37 59 com! Prettier :sil !prettier -w % 38 60 com! Term :vs|winc L|se nonu nornu|start|term 39 -com! Notes :Files ~/notes 40 61 com! GoFmt :sil !gofmt -w % 62 +com! Black :sil !black % 41 63 42 -"== Configs 43 -luafile $HOME/.config/nvim/lua/plugins.lua 44 -source $HOME/.config/nvim/vimscript/config.vim 45 -source $HOME/.config/nvim/vimscript/barbar.vim 46 -source $HOME/.config/nvim/vimscript/emmet.vim 47 -source $HOME/.config/nvim/vimscript/compe.vim 48 -source $HOME/.config/nvim/vimscript/filetypes.vim 49 -source $HOME/.config/nvim/vimscript/mappings.vim 64 +"== Emmet 65 +" let g:user_emmet_mode = 'i' 66 +" let g:user_emmet_expandabbr_key ='<c-j>' 67 +" au FileType html,jst,pug,vue,css,less,scss :EmmetInstall 68 + 69 +"== Filetypes 70 +au FileType go setl noet 71 +au FileType javascript,yaml,json setl et ts=2 sw=2 sts=4 72 +au FileType python setl et ts=4 sw=4 sts=4 ai 73 + 74 +"== Config's 75 +lua require'config' 76 +so $HOME/.config/nvim/vimscript/barbar.vim 77 +so $HOME/.config/nvim/vimscript/mappings.vim
A
config/nvim/lua/config.lua
··· 1 +-- LSP servers 2 +require'lspinstall'.setup {} 3 +require'lspconfig'.gopls.setup {} -- Go 4 +require'lspconfig'.pyls.setup {} -- Python 5 +require'lspconfig'.lua.setup {} -- Lua 6 +require'tsserver' -- JS/TS 7 +require'efm' -- Linter's 8 + 9 +-- Compe 10 +require'compe'.setup { 11 + enabled = true, 12 + autocomplete = true, 13 + source = { 14 + -- path = true, 15 + buffer = true, 16 + nvim_lsp = true, 17 + }; 18 +} 19 + 20 +-- LuaLine 21 +require'lualine'.setup {options={ 22 + theme = "codedark" 23 +}} 24 + 25 +-- GitSigns 26 +require'plug.gitsigns' 27 + 28 +-- NeoGit 29 +require'neogit'.setup {} 30 + 31 +-- NvimTree 32 +require'plug.nvimtree' 33 + 34 +-- TreeSitter 35 +require'nvim-treesitter.configs'.setup { 36 + ensure_installed = {'javascript', 'typescript', 'jsdoc', 'python', 'go'}; 37 + highlight = {enable=true}; 38 +} 39 + 40 +-- Colorizer 41 +-- require'plug.colorizer'
A
config/nvim/lua/efm.lua
··· 1 +-- Python 2 +local black = { 3 + formatCommand = "black ${filename}", formatStdin = true 4 +} 5 +local flake8 = { 6 + lintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -", 7 + lintStdin = true, 8 + lintFormats = {"%f:%l:%c: %m"} 9 +} 10 + 11 +-- Javascript 12 +local prettier = { 13 + formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true 14 +} 15 +local eslint = { 16 + lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}", 17 + lintIgnoreExitCode = true, 18 + lintStdin = true, 19 + lintFormats = {"%f:%l:%c: %m"}, 20 + formatCommand = "./node_modules/.bin/eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}", 21 + formatStdin = true 22 +} 23 + 24 +-- GoLang 25 +local golint = { 26 + lintCommand = "golint", 27 + lintIgnoreExitCode = true, 28 + lintFormats = {"%f:%l:%c: %m"}, 29 + lintSource = "golint" 30 +} 31 + 32 +-- Setup 33 +require"lspconfig".efm.setup { 34 + init_options = {documentFormatting = true, codeAction = false}, 35 + filetypes = {"python", "javascript", "typescript", "go"}, 36 + settings = { 37 + rootMarkers = {".git/"}, 38 + languages = { 39 + python = {flake8, black}, 40 + javascript = {eslint, prettier}, 41 + typescript = {eslint, prettier}, 42 + go = {golint} 43 + } 44 + } 45 +}
D
config/nvim/lua/plug/lspconfig.lua
··· 1 -require'lspconfig'.tsserver.setup {} 2 -require'lspconfig'.gopls.setup {} 3 -require'lspconfig'.pyls.setup {}
D
config/nvim/lua/plug/telescope.lua
··· 1 -local actions = require('telescope.actions') 2 - 3 -require('telescope').setup{ 4 - defaults = { 5 - prompt_prefix = "Search > ", 6 - selection_caret = " ", 7 - entry_prefix = " ", 8 - file_ignore_patterns = {"node_modules", "env", ".cache"}, 9 - mappings = { 10 - i = {["<esc>"] = actions.close} 11 - }; 12 - }; 13 -}
D
config/nvim/vimscript/compe.vim
··· 1 -" Settings 2 -set completeopt=menuone,noselect 3 - 4 -" Mappings 5 -ino <expr> <tab> pumvisible() ? "\<C-n>" : "\<tab>" 6 -ino <expr> <s-tab> pumvisible() ? "\<C-p>" : "\<tab>" 7 -ino <expr> <cr> compe#confirm('<CR>') 8 -nno sr :lua vim.lsp.buf.rename()<cr> 9 -nno sh :lua vim.lsp.buf.hover()<cr> 10 -nno si :lua vim.lsp.buf.definition()<cr> 11 -nno sa :lua vim.lsp.buf.code_action()<cr>
D
config/nvim/vimscript/config.vim
··· 1 -"== Vim config 2 -set termguicolors " GUI colors 3 -set nu rnu nocul " Line numbers & cursor line highlight 4 -set nolbr nowrap " Line wrap 5 -set mouse=a mh " Mouse 6 -set history=500 " Set history size 7 -set autoread " Auto read file on change 8 -set hidden " Change buffet without warning 9 -set visualbell t_vb= " Disable sounds 10 -set pumheight=8 " Maximum items in pop up 11 -set modeline " Enable modeline 12 -set nosmd " Disable show mode 13 -set nobk noswf noudf " Swap files 14 -set is ic scs " Search 15 -set spr " Split 16 -set enc=utf-8 fenc=utf-8 " Encoding 17 -set scrolloff=3 18 -set list listchars=tab:\|·,trail:~,space:· 19 - 20 -"== Netrw file tree 21 -let g:netrw_liststyle = 3 22 -let g:netrw_banner = 0 23 -let g:netrw_dirhistmax = 0
D
config/nvim/vimscript/emmet.vim
··· 1 -"== Config 2 -let g:user_emmet_mode = "i" 3 -let g:user_emmet_expandabbr_key ='<c-j>' 4 -let g:user_emmet_leader = "," 5 -let g:user_emmet_settings = { 6 -\ 'javascript': {'extends': 'jsx'}} 7 - 8 -"== Load 9 -au FileType html,jst,pug,vue,css,less,scss :EmmetInstall
D
config/nvim/vimscript/filetypes.vim
··· 1 -au FileType python,elm setl sw=4 ts=4 sts=2 2 -au FileType go setl noet sw=4 ts=4 sts=2 3 -au FileType javascript,html,jst,pug,css,less,scss,json,yaml,lua,vim setl sw=2 ts=2 sts=2
M
config/nvim/vimscript/mappings.vim
··· 1 1 nno <C-s> :w<cr> 2 +nno <C-p> :GFiles<cr> 2 3 nno <space> :noh<cr> 3 4 nno <leader>t :Term<cr> 4 5 nno <leader>e :NvimTreeToggle<cr> 5 -nno <leader>; :Telescope fd<cr> 6 -nno <leader>: :Telescope git_files<cr> 7 -nno <leader>g :Neogit<cr> 6 +nno <leader>; :Files<cr> 7 +nno <leader>d :Neogit<cr> 8 8 9 9 " Buffer 10 10 nno <leader>j :bn<cr> 11 11 nno <leader>k :bp<cr> 12 + 13 +" Compe 14 +ino <expr> <tab> pumvisible() ? "\<C-n>" : "\<tab>" 15 +ino <expr> <s-tab> pumvisible() ? "\<C-p>" : "\<tab>" 16 +ino <expr> <cr> compe#confirm('<CR>') 17 +ino <expr> <c-space> compe#complete() 18 +nno sr :lua vim.lsp.buf.rename()<cr> 19 +nno sh :lua vim.lsp.buf.hover()<cr> 20 +nno sd :lua vim.lsp.buf.definition()<cr> 21 +nno sa :lua vim.lsp.buf.code_action()<cr> 22 +nno si :lua vim.lsp.buf.implementation()<cr> 23 +nno sf :lua vim.lsp.buf.formatting() 24 +nno sR :lua vim.lsp.buf.references()<CR> 12 25 13 26 " Split 14 27 nno <C-h> :winc h<cr>
M
vscode/settings.json
··· 46 46 "**/node_modules": true 47 47 }, 48 48 49 - "emmet.includeLanguages": {"javascript": "javascriptreact"}, 49 + "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", 50 + 50 51 "[javascript]": { 51 52 "editor.defaultFormatter": "esbenp.prettier-vscode", 52 - "editor.tabSize": 2, 53 + "editor.tabSize": 2 53 54 } 54 55 }
M
zshrc
··· 6 6 export PATH="$HOME/bin:$HOME/.local/bin:$HOME/.golang/bin:$GOPATH/bin:$PATH" 7 7 export EDITOR="nvim" 8 8 9 +## FzF 10 +export FZF_DEFAULT_COMMAND="fd -t f -t l -E node_modules -E env -E __pycache__" 11 + 9 12 ## Oh my zsh 10 13 plugins=(dotenv) 11 14 ZSH_THEME="simple" 12 15 source "$HOME/.oh-my-zsh/oh-my-zsh.sh" 13 - 14 -## HotKets 15 -bindkey -s "^o" "ranger\n" 16 -bindkey -s "^g" "lazygit\n" 17 16 18 17 ## FNM 19 18 eval $(fnm env)