From 781e71c281d269501bf819f913db7da5f688d4e7 Mon Sep 17 00:00:00 2001 From: arnaucube Date: Thu, 21 Feb 2019 18:17:09 +0100 Subject: [PATCH] add .vimrc, update i3 and neovim config, add install-new-server.sh script --- .vimrc | 51 +++++++++++++ i3/config | 30 ++++---- init.vim | 171 +++++++++++++++++++++++------------------- install-new-server.sh | 53 +++++++++++++ 4 files changed, 211 insertions(+), 94 deletions(-) create mode 100644 .vimrc create mode 100644 install-new-server.sh diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..25685d5 --- /dev/null +++ b/.vimrc @@ -0,0 +1,51 @@ +call plug#begin(expand('~/.vim/plugged')) + +Plug 'scrooloose/nerdtree' +map :NERDTreeToggle + +"" Color +Plug 'tomasr/molokai' +Plug 'morhetz/gruvbox' +Plug 'srcery-colors/srcery-vim' + +call plug#end() + +" visual +syntax on +set ruler +set number +set title +set titlestring=vim-%F +set t_Co=256 +set cursorline + +set background=dark " for the dark version + +" abbreviations +cnoreabbrev W! w! +cnoreabbrev Q! q! +cnoreabbrev Qall! qall! +cnoreabbrev Wq wq +cnoreabbrev Wa wa +cnoreabbrev wQ wq +cnoreabbrev WQ wq +cnoreabbrev W w +cnoreabbrev Q q +cnoreabbrev Qall qall + +"" Switching windows +noremap j +noremap k +noremap l +noremap h + +"" esc mapping +inoremap jk +tnoremap jk + +" scroll +set scrolloff=5 " keep at least 5 lines above/below +set sidescrolloff=5 " keep at least 5 lines left/right + + +colorscheme gruvbox diff --git a/i3/config b/i3/config index d8083bc..a9430cf 100644 --- a/i3/config +++ b/i3/config @@ -44,10 +44,10 @@ bindsym $mod+d exec dmenu_run # bindsym $mod+d exec --no-startup-id i3-dmenu-desktop # change focus -bindsym $mod+j focus left -bindsym $mod+k focus down -bindsym $mod+l focus up -bindsym $mod+ntilde focus right +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right # alternatively, you can use the cursor keys: bindsym $mod+Left focus left @@ -56,10 +56,10 @@ bindsym $mod+Up focus up bindsym $mod+Right focus right # move focused window -bindsym $mod+Shift+j move left -bindsym $mod+Shift+k move down -bindsym $mod+Shift+l move up -bindsym $mod+Shift+ntilde move right +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right # alternatively, you can use the cursor keys: bindsym $mod+Shift+Left move left @@ -68,7 +68,7 @@ bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right # split in horizontal orientation -bindsym $mod+h split h +bindsym $mod+b split h # split in vertical orientation bindsym $mod+v split v @@ -124,7 +124,7 @@ bindsym $mod+Shift+r restart # exit i3 (logs you out of your X session) bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" -bindsym $mod+Control+l exec i3lock -i ~/wallpapers/geometry02_croped1366x768_pixelized.png -c 000000 +bindsym $mod+Control+l exec i3lock -i ~/MEGA/wallpapers/geometry02_croped1920x1080_pixelized.png -c 000000 # resize window (you can also use the mouse for that) mode "resize" { @@ -134,10 +134,10 @@ mode "resize" { # Pressing right will grow the window’s width. # Pressing up will shrink the window’s height. # Pressing down will grow the window’s height. - bindsym j resize shrink width 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize shrink height 10 px or 10 ppt - bindsym ntilde resize grow width 10 px or 10 ppt + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt # same bindings, but for the arrow keys bindsym Left resize shrink width 10 px or 10 ppt @@ -175,7 +175,7 @@ bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness exec redshift-gtk -exec feh --bg-fill ~/wallpapers/geometry02_croped1920x1080.png +exec feh --bg-fill ~/MEGA/wallpapers/geometry02_croped1920x1080.png exec xmodmap .Xmodmap # move current workspace to another display diff --git a/init.vim b/init.vim index 83a5a79..b0fc7fb 100644 --- a/init.vim +++ b/init.vim @@ -1,14 +1,22 @@ call plug#begin(expand('~/.config/nvim/plugged')) +" NERDTree Plug 'scrooloose/nerdtree' Plug 'jistr/vim-nerdtree-tabs' +Plug 'scrooloose/nerdcommenter' + +" vim-airline Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' + +" syntastic +Plug 'scrooloose/syntastic' + Plug 'airblade/vim-gitgutter' Plug 'Raimondi/delimitMate' -Plug 'scrooloose/syntastic' -Plug 'scrooloose/nerdcommenter' Plug 'majutsushi/tagbar' + +" rainbow parentheses Plug 'kien/rainbow_parentheses.vim' " go @@ -31,18 +39,29 @@ Plug 'jelera/vim-javascript-syntax' Plug 'davidhalter/jedi-vim' Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'} +" deoplete Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}} +" neosnippet with deoplete +Plug 'Shougo/neosnippet.vim' +Plug 'Shougo/neosnippet-snippets' +let g:deoplete#enable_at_startup = 1 +" Plugin deoplete neosnippet key-mappings. +" Note: It must be "imap" and "smap". It uses mappings. +imap (neosnippet_expand_or_jump) +smap (neosnippet_expand_or_jump) +xmap (neosnippet_expand_target) + " colors Plug 'tomasr/molokai' Plug 'srcery-colors/srcery-vim' Plug 'rakr/vim-one' Plug 'morhetz/gruvbox' +let g:srcery_italic = 1 -call plug#end() -" setup +call plug#end() " visual syntax on @@ -52,8 +71,7 @@ set title set titlestring=nvim-%F set t_Co=256 set cursorline -" colorscheme one -" set background=dark +set background=dark " for the dark version "Credit joshdick "Use 24-bit (true-color) mode in Vim/Neovim when outside tmux. @@ -72,11 +90,6 @@ if (empty($TMUX)) endif endif -set background=dark " for the dark version -" set background=light " for the light version -" colorscheme one -colorscheme molokai - if $COLORTERM == 'gnome-terminal' set term=gnome-256color else @@ -87,7 +100,69 @@ endif set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\ -" rainbow parentheses + +" go +let g:go_auto_sameids = 1 + +"" go config +function! s:build_go_files() + let l:file = expand('%') + if l:file =~# '^\f\+\.go$' + call go#cmd#Build(0) + endif +endfunction + + +let g:go_list_type = "quickfix" +let g:go_fmt_command = "goimports" +let g:go_fmt_fail_silently = 1 +let g:go_highlight_types = 1 +let g:go_highlight_fields = 1 +let g:go_highlight_functions = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_operators = 1 +let g:go_highlight_build_constraints = 1 +let g:go_highlight_structs = 1 +let g:go_highlight_generate_tags = 1 +let g:go_highlight_space_tab_error = 0 +let g:go_highlight_array_whitespace_error = 0 +let g:go_highlight_trailing_whitespace_error = 0 +let g:go_highlight_extra_types = 1 + +" NERDTree +let NERDTreeShowHidden=1 +autocmd vimenter * NERDTree +map :NERDTreeToggle +" NERDCommenter +let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default +let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation +let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region) + + +" vim-airline +"" let g:airline_theme = 'powerlineish' +let g:airline_theme='one' +let g:airline#extensions#syntastic#enabled = 1 +let g:airline#extensions#branch#enabled = 1 +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tabline#buffer_nr_show = 1 +let g:airline#extensions#tagbar#enabled = 1 +let g:airline_skip_empty_sections = 1 + + +" syntastic +let g:syntastic_always_populate_loc_list=1 +let g:syntastic_error_symbol='✗' +let g:syntastic_warning_symbol='⚠' +let g:syntastic_style_error_symbol = '✗' +let g:syntastic_style_warning_symbol = '⚠' +let g:syntastic_auto_loc_list=1 +let g:syntastic_aggregate_errors = 1 +let g:syntastic_go_checkers = ['golint', 'govet'] +let g:syntastic_python_checkers = [] +let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } + +" rainbowparentheses let g:rbpt_colorpairs = [ \ ['brown', 'RoyalBlue3'], \ ['Darkblue', 'SeaGreen3'], @@ -113,19 +188,6 @@ au Syntax * RainbowParenthesesLoadRound au Syntax * RainbowParenthesesLoadSquare au Syntax * RainbowParenthesesLoadBraces -" go -let g:go_auto_sameids = 1 - -" vim-airline -"" let g:airline_theme = 'powerlineish' -let g:airline_theme='one' -let g:airline#extensions#syntastic#enabled = 1 -let g:airline#extensions#branch#enabled = 1 -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#buffer_nr_show = 1 -let g:airline#extensions#tagbar#enabled = 1 -let g:airline_skip_empty_sections = 1 - " abbreviations cnoreabbrev W! w! cnoreabbrev Q! q! @@ -138,68 +200,19 @@ cnoreabbrev W w cnoreabbrev Q q cnoreabbrev Qall qall -let g:deoplete#enable_at_startup = 1 -let g:srcery_italic = 1 - -" NERDTree -let NERDTreeShowHidden=1 -autocmd vimenter * NERDTree -map :NERDTreeToggle - -" NERDCommenter -let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default -let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation -let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region) - "" Switching windows noremap j noremap k noremap l noremap h +"" esc mapping +inoremap jk +tnoremap jk + " scroll set scrolloff=5 " keep at least 5 lines above/below set sidescrolloff=5 " keep at least 5 lines left/right -" syntastic -let g:syntastic_always_populate_loc_list=1 -let g:syntastic_error_symbol='✗' -let g:syntastic_warning_symbol='⚠' -let g:syntastic_style_error_symbol = '✗' -let g:syntastic_style_warning_symbol = '⚠' -let g:syntastic_auto_loc_list=1 -let g:syntastic_aggregate_errors = 1 - -"" go config - -function! s:build_go_files() - let l:file = expand('%') - if l:file =~# '^\f\+\.go$' - call go#cmd#Build(0) - endif -endfunction - - -let g:go_list_type = "quickfix" -let g:go_fmt_command = "goimports" -let g:go_fmt_fail_silently = 1 -let g:syntastic_go_checkers = ['golint', 'govet'] -let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } - -let g:go_highlight_types = 1 -let g:go_highlight_fields = 1 -let g:go_highlight_functions = 1 -let g:go_highlight_methods = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_build_constraints = 1 -let g:go_highlight_structs = 1 -let g:go_highlight_generate_tags = 1 -let g:go_highlight_space_tab_error = 0 -let g:go_highlight_array_whitespace_error = 0 -let g:go_highlight_trailing_whitespace_error = 0 -let g:go_highlight_extra_types = 1 - -"" esc mapping -inoremap jk -tnoremap jk +colorscheme molokai diff --git a/install-new-server.sh b/install-new-server.sh new file mode 100644 index 0000000..42ab9cd --- /dev/null +++ b/install-new-server.sh @@ -0,0 +1,53 @@ +# assumming that git is already installed and this repo is installed + +echo "updating" +sudo apt-get update + +# tmux +echo "installing tmux" +sudo apt-get -y install tmux + +echo "setting tmux config" +cp ../.tmux.conf ~/.tmux.conf + +# vim +echo "setting vim config" +cp ../.vimrc ~/.vimrc + +# neovim +echo "installing neovim" +sudo apt-get -y install neovim +curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + +echo "setting nvim config" +mkdir ~/config +mkdir ~/config/nvim +cp ../init.vim ~/.config/nvim/init.vim + +# vim & neovim PlugInstall +echo "installing PlugInstall vim" +curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +echo "installing PlugInstall neovim" +curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + +# bash +echo "append .bashrc of this repo lines to the .bashrc system file" +cat ../.bashrc >> ~/.bashrc + +source .bashrc + +# go +echo "installing go 1.11.5" +wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz +tar -C /usr/local -xzf go1.11.5.linux-amd64.tar.gz + +# nodejs +echo "installing nodejs v8" +curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - +sudo apt-get install -y nodejs + +echo "installing npm http-server" +sudo npm install -g http-server