all repos — dotfiles @ 993b9f09a3ce2eb75f40b69b0fe9e2d705ec5119

linux dotfiles

update vimrc and playlist-sync
Prithu Goswami prithugoswami524@gmail.com
Tue, 29 Oct 2019 13:26:59 +0530
commit

993b9f09a3ce2eb75f40b69b0fe9e2d705ec5119

parent

63ad96f25b77af8bd45111917a3cab8e8de4d799

2 files changed, 43 insertions(+), 32 deletions(-)

jump to
M .vimrc.vimrc

@@ -24,7 +24,7 @@ set smartindent

" when opening a new line, keep the same indentation if no " file-specific indenting is enabled set autoindent -set viminfo='10,<100,:100,%,n~/.vim/.viminfo +" set viminfo='10,<100,:100,%,n~/.vim/.viminfo set undofile

@@ -35,9 +35,10 @@ " compiling for different file types

" autocmd FileType markdown nnoremap cm :w<Enter>:!pandoc -f gfm -V geometry=margin=0.75in --resource-path="expand('%:p:h')/img" -V links-as-notes -o %.pdf %<Enter><Enter> "autocmd FileType markdown nnoremap cm :w<Enter>:!pandoc -f markdown+raw_tex -V geometry=margin=0.75in -V papersize=A4 -o pdf/%.pdf %<Enter><Enter> " -" autocmd FileType markdown nnoremap cm :w<Enter>:!pandoc -H ./header -f markdown+raw_tex+raw_attribute -o pdf/%.pdf %<Enter><Enter> -autocmd FileType markdown nnoremap cm :w<Enter>:!pandoc -f markdown+raw_tex+raw_attribute -o pdf/%.pdf %<Enter><Enter> -autocmd FileType tex nnoremap cm :w<Enter>:!pdflatex -interaction nonstopmode % 1&>/dev/null<Enter><Enter> +autocmd FileType markdown nnoremap cm :w<Enter>:!pandoc -H ~/.config/header -f markdown+raw_tex+raw_attribute -o pdf/%.pdf %<Enter><Enter> +" autocmd FileType markdown nnoremap cm :w<Enter>:!pandoc -f markdown+raw_tex+raw_attribute -o pdf/%.pdf %<Enter><Enter> +autocmd FileType tex nnoremap cm :w<Enter>:!xelatex % 1&>/dev/null<Enter><Enter> +" autocmd FileType tex nnoremap cm :w<Enter>:!pdflatex -interaction nonstopmode % 1&>/dev/null<Enter><Enter> autocmd FileType html setlocal ts=2 sts=2 sw=2 " autocmd FileType c nnoremap cp :w<Enter>:!clear && gcc % && ./a.out<Enter> autocmd BufRead *.pdentry :Goyo

@@ -69,6 +70,8 @@ "set hlsearch " highlight search matches

" turn off search highlight nnoremap <leader><space> :nohlsearch<CR> +nnoremap <leader>hs i\texthindi{<Esc>:r !zenity --entry --width=800<Enter>kJxA}<CR><Esc> +nnoremap <leader>hh :r !zenity --entry --width=800<Enter> set foldenable " enable folding

@@ -106,16 +109,19 @@

nnoremap <unique> <C-_> :FZF<CR> nnoremap <unique> <C-B> :Buffers<CR> +set autoread +nnoremap <leader>r :e!<Enter> + " jk is escape inoremap jk <esc> " Use a blinking upright bar cursor in Insert mode, a blinking block in normal "if &term == 'xterm-256color' || &term == 'screen-256color' let &t_SI = "\<Esc>[5 q" -let &t_EI = "\<Esc>[1 q" +let &t_EI = "\<Esc>[4 q" "endif -if exists('$TMUX') - let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" - let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" -endif +" if exists('$TMUX') +" let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" +" let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" +" endif
M bin/scripts/playlist-syncbin/scripts/playlist-sync

@@ -13,6 +13,9 @@ # This script syncs playlist from spotify using the spotify-downloader

# module written by ritiek [https://github.com/ritiek/spotify-downloader] # Conifg file : ~/.config/playlist-syncer/config.json # The config file is in json and is read to get a list of playlists to sync +# +# Requirements: +# 'spotdl', 'unicode-slugify', 'spotipy' # # Example config file: #

@@ -72,9 +75,11 @@

def create_config(): ans = input("Config file does not exist. Create it? [y/n] ") if ans in "yY": + os.mkdir(HOME+'/.config/playlist-sync') + global config + config={'playlists':[]} with open(config_path, 'w') as jsonfile: - config_data={'playlists':[]} - json.dump(config_data, jsonfile, indent=4) + json.dump(config, jsonfile, indent=4) ans = input("\nWould you also like to add a playlist? [y/n] ") if ans in "yY": pl_id=input('\nPlaylist Id > ')

@@ -90,29 +95,29 @@ exit(0)

def add_playlist(plid, path): - try: - pl=sp.user_playlist(' ', plid) - except spotipy.client.SpotifyException: - print('Err:Invalid Playlist Id') - exit(1) + try: + pl=sp.user_playlist(' ', plid) + except spotipy.client.SpotifyException: + print('Err:Invalid Playlist Id') + exit(1) - playlist= { - "name": pl['name'], - "id": pl['id'], - "location": path, - "snapshot_id": ' ', - "last_updated": 'never' - } - config['playlists'].append(playlist) - with open(config_path, 'w') as jsonfile: - json.dump(config, jsonfile, indent=4) + playlist= { + "name": pl['name'], + "id": pl['id'], + "location": path, + "snapshot_id": ' ', + "last_updated": 'never' + } + config['playlists'].append(playlist) + with open(config_path, 'w') as jsonfile: + json.dump(config, jsonfile, indent=4) - print('Added playlist: {} \n' - 'Sync path: {}'.format(pl['name'], path)) - print('\nUpdated config file') - if not os.path.exists(path): - os.mkdir(path) - print('Created directory: {}'.format(path)) + print('Added playlist: {} \n' + 'Sync path: {}'.format(pl['name'], path)) + print('\nUpdated config file') + if not os.path.exists(path): + os.mkdir(path) + print('Created directory: {}'.format(path)) def requires_update(playlist_data, playlist): return playlist_data['snapshot_id'] != playlist['snapshot_id']